Add Custom Tab to VL02N, VL03N

LE_SHP_TAB_CUST_HEAD Badi should be used to add custom tab to VL02N VL03N. Lets see the steps to add custom tab one by one.

  1. Append your structure to LIKP table.
  2. With se18 t-code, if doesn’t exist you should create an enhancement implementation. I have already created one and i can see with display option. Double click on implementation name.
  3. Create  a function group and define the variables in its TOP include(LZXXTOP) . 
    TABLES : zzsdappend_likp."(You can also define the components of structure one by one globally)
  4. We will a need a screen to enter/read the zfield data  in delivery. Create a screen under function group. Define it as subscreen.
  5. The “ACTIVATE_TAB_PAGE” method of class should be used to call the screen. Here is the code we should write in it.
    IF sy-tcode  =  'VL01N' OR
           sy-tcode  =  'VL02N' OR
           sy-tcode  =  'VL03N'.
    
          ef_caption     = text-002.
          ef_program     = 'SAPLZXXX'.” Function group’s master program name 
          ef_position    = 13.   “ tab position in screen 
          ef_dynpro      = '9100'.” Screen number 
          cs_v50agl_cust = 'X'.
    
    ENDIF.  
    
  6. Create 2 function modules to get/set data in delivery. To set data create “zxx_get_data_deliv_header”. Set IS_LIKP as import parameter for function group and write the code in source code tab.
    MOVE-CORRESPONDING is_likp to zzsdappend_likp.

     

  7. In the same way create another function group to get data named “zxx_set_data_deliv_header”. Set ES_LIKP as export parameter for function group and write the code in source code tab.
    MOVE-CORRESPONDING zzsdappend_likp TO es_likp.

     

  8. Function modules are ready now and we should use them to set/get data. “TRANSFER_DATA_FROM_SUBSCREEN” method should be used to call ZXXX_GET_DATA_DELIV_HEADER fm and thats it.
    CALL FUNCTION 'ZXXX_GET_DATA_DELIV_HEADER'
          EXPORTING
            is_likp = is_likp.
    

    And “TRANSFER_DATA_TO_SUBSCREEN” method should be used to transfer data subscreen to database.

    CALL FUNCTION 'ZXXX_SET_DATA_DELIV_HEADER'
          IMPORTING
            es_likp = cs_likp.
    

     

  9. Final step design the screen. Go to layout of screen you have already created. Click to red button to call the components we have already declared in TOP include.

    Select the components that you want to display in custom tab. Put the labels…

    Activate the screen and return “Flow Logic” of screen.  Delete the remark for pbo. Double click and create it.  Write the code below too arrange change mode of fields accourdingly change/display mode.

 

*&---------------------------------------------------------------------*
*&      Module  STATUS_9100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_9100 OUTPUT.
  DATA: lv_char(30) VALUE '(SAPMV50A)T180-TRTYP'.
* Keeps the value of change/display mode.
* A:change mode is on, V:display mode is on 
  FIELD-SYMBOLS: <lv_ch_mod>.

  ASSIGN (lv_char) to  <lv_ch_mod>.

  LOOP AT SCREEN.
    IF <lv_ch_mod> IS ASSIGNED and <lv_ch_mod> ne 'A'.
      screen-input = 1.
    ELSE.
      screen-input = 0.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

  UNASSIGN <lv_ch_mod>.

ENDMODULE.

 

ABOUT Ekrem Güngörmez

https://tr.linkedin.com/in/ekremgungormez

RELATED POSTS

COMMENTS

comments powered by Disqus