ABAP delivery order screen enhancement

Requirement Description:

Add a custom field tab in the header and line items of inward / outward delivery documents, as shown in the following figure

 

Implementation method:

1. Add custom fields to the LIKP and LIPS tables

 2. New function group ZFG_SD002, define the enhancer screen to enhance the use

2.1 delivery order header enhancer sub screen 9100

MODULE STATUS_9100 sets whether it can be input. The judgment logic is as follows:

① SAP configures whether the interface can be edited in T180 according to Tcode, so it obtains the value of variable (SAPMV50A)T180-TRTYP, where A is display and the rest are editing

② The delivery order that has been shipped and posted is only displayed, and the judgment condition is LIKP-WBSTK = 'C'

MODULE STATUS_9100 OUTPUT.
  FIELD-SYMBOLS <FS_ANY>.

  ASSIGN ('(SAPMV50A)T180-TRTYP') TO <FS_ANY>.
  IF <FS_ANY> IS ASSIGNED.
    LOOP AT SCREEN.
      IF <FS_ANY> = 'A'.
        SCREEN-INPUT = '0'.
      ELSE.
        IF GS_LIKP-WBSTK = 'C'.
          IF SCREEN-GROUP1 = 'G1'.
            SCREEN-INPUT = '1'.
          ELSE.
            SCREEN-INPUT = '0'.
          ENDIF.
        ELSE.
          SCREEN-INPUT = '1'.
        ENDIF.
      ENDIF.

      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

ENDMODULE.

2.2 delivery line item enhancement sub screen 9200

MODULE TEXTEDIT_9200 defines a text box to splice and display self built table data in the text box. This function will open another blog. Please look forward to it

MODULE STATUS_ The 9200 is the same as the head up screen to set whether it can be entered

MODULE STATUS_9200 OUTPUT.
  LOOP AT SCREEN.
    IF GS_LIPS-WBSTA = 'C'.
      SCREEN-INPUT = '0'.

      IF GC_EDITOR IS NOT INITIAL.
        GC_EDITOR->SET_READONLY_MODE( 1 ).
      ENDIF.
    ELSE.
      ASSIGN ('(SAPMV50A)T180-TRTYP') TO <FS_ANY>.
      IF <FS_ANY> IS ASSIGNED.
        IF <FS_ANY> = 'A'.
          SCREEN-INPUT = '0'.

          IF GC_EDITOR IS NOT INITIAL.
            GC_EDITOR->SET_READONLY_MODE( 1 ).
          ENDIF.
        ELSE.
          SCREEN-INPUT = '1'.

          IF GC_EDITOR IS NOT INITIAL.
            GC_EDITOR->SET_READONLY_MODE( 0 ).
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.

ENDMODULE.

3. In the above function group ZFG_SD002, create screen and data interaction functions to enhance use

3.1 new function ZSD_ SHP_ HEAD_ FROM_ Subcreen, to return the data from the header screen of the delivery order

3.2 new function ZSD_ SHP_ HEAD_ TO_ Subcreen to transfer the header data of the delivery note to the screen

3.3. Create a new function ZSD_ SHP_ ITEM_ FROM_ Substreen, return the data from the delivery line item screen

3.4 new function ZSD_ SHP_ ITEM_ TO_ Subcreen to transfer the delivery line item data to the screen

 4. Delivery order header screen enhancement BADI: LE_SHP_TAB_CUST_HEAD

4.1 modify method ACTIVATE_TAB_PAGE Add Tab

  METHOD IF_EX_LE_SHP_TAB_CUST_HEAD~ACTIVATE_TAB_PAGE.
    EF_CAPTION     = 'Custom field'(001).
    EF_POSITION    = 20.
    EF_PROGRAM     = 'SAPLZFG_SD002'.
    EF_DYNPRO      = '9100'.
    CS_V50AGL_CUST = 'X'.

  ENDMETHOD.

Where EF_PROGRAM is the name of the function group, EF_DYNPRO is the screen number

4.2 modification method transfer_ DATA_ TO_ Substreen, call function ZSD_ SHP_ HEAD_ TO_ Subcreen to transfer the header data of the delivery note to the screen

  METHOD IF_EX_LE_SHP_TAB_CUST_HEAD~TRANSFER_DATA_TO_SUBSCREEN.
    CALL FUNCTION 'ZSD_SHP_HEAD_TO_SUBSCREEN'
      EXPORTING
        IS_LIKP = IS_LIKP.

  ENDMETHOD.

4.3 modification method transfer_ DATA_ FROM_ Substreen, call function ZSD_ SHP_ HEAD_ FROM_ Subcreen, to return the data from the header screen of the delivery order

  METHOD IF_EX_LE_SHP_TAB_CUST_HEAD~TRANSFER_DATA_FROM_SUBSCREEN.
    CALL FUNCTION 'ZSD_SHP_HEAD_FROM_SUBSCREEN'
      IMPORTING
        ES_LIKP = CS_LIKP.

  ENDMETHOD.

5. Delivery line item screen enhancement BADI: LE_SHP_TAB_CUST_ITEM

S/4 shows that the BADI has been migrated to the enhancement point LE_SHP_TAB_CUST_ITEM, so the enhancement point needs to be enhanced in this case

5.1 modify method ACTIVATE_TAB_PAGE Add Tab

  METHOD IF_EX_LE_SHP_TAB_CUST_ITEM~ACTIVATE_TAB_PAGE.
    EF_CAPTION     = 'Custom field'(001).
    EF_POSITION    = 20.
    EF_PROGRAM     = 'SAPLZFG_SD002'.
    EF_DYNPRO      = '9200'.
    CS_V50AGL_CUST = 'X'.

  ENDMETHOD.

Where EF_PROGRAM is the name of the function group, EF_DYNPRO is the screen number

5.2 modification method transfer_ DATA_ TO_ Substreen, call function ZSD_ SHP_ ITEM_ TO_ Subcreen to transfer the delivery line item data to the screen

  METHOD IF_EX_LE_SHP_TAB_CUST_ITEM~TRANSFER_DATA_TO_SUBSCREEN.
    CALL FUNCTION 'ZSD_SHP_ITEM_TO_SUBSCREEN'
      EXPORTING
        IS_LIPS = IS_LIPS.

  ENDMETHOD.

5.3 modification method transfer_ DATA_ FROM_ Substreen, call function ZSD_ SHP_ ITEM_ FROM_ Substreen, return the data from the delivery line item screen

  METHOD IF_EX_LE_SHP_TAB_CUST_ITEM~TRANSFER_DATA_FROM_SUBSCREEN.
    CALL FUNCTION 'ZSD_SHP_ITEM_FROM_SUBSCREEN'
      IMPORTING
        ES_LIPS = CS_LIPS.

  ENDMETHOD.

Keywords: sap abap

Added by steves on Wed, 22 Dec 2021 19:47:12 +0200