Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document helps how to extend the BAPI function module 'BAPI_ALM_ORDER_MAINTAIN' for Z fields.

In order to extend the BAPI, we should have EXTENSION_IN table which is type of BAPIPAREX.

Please follow the below steps to extend the BAPI.

1. In AUFK table, we have custom include with name 'CI_AUFK'. So add the Z field ZZLEG_PM_ORD in structure CI_AUFK and activate it. Now we have a custom field ZZLEG_PM_ORD in standard table AUFK.

2. Create a append structure with the Z field ZZLEG_PM_ORD which should be type of BAPIUPDATE and append to the BAPI structure ‘IBAPI_CAUFVD_UPDATE’.

3. Now we should implement the BADI 'IBAPI_ALM_ORD_MODIFY' to push the custom field ZZLEG_PM_ORD value to table AUFK. Use the method IF_EX_IBAPI_ALM_ORD_MODIFY~MODIFY_INPUT_DATA to pass the Z field ZZLEG_PM_ORD value from EXTENSION_IN table to Order header data.

Please use the below logic for updating order header data.

Read the table CT_HEADER_INT into LS_HEADER_INT index 1. Pass the value from EXTENSION_IN-VALUEPART1+0(12) to LS_HEADER_INT-ZZLEG_PM_ORD and modify the table CT_HEADER_INT.

4. Once we have completed the above steps, while calling the BAPI function module 'BAPI_ALM_ORDER_MAINTAIN', we should populate the EXTENSION_IN table and pass to BAPI as below.

   The EXTENSION_IN structure has two fields with name STRUCTURE and VALUEPART1. So pass the STRUCTURE name as

   'BAPI_TE_AUFK' and VALUEPART1 should be the custom field value.

    

   Now pass the LT_EXTENSION_IN to the BAPI function module.

    CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
    TABLES
      IT_METHODS         = PT_METHOD_BAPI
      IT_HEADER            = PT_HEADER_BAPI
      IT_HEADER_UP      = LT_HEADER_BAPIX
      IT_OPERATION      = PT_OPERATION_BAPI
      IT_COMPONENT    = PT_COMPONENT_BAPI
      IT_TEXT                 = PT_TEXT_BAPI
      IT_TEXT_LINES      = PT_TEXT_LINES_BAPI
      RETURN                = PT_RETURN
      EXTENSION_IN      = P_LT_EXTENSION_IN
      ET_NUMBERS      = LT_ORD_NUM.

6 Comments