Views 997
Visitors 630

Dialog (103) - Table Control

Home 
| Top Page | Threads |
Previous  Next

 

Creating Dialog

1.Open SE38
3.Select All Object

abp0018

4.Change Program "YPRACTICE_DIALOG_103"
5.Open Goto > Attributes, and change Title with "103 - Table Control"
6.Modified Report Declaration

Before

REPORT  ypractice_dialog_101                    .

 

After

REPORT  ypractice_dialog_103                    .

 

7.Modified ""

Before

*----------------------------------------------------------------------*

*GLOBAL VARIABLE DECRALATION

*----------------------------------------------------------------------*

 

DATA : ok_code LIKE sy-ucomm,

       save_ok LIKE sy-ucomm.

 

DATA : gv_message1(100),

       gv_message2(100).

 

*----------------------------------------------------------------------*

 

After

*----------------------------------------------------------------------*

*GLOBAL VARIABLE DECRALATION

*----------------------------------------------------------------------*

TYPES: BEGIN OF ty_header,

         matkl LIKE mara-matkl,  " Material Group

         matnr LIKE mara-matnr,  " Material Number

         maktx LIKE makt-maktx,  " Material Description

         bismt LIKE mara-bismt,  " Old material number

         meins LIKE mara-meins,  " Base Unit of Measure

         mseht LIKE t006a-mseht, " Unit of Measurement Text

         Cek,

       END OF ty_header.

 

* Or You can using this code bellow

*TYPES: BEGIN OF ty_header.

*         INCLUDE STRUCTURE yta_header_101.

*TYPES:   cek,

*       END OF ty_header.

 

* Deklarasi Internal Table

DATA: gi_header TYPE STANDARD TABLE OF ty_header WITH HEADER LINE,

      gi_makt  LIKE STANDARD TABLE OF makt WITH HEADER LINE,

      gi_t006a LIKE STANDARD TABLE OF t006a WITH HEADER LINE.

 

DATA: gv_matkl LIKE mara-matkl.

 

DATA : ok_code LIKE sy-ucomm,

       save_ok LIKE sy-ucomm.

 

DATA : gv_message1(100),

       gv_message2(100).

 

*----------------------------------------------------------------------*

 

8.Click "abap_tutorial0019" and click "abap_tutorial0031"
9.Select "REPS", "CUAD" and "DYNP"

abp0033

10.Click "abap_tutorial0025" to activate the program
11.Click "ar0015"
12.Double click "abp0008" to open screen 2000
13.Click "ar0018" to start design layout (Screen Painter)
14.Click "abp0019" and then click to screen
15.Set Label (Text Field) Name with "GV_LABEL1" and Text with "Material Group." like this bellow

abp0034

 

16.Click "abp0021" and then click to screen
17.Set TextBox (Input/Output Field) name with "GV_MATKL" with length "10" like this bellow

abp0035

 

18.Double Click "abp0041" and set Search help with "H_T023"

abp0040

 

19.After that the TextBox changed to "abp0042"
20.Click "abp0023" and then click to screen
21.Set Button (PushButton) name with "GV_BUTTON" like this bellow

abp0036

 

22.Double click "abp0037" and set Function Code with "DISPLAY"

abp0038

 

23.After that the button color changed to gray like this "abp0039"
24.Click "abap_tutorial0019" to save the screen
25.Click "abp0043" and drag it at screen painter
26.After than Table Control Wizard will be run

abp0044

 

27.Click "abp0045" Followed this steps bellow

Display Steps

Fill Name of table control with "ZTC_HEADER" and then click "abp0045"

abp0046

 

Select "Internal program table" and fill it with "GI_HEADER" and then click "abp0045"

abp0047

 

Select Field like this bellow and then click "abp0045"

abp0048

 

Checklist "List selection col" and fill it with "CEK" like this bellow and then click "abp0045"

abp0050

 

Checklist "Scroll" and then click "abp0045"

abp0049

 

Fill all Text Box with "YPRACTICE_DIALOG_103_HEADER" and then click "abp0045"

abp0051

 

Click "abp0052" to complete this wizard and generate source code and dialog object.

 

Wizard Result

abp0053

 

28.Click "abap_tutorial0019" to save the screen and then close the screen painter
29.Back to source code
30.Modified module "USER_COMMAND_2000 input"

Before

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_2000  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

module USER_COMMAND_2000 input.

  save_ok = ok_code.

  CLEAR ok_code.

 

  CASE save_ok.

    WHEN 'BACK'.

      LEAVE TO SCREEN 0.

    WHEN OTHERS.

 

  ENDCASE.

 

  CLEAR ok_code.

endmodule.                 " USER_COMMAND_2000  INPUT

 

After

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_2000  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE user_command_2000 INPUT.

  save_ok = ok_code.

  CLEAR ok_code.

 

  CASE save_ok.

    WHEN 'BACK'.

      LEAVE TO SCREEN 0.

    WHEN 'DISPLAY'.

      CALL FUNCTION 'YFM_RFC_PRACTICE_101'

       EXPORTING

         gv_matkl         = gv_matkl

*         GV_MATNR         =

         gv_max_row       = 0

       TABLES

         gi_header        = gi_header

                .

    WHEN OTHERS.

 

  ENDCASE.

 

  CLEAR ok_code.

ENDMODULE.                 " USER_COMMAND_2000  INPUT

 

31.Click "abap_tutorial0019" and click "abap_tutorial0031"
32.Select "REPS", "REPS" and "DYNP"

abp0054

33.Click "abap_tutorial0025" to activate the program
34.Test and Run program
36.Finished

 

Result

Screen 2000

abp0055

 

After button "Display" clicked

abp0056

 

Flow Logic

PROCESS BEFORE OUTPUT.

*&spwizard: pbo flow logic for tablecontrol 'ZTC_HEADER'

  module ZTC_HEADER_change_tc_attr.

*&spwizard: module ZTC_HEADER_change_col_attr.

  loop at   GI_HEADER

       with control ZTC_HEADER

       cursor ZTC_HEADER-current_line.

    module ZTC_HEADER_get_lines.

*&spwizard:   module ZTC_HEADER_change_field_attr

  endloop.

 

MODULE STATUS_2000.

*

PROCESS AFTER INPUT.

*&spwizard: pai flow logic for tablecontrol 'ZTC_HEADER'

  loop at GI_HEADER.

    chain.

      field GI_HEADER-MATKL.

      field GI_HEADER-MATNR.

      field GI_HEADER-MAKTX.

      field GI_HEADER-BISMT.

      field GI_HEADER-MEINS.

      field GI_HEADER-MSEHT.

    endchain.

    field GI_HEADER-CEK

      module ZTC_HEADER_mark on request.

  endloop.

  module ZTC_HEADER_user_command.

*&spwizard: module ZTC_HEADER_change_tc_attr.

*&spwizard: module ZTC_HEADER_change_col_attr.

 

MODULE USER_COMMAND_2000.

 

User Threads | New Thread ( Only for Donators )

Threads Last Post Replies Views