Anda di halaman 1dari 3

Execute this in your development system. Let me know if you have any queries.

*&---------------------------------------------------------------------* *& Report YREPLACE_123 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* report abc. parameters:pa_table type tabname default 'MAKT'. data:lv_message_text type string, lv_screen_line type string, lv_incorrectword type string, lv_fields type i, lv_max_length type i, ls_field_list type d021s, lt_field_list type table of d021s with header line, lt_flow_logic type table of d022s with header line, lt_screen_header type table of d020s with header line, ls_header type d020s, lv_dynpro type char44, lt_attrib type table of d023s with header line, lo_ref type ref to data, lo_line type ref to data, lt_fields type lvc_t_fcat, lt_fields_temp type lvc_t_fcat, ls_fields type lvc_s_fcat. field-symbols:<fs_tab> type any table, <fs> type any. start-of-selection. call function 'LVC_FIELDCATALOG_MERGE' exporting i_structure_name = pa_table i_client_never_display = ' ' changing ct_fieldcat = lt_fields. loop at lt_fields into ls_fields. if strlen( ls_fields-reptext ) > lv_max_length. lv_max_length = strlen( ls_fields-reptext ). endif. endloop. if lv_max_length = 0. lv_max_length = 3. endif. perform build_screen_fields. perform build_flow_logic_etc. call method cl_alv_table_create=>create_dynamic_table exporting it_fieldcatalog = lt_fields importing

ep_table = lo_ref. assign lo_ref->* to <fs_tab>. create data lo_line like line of <fs_tab>. assign lo_line->* to <fs>. break-point. lv_dynpro = sy-repid. lv_dynpro+40(4) = '0100'. syntax-check for dynpro lt_screen_header lt_field_list lt_flow_logic lt_attrib message lv_message_text line lv_screen_line word lv_incorrectwor d. if sy-subrc <> 0. "---> endif. generate dynpro lt_screen_header lt_field_list lt_flow_logic lt_attrib id lv_dynpro message lv_message_text line lv_screen_line word lv_incorrectword. " #EC CI_GENERATE if sy-subrc <> 0. "---> endif. call screen 0100. form build_screen_fields . data:lv_length type i. data:lv_tabix type sy-tabix, lv_field_dyn(5) type n. lv_tabix = lv_tabix + 2. loop at lt_fields into ls_fields. lv_field_dyn = sy-tabix. lv_length = 0. lv_tabix = lv_tabix + 1. ls_field_list-stxt = ls_fields-reptext. if ls_field_list-stxt is initial. ls_field_list-stxt = '???'. endif. ls_field_list-fnam = lv_field_dyn. ls_field_list-fmb1 = '30'. ls_field_list-leng = lv_max_length. ls_field_list-line = lv_tabix. ls_field_list-coln = '02'. ls_field_list-type = 'CHAR'. append ls_field_list to lt_field_list. clear ls_field_list. ls_field_list-coln ls_field_list-fnam ls_field_list-flg1 ls_field_list-flg3 = = = = lv_max_length + 3. ls_fields-fieldname. '80'. '80'.

ls_field_list-line = ls_field_list-type = ls_field_list-ityp = ls_field_list-leng = append ls_field_list clear ls_field_list. endloop. endform.

lv_tabix. ls_fields-datatype. ls_fields-inttype. ls_fields-intlen. to lt_field_list.

" BUILD_SCREEN_FIELDS

form build_flow_logic_etc . field-symbols:<fs_flow_logic> type d022s. data:lt_field_list type table of d021s with header line. call function 'RS_DYNPRO_CREATE_INITIAL' exporting program = sy-repid dynnr = '0100' importing dynpro_header = ls_header tables dynpro_fields = lt_field_list dynpro_flow = lt_flow_logic dynpro_params = lt_attrib. loop at lt_flow_logic assigning <fs_flow_logic>. if <fs_flow_logic>+0(1) = '*'. clear <fs_flow_logic>+0(1). endif. endloop. insert initial line into lt_flow_logic index 5 assigning <fs_flow_logic>. <fs_flow_logic>-line = 'MODULE exit_screen AT EXIT-COMMAND.'. "#EC NOTEXT endform. module status_0100 output. set pf-status 'ZABC'. endmodule. module exit_screen. set screen 0. leave screen. endmodule. " BUILD_FLOW_LOGIC

"status_0100 OUTPUT

"exit_screen

module user_command_0100 input. "--> your logic here set screen 100. endmodule. "user_command_0100 INPUT

Anda mungkin juga menyukai