Add a new field to selection screen of S2L

How to add a pair of new fields «Planned requirement date» and «Planned requirement time» to the S2L transaction selection screen?

The steps described below cover all the configuration and code changes to add select option for SY-DATUM and SY-UZEIT on selection screen of S2L transaction under all the fields. The same steps can be used to add any other applicable field on any of S2L forks.

S2L transaction and all of its forks internally call program RS2L_SELSCREEN_ENTRY.

In our case we won’t copy the whole program but only rename and modify top include report IS2L_SELSCREEN_ENTRYTOP.
Definition of selection-screen inside it (include file is2l_selscreen_entrysel) will be also renamed and modified.
The third modification(+rename) is include IS2L_SELSCREEN_ENTRYPAI, so finally we have inside our new program ‘YS2LOrd’ only 3 forked files, keeping all the mechanism of standard S2L working as usual. This way also allows keep sure that already S2L-integrated enhancements, userexits, BAdI’s and etc won’t be missed. Vice versa — all the new additions to standard S2L will immediately appears in our fork ‘YS2LORD’:

Adding date and time fields to YIS2L_SELSCREEN_ENTRYSEL:

selection-screen begin of block yblock with frame title text-029.
 
selection-screen begin of line.
selection-screen position 15.
parameters: reqdate type sy-datum.
selection-screen comment 1(10) text-021 for field reqdate.
 
selection-screen position 43.
parameters: reqtime type sy-uzeit.
selection-screen comment 30(10) text-022 for field reqtime.
selection-screen end of line.
 
selection-screen end of block yblock.
 
selection-screen end of block main.

To proccess only own session, we added the next code to YIS2L_SELSCREEN_ENTRYPAI:

MODULE process_1001 INPUT.
 
  data: opcode_SID type x value 68,
        SID(32) type c,
        gv_uniq(33) type c,
        id_len type i.
 
    call 'ThUsrInfo' id 'OPCODE' field opcode_SID
            id 'SESSION_ID' field SID
            id 'ID_LEN' field id_len.
    gv_uniq = SID && sy-modno.
    export reqdate to memory id gv_uniq.
 
    gv_uniq = SID && 'R'.
    export reqtime to memory id gv_uniq.
 
  ta_mode = s2l_selfields-ta_mode.
 
ENDMODULE.

The date and time, entered in our new fileds will be updated as an enhancement in the beginning of FM JITOUT08_CREATE_JITCALL:

ENHANCEMENT 1  YS2L_BEDARFSDATUM.    "active version
***** Geplantes Bedarfsdatum
if sy-cprog eq 'YS2LORD'.
  data: opcode_SID type x value 68,
        SID(32) type c,
        gv_uniq(33) type c,
        id_len type i,
        lv_timestamp type tzntstmps,
        lv_reqtime type sy-uzeit,
        lv_reqdate type sy-datum,
        lt_jito type jitodiaco_tt,
        wa_jito like line of lt_jito.
 
  call 'ThUsrInfo' id 'OPCODE' field opcode_SID
        id 'SESSION_ID' field SID
        id 'ID_LEN' field id_len.
  gv_uniq = SID && sy-modno.
  import reqdate to lv_reqdate from memory id gv_uniq.
 
  if lv_reqdate <> '00000000'.
    gv_uniq = SID && 'R'.
    import reqtime to lv_reqtime from memory id gv_uniq.
 
    call function 'CONVERT_INTO_TIMESTAMP'
      exporting
        i_datlo     = lv_reqdate
        i_timlo     = lv_reqtime
        i_tzone     = sy-zonlo
      importing
        e_timestamp = lv_timestamp.
 
    loop at jitodiaco_ct into wa_jito.
      wa_jito-rdate = lv_timestamp.
      modify jitodiaco_ct from wa_jito transporting rdate.
    endloop.
  endif.
 
endif. " sy-cprog
ENDENHANCEMENT.

Добавить комментарий



All fields are required. Your email address will not be published.