1.获取屏幕参数值 FUN: RS_SCRP_GET_SCREEN_INFOS

  call function 'RS_SCRP_GET_SCREEN_INFOS'

    exporting

      dynnr                       = '1000'

      progname                    = 'ZSDA008_SO_HEADER'

    tables

      fieldlist                   = lt_field_list

    exceptions

      dynpro_does_not_exist       = 1

      no_field_list               = 2

      cancelled                   = 3

      others                      = 4 .

  if sy-subrc <> 0.

*   implement suitable error handling here

  endif.

 

 

2.屏幕生成过程

 

  lv_dynpro = sy-repid.

  lv_dynpro+40(4) = '0100'.

  lt_flow_logic-line = 'process before output.'.               append lt_flow_logic.

  lt_flow_logic-line = 'module status_0100.'.                  append lt_flow_logic.

  lt_flow_logic-line = 'process after input.'.                 append lt_flow_logic.

  lt_flow_logic-line = 'module exit_screen at exit-command.'.  append lt_flow_logic.

  lt_flow_logic-line = 'module user_command_0100.'.            append lt_flow_logic.

  lt_flow_logic-line = 'process on value-request.'.            append lt_flow_logic.

  lt_flow_logic-line = 'field tlow module t_low_help.'.        append lt_flow_logic.

  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_incorrectword.

  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.

  

3.程序附件

ZEXP_SCREEN_TEST

*&---------------------------------------------------------------------*
*& Report  ZEXP_SCREEN_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
 
report  zexp_screen_test.
 
tables:sscrfields.
 
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.
 
data:begin of etab occurs 0,
     check type c,
     posnr type posnr,
     deflg type c,
     htetr like vbap-netwr,
     vbelv like likp-vbeln,
     sktxt type char50,
     rqtxt type char50,
     jsdat like sy-datum,
     zdays type posnr,
     hkdat like sy-datum,
     ysetr type netwr,
     bezei type char80,
     ernam type char15,
     erdat type datum,
     end of etab.
 
field-symbols:<fs_tab> type any table,
              <fs> type any.
 
data:tlow type vbeln_va,
     tlow1 type vbeln_vl,
     thigh type vbeln_va,
     thigh1 type vbeln_va,
     tpush type char10.
 
"controls:imptb type tableview using screen 0100.
 
start-of-selection.
 
  assign tlow to <fs>.
 
  perform build_screen_fields.
 
  lv_dynpro = sy-repid.
  lv_dynpro+40(4) = '0100'.
 
  lt_flow_logic-line = 'process before output.'.               append lt_flow_logic.
  lt_flow_logic-line = 'module status_0100.'.                  append lt_flow_logic.
 
  lt_flow_logic-line = 'process after input.'.                 append lt_flow_logic.
  lt_flow_logic-line = 'module exit_screen at exit-command.'.  append lt_flow_logic.
 
  lt_flow_logic-line = 'module user_command_0100.'.            append lt_flow_logic.
 
  lt_flow_logic-line = 'process on value-request.'.            append lt_flow_logic.
  lt_flow_logic-line = 'field tlow module t_low_help.'.        append lt_flow_logic.
 
  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_incorrectword.
  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.
 
start-of-selection.
 
  call screen 0100.  " starting at 3 3 ending at 60 60.
 
form build_screen_fields .
 
*  call function 'RS_SCRP_GET_SCREEN_INFOS'
*    exporting
*      dynnr                       = '1000'
*      progname                    = 'ZSDA008_SO_HEADER'
*    tables
*      fieldlist                   = lt_field_list
*    exceptions
*      dynpro_does_not_exist       = 1
*      no_field_list               = 2
*      cancelled                   = 3
*      others                      = 4 .
*  if sy-subrc <> 0.
**   implement suitable error handling here
*  endif.
 
*    ls_field_list-fnam = ''.    字段名
*    ls_field_list-didx = ''.    frame high
*    ls_field_list-flg1 = ''.
*    ls_field_list-flg2 = ''.
*    ls_field_list-flg3 = ''.    A0  obligatory  00 entry and clear  80 entry
*    ls_field_list-fill = ''.    C   checkbutton   R   frame    T     P   pushbutton
*    ls_field_list-fmb1 = ''.
*    ls_field_list-fmb2 = ''.
*    ls_field_list-colr = ''.    color
*    ls_field_list-leng = ''.    textarea length
*    ls_field_list-line = ''.    row
*    ls_field_list-coln = ''.    col
*    ls_field_list-ltyp = ''.    circulated type
*    ls_field_list-lanf = ''.    circulated starting line
*    ls_field_list-lblk = ''.    circulated area
*    ls_field_list-lrep = ''.    circulated elenments
*    ls_field_list-fmky = ''.    function menu butttons
*    ls_field_list-paid = ''.    set memory id
*    ls_field_list-ucnv = ''.
*    ls_field_list-type = ''.    field type
*    ls_field_list-auth = ''.    authority no
*    ls_field_list-wnam = ''.    current button
*    ls_field_list-dmac = ''.
*    ls_field_list-grp1 = ''.
*    ls_field_list-grp2 = ''.
*    ls_field_list-grp3 = ''.
*    ls_field_list-grp4 = ''.
*    ls_field_list-ityp = ''.
*    ls_field_list-aglt = ''.
*    ls_field_list-adez = ''.
*    ls_field_list-stxt = ''.
*    ls_field_list-res1 = ''.
*    ls_field_list-res2 = ''.
*    append ls_field_list to lt_field_list.
*    clear ls_field_list.
 
    ls_field_list-fnam = 'FRAME'.
    ls_field_list-didx = '000B'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '02'.
    ls_field_list-flg3 = '80'.
    ls_field_list-fill = 'R'.
    ls_field_list-leng = '76'.
    ls_field_list-line = '01'.
    ls_field_list-coln = '02'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'S_VBELN-TEXT'.
    ls_field_list-leng = '19'.
    ls_field_list-line = '02'.
    ls_field_list-coln = '04'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = '订单号'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'TLOW'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '00'.
    ls_field_list-flg3 = '80'.
    ls_field_list-leng = '0A'.
    ls_field_list-line = '02'.
    ls_field_list-coln = '24'.
    ls_field_list-ucnv = 'ALPHA'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'S_VBELN-TXT2'.
    ls_field_list-leng = '04'.
    ls_field_list-line = '02'.
    ls_field_list-coln = '37'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'THIGH'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '00'.
    ls_field_list-flg3 = '80'.
    ls_field_list-leng = '0A'.
    ls_field_list-line = '02'.
    ls_field_list-coln = '3C'.
    ls_field_list-ucnv = 'ALPHA'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'TPUSH'.
    ls_field_list-didx = '0003'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '02'.
    ls_field_list-flg3 = '80'.
    ls_field_list-fill = 'P'.   "C checkbutton  R  frame  T     P pushbutton
    ls_field_list-leng = '03'.
    ls_field_list-line = '02'.
    ls_field_list-coln = '50'.
    ls_field_list-fmky = '&ZZZ'.
    ls_field_list-wnam = '&RICO'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-auth = '102'.
    ls_field_list-ityp = 'C'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'S_VBELN-TEXT1'.
    ls_field_list-leng = '19'.
    ls_field_list-line = '03'.
    ls_field_list-coln = '04'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = '订单类型'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
 
    ls_field_list-FNAM = 'TAB-ALLTP'.
    ls_field_list-DIDX = '000C'.
    ls_field_list-FLG1 = '80'.
    ls_field_list-FLG2 = '00'.
    ls_field_list-FLG3 = '80'.
    ls_field_list-FMB1 = '00'.
    ls_field_list-FMB2 = '08'.
    ls_field_list-LENG = '09'.
    ls_field_list-LINE = '0A'.
    ls_field_list-COLN = '0D'.
    ls_field_list-LANF = '00'.
    ls_field_list-LBLK = '00'.
    ls_field_list-LREP = '00'.
    ls_field_list-TYPE = 'CHAR'.
    ls_field_list-ITYP = 'C'.
    ls_field_list-AGLT = '00'.
    ls_field_list-ADEZ = '00'.
    ls_field_list-RES1 = 'DL K'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = '<FS>'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '00'.
    ls_field_list-flg3 = '80'.
    ls_field_list-leng = '0A'.
    ls_field_list-line = '03'.
    ls_field_list-coln = '24'.
    ls_field_list-ucnv = 'ALPHA'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'S_VBELN-TXT1'.
    ls_field_list-leng = '04'.
    ls_field_list-line = '03'.
    ls_field_list-coln = '37'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'THIGH1'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '00'.
    ls_field_list-flg3 = '80'.
    ls_field_list-leng = '0A'.
    ls_field_list-line = '03'.
    ls_field_list-coln = '3C'.
    ls_field_list-ucnv = 'ALPHA'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-ityp = 'C'.
    ls_field_list-stxt = ''.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
    ls_field_list-fnam = 'TPUSH1'.
    ls_field_list-didx = '0003'.
    ls_field_list-flg1 = '80'.
    ls_field_list-flg2 = '02'.
    ls_field_list-flg3 = '80'.
    ls_field_list-fill = 'P'.   "C checkbutton  R  frame  T     P pushbutton
    ls_field_list-leng = '03'.
    ls_field_list-line = '03'.
    ls_field_list-coln = '50'.
    ls_field_list-fmky = '&ZZZ'.
    ls_field_list-type = 'CHAR'.
    ls_field_list-auth = '102'.
    ls_field_list-ityp = 'C'.
    append ls_field_list to lt_field_list.
    clear ls_field_list.
 
endform.                    " BUILD_SCREEN_FIELDS
 
form build_flow_logic_etc .
 
 field-symbols:<fs_flow_logic> type d022s,
               <fs_flow_logic1> type d022s,
               <fs_flow_logic2> 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.                    " BUILD_FLOW_LOGIC
 
module status_0100 output.
  set pf-status '100'.
endmodule.                    "status_0100 OUTPUT
 
module exit_screen.
  set screen 0.
  leave screen.
endmodule.                    "exit_screen
 
module user_command_0100 input.
 " break-point.
 
*  loop at screen.
*    if screen-name = ''.
*    endif.
*  endloop.
 
  case sy-ucomm.
    when '&F4'.
      "perform t_low_help.
 
    when '&SAVE'.
      leave to screen 0.
    when others.
  endcase.
 
  set screen 100.
 
endmodule.                    "user_command_0100 INPUT
 
 
*module etab_pbo output.
*  read table etab into etab index imptb-current_line.
*endmodule.
*
*module etab_pai input.
*  modify etab from etab index imptb-current_line.
*endmodule.                 " etab_pail  input
 
module t_low_help.
 " break-point.
 
  data:zwerks like standard table of t001w with header line.
  clear:zwerks. refresh:zwerks.
 
  select * into corresponding fields of table zwerks from t001w.
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield        = 'WERKS'
      value_org       = 'S'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'TLOW'
    tables
      value_tab       = zwerks
    exceptions
      parameter_error = 1
      no_values_found = 2
      others          = 3.
  if sy-subrc <> 0.
    ...
  endif.
  clear:zwerks. refresh:zwerks.
 
endmodule.
 
form t_low_help.
  data:zwerks like standard table of t001w with header line.
  clear:zwerks. refresh:zwerks.
  select * into corresponding fields of table zwerks from t001w.
  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield        = 'WERKS'
      value_org       = 'S'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'TLOW'
    tables
      value_tab       = zwerks
    exceptions
      parameter_error = 1
      no_values_found = 2
      others          = 3.
  if sy-subrc <> 0.
    ...
  endif.
  clear:zwerks. refresh:zwerks.
 
endform. 
View Code

 

posted on 2018-12-24 17:53  ricoo  阅读(1682)  评论(0编辑  收藏  举报