Skip to Content
Author's profile photo Former Member

Extending BAPI Function Module ‘BAPI_ALM_ORDER_MAINTAIN’

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.

8-9-2012 6-21-51 PM.png

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

8-9-2012 6-24-06 PM.png

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.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Madhu Vadlamani
      Madhu Vadlamani

      Good.Can you explain where you placed these custom fields in the transaction.

      Regards,

      Madhu.

      Author's profile photo Vamsi Krishna C V
      Vamsi Krishna C V

      Hi Madhu, we need to follow the steps outlined in the below note

      669370 - BAPI_ALM_ORDER_MAINTAIN: BAdI not for append structures

      Author's profile photo Former Member
      Former Member

      It's work!!! Thank you. 😎

      Author's profile photo Former Member
      Former Member

      Hi Lakshmi,

      This document is really helpful.

      Thankyou for sharing.

      Gaurav

      Author's profile photo Former Member
      Former Member

      Very helpful. Thanks for posting.

      Paul

      Author's profile photo Former Member
      Former Member

      Lakshmi,

      Thanks for sharing this document. It's really helpful.

      Regards,

      Satbir