Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_ALM_ORDER_MAINTAIN

Former Member
0 Kudos
792

Hi All,

IN SRM we want to create PM order components and operations from the shopping cart and for the same we wereusing a BDC program. this BDC used to call the transaction IW32 for each line item and update the PM order. Now we are thinking of using <b>BAPI_ALM_ORDER_MAINTAIN</b> for the same.

If any one has used the same please let me know the pros and cons and the feasibility for the same.

Thanks in advance,

Vithalprasad<b></b>

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
275

Hi,

REPORT  ZMK_BAPI_PROGRAM                        .
DATA : RESB.

DATA : IT_METHODS LIKE BAPI_ALM_ORDER_METHOD OCCURS 0 ,
       IT_HEADER LIKE BAPI_ALM_ORDER_HEADERS_I OCCURS 0,
       IT_HEADER_UP LIKE BAPI_ALM_ORDER_HEADERS_UP OCCURS 0 ,
       IT_RETURN LIKE  BAPIRET2 OCCURS 0 WITH HEADER LINE.

DATA : X_METHODS LIKE BAPI_ALM_ORDER_METHOD ,
       X_HEADER LIKE BAPI_ALM_ORDER_HEADERS_I,
       X_HEADER_UP LIKE BAPI_ALM_ORDER_HEADERS_UP .




**************************************************************

DATA T_METH TYPE TABLE OF BAPI_ALM_ORDER_METHOD.
**Internal table for Operation (BAPI)
DATA T_OPER TYPE TABLE OF BAPI_ALM_ORDER_OPERATION.
DATA T_COMP TYPE TABLE OF BAPI_ALM_ORDER_COMPONENT.
**Internal Table for Opertaions UP (BAPI)
DATA T_COMP_UP TYPE TABLE OF BAPI_ALM_ORDER_COMPONENT_UP.
**Internal table for BAPI Return code
DATA T_RET TYPE TABLE OF BAPIRET2.

***WORK AREA DECLARATIONS
**Work Area for Hedaer
DATA:WA_HEADER TYPE CAUFVDB,
WA_METH TYPE BAPI_ALM_ORDER_METHOD,
WA_OP TYPE AFVGB,
WA_COMP TYPE RESBB,
WA_COMP1 TYPE BAPI_ALM_ORDER_COMPONENT,
WA_COMP_UP TYPE BAPI_ALM_ORDER_COMPONENT_UP,
WA_OPER TYPE BAPI_ALM_ORDER_OPERATION.


DATA : IT_RESB TYPE RESB OCCURS 0 WITH HEADER LINE.

*PARAMETERS:TEST.
****Fill Method Internal table


*WA_METH-REFNUMBER = '000001'.
*WA_METH-OBJECTTYPE = 'HEADER'.
*WA_METH-METHOD = 'CHANGE'.
*WA_METH-OBJECTKEY(12) = '000004000180'.
**WA_METH-OBJECTKEY+12(4) = '0020'.
**WA_METH-OBJECTKEY+16(4) = '0020'.
*APPEND WA_METH TO T_METH.

DATA : WA_REFNUMBER LIKE WA_METH-REFNUMBER VALUE 1,
       WA_ITEM   LIKE EKPO-EBELP .

CLEAR WA_METH.
WA_METH-METHOD = 'SAVE'.
APPEND WA_METH TO T_METH.


SELECT * FROM RESB INTO TABLE IT_RESB
                       WHERE AUFNR = '000004000180'.

IF SY-SUBRC EQ 0.
  LOOP AT IT_RESB.
    WA_REFNUMBER = WA_REFNUMBER + 1.

    WA_METH-REFNUMBER = WA_REFNUMBER.
    WA_METH-OBJECTTYPE = 'COMPONENT'.
    WA_METH-METHOD = 'CHANGE'.
    WA_METH-OBJECTKEY(12) = '000004000180'.
*WA_METH-OBJECTKEY+12(4) = '0020'.
*WA_METH-OBJECTKEY+16(4) = '0020'.
    APPEND WA_METH TO T_METH.

    CLEAR WA_ITEM.
    CONCATENATE  IT_RESB-RSPOS+0(4) '0' INTO WA_ITEM.

    WA_COMP1-RESERV_NO = IT_RESB-RSNUM.
    WA_COMP1-RES_ITEM =  IT_RESB-RSPOS.
    WA_COMP1-ACTIVITY = '0010'.
    WA_COMP1-ITEM_NUMBER = WA_ITEM.
*wa_comp1-special_stock = 'B'.
    WA_COMP1-REQUIREMENT_QUANTITY = '1102'.
*wa_comp1-stge_loc = '0001'.
*wa_comp1-backflush = 'X'.
    APPEND WA_COMP1 TO T_COMP.


****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
    WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
    APPEND WA_COMP_UP TO T_COMP_UP.


  ENDLOOP.

ENDIF.
X_HEADER-ORDERID = '000004000180'.
APPEND X_HEADER TO IT_HEADER.





***WA_METH-REFNUMBER = '000001'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***WA_METH-REFNUMBER = '000002'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***WA_METH-REFNUMBER = '000003'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***WA_METH-REFNUMBER = '000004'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***
***WA_METH-REFNUMBER = '000005'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***
***
***X_HEADER-ORDERID = '000004000180'.
***APPEND X_HEADER TO IT_HEADER.
***
*****Component Internal table
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0002'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0020'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '12102'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0003'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0030'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '13013'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0004'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0040'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '14014'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0005'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0050'.
****wa_comp1-MATERIAL = '803'.
***WA_COMP1-REQUIREMENT_QUANTITY = '15013'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
****wa_comp_up-MATERIAL = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0006'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0060'.
****wa_comp1-MATERIAL = '803'.
***WA_COMP1-REQUIREMENT_QUANTITY = '11563'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
****wa_comp_up-MATERIAL = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.


PERFORM CALL_BAPI.

*&---------------------------------------------------------------------*
*&      Form  CALL_BAPI
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM CALL_BAPI .
  CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
  TABLES
  IT_METHODS = T_METH
  IT_HEADER = IT_HEADER
*it_header_up = it_header_up
  IT_COMPONENT = T_COMP
  IT_COMPONENT_UP = T_COMP_UP
  RETURN = T_RET.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  REFRESH: T_COMP,
           T_COMP_UP,
           T_RET.


ENDFORM.                    " CALL_BAPI

Check this code...., and also read the BAPI documentation it is explained very well...

Regards

Vijay

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos
275

Generally a Bapi is an alternative for the correspoding BDC. But the Function module documentation for this Bapi says the following

Apart from the below, i think it does every thing that the transaction does.

Notes

Using the BAPI to process the order data cannot support all the functions of the transaction. This applies in particular for the following functions:

Order header data

The object list cannot be processed.

Refurbishment orders are not supported.

The estimated costs cannot be processed - only the estimated overall costs of the order.

Notification data cannot be processed with the order BAPI. Even if the settings in Customizing are such that the orders and notifications can be maintained on one screen, no notification is created for the order.

Permits cannot be processed.

The order addresses cannot be processed.

Individual partner addresses cannot be maintained.

The settlement rule cannot be maintained.

Order functions

Printing the papers is not possible.

Locking and unlocking the order is not possible.

Accepting and rejecting quotations is not possible.

Business completion is not possible.

Flagging for deletion is not possible.

The log cannot be displayed.

User default values are not used.

The field selection is not checked.

The Customer Exits/BAdIs are not executed completely.

Joint ventures are not supported.

Funds Management is not supported.

Investment orders are not supported.

No integration of service products with task lists possible.

No integration of configurable service products possible.

Assignment of sales document items with service products in accordance with the aforementioned conditions.

Operation data

A change of the control key in the operation is not possible, if this leads to a change of the processing type (internal-/external processing)

User status change not possible.

Production resources and tools cannot be processed.

Service lines cannot be processed.

Task list integration is not supported.

Linking operations with object list is not supported.

Component data

User status change not possible.

BOM data cannot be processed.

The delivery address cannot be processed.

former_member188685
Active Contributor
0 Kudos
276

Hi,

REPORT  ZMK_BAPI_PROGRAM                        .
DATA : RESB.

DATA : IT_METHODS LIKE BAPI_ALM_ORDER_METHOD OCCURS 0 ,
       IT_HEADER LIKE BAPI_ALM_ORDER_HEADERS_I OCCURS 0,
       IT_HEADER_UP LIKE BAPI_ALM_ORDER_HEADERS_UP OCCURS 0 ,
       IT_RETURN LIKE  BAPIRET2 OCCURS 0 WITH HEADER LINE.

DATA : X_METHODS LIKE BAPI_ALM_ORDER_METHOD ,
       X_HEADER LIKE BAPI_ALM_ORDER_HEADERS_I,
       X_HEADER_UP LIKE BAPI_ALM_ORDER_HEADERS_UP .




**************************************************************

DATA T_METH TYPE TABLE OF BAPI_ALM_ORDER_METHOD.
**Internal table for Operation (BAPI)
DATA T_OPER TYPE TABLE OF BAPI_ALM_ORDER_OPERATION.
DATA T_COMP TYPE TABLE OF BAPI_ALM_ORDER_COMPONENT.
**Internal Table for Opertaions UP (BAPI)
DATA T_COMP_UP TYPE TABLE OF BAPI_ALM_ORDER_COMPONENT_UP.
**Internal table for BAPI Return code
DATA T_RET TYPE TABLE OF BAPIRET2.

***WORK AREA DECLARATIONS
**Work Area for Hedaer
DATA:WA_HEADER TYPE CAUFVDB,
WA_METH TYPE BAPI_ALM_ORDER_METHOD,
WA_OP TYPE AFVGB,
WA_COMP TYPE RESBB,
WA_COMP1 TYPE BAPI_ALM_ORDER_COMPONENT,
WA_COMP_UP TYPE BAPI_ALM_ORDER_COMPONENT_UP,
WA_OPER TYPE BAPI_ALM_ORDER_OPERATION.


DATA : IT_RESB TYPE RESB OCCURS 0 WITH HEADER LINE.

*PARAMETERS:TEST.
****Fill Method Internal table


*WA_METH-REFNUMBER = '000001'.
*WA_METH-OBJECTTYPE = 'HEADER'.
*WA_METH-METHOD = 'CHANGE'.
*WA_METH-OBJECTKEY(12) = '000004000180'.
**WA_METH-OBJECTKEY+12(4) = '0020'.
**WA_METH-OBJECTKEY+16(4) = '0020'.
*APPEND WA_METH TO T_METH.

DATA : WA_REFNUMBER LIKE WA_METH-REFNUMBER VALUE 1,
       WA_ITEM   LIKE EKPO-EBELP .

CLEAR WA_METH.
WA_METH-METHOD = 'SAVE'.
APPEND WA_METH TO T_METH.


SELECT * FROM RESB INTO TABLE IT_RESB
                       WHERE AUFNR = '000004000180'.

IF SY-SUBRC EQ 0.
  LOOP AT IT_RESB.
    WA_REFNUMBER = WA_REFNUMBER + 1.

    WA_METH-REFNUMBER = WA_REFNUMBER.
    WA_METH-OBJECTTYPE = 'COMPONENT'.
    WA_METH-METHOD = 'CHANGE'.
    WA_METH-OBJECTKEY(12) = '000004000180'.
*WA_METH-OBJECTKEY+12(4) = '0020'.
*WA_METH-OBJECTKEY+16(4) = '0020'.
    APPEND WA_METH TO T_METH.

    CLEAR WA_ITEM.
    CONCATENATE  IT_RESB-RSPOS+0(4) '0' INTO WA_ITEM.

    WA_COMP1-RESERV_NO = IT_RESB-RSNUM.
    WA_COMP1-RES_ITEM =  IT_RESB-RSPOS.
    WA_COMP1-ACTIVITY = '0010'.
    WA_COMP1-ITEM_NUMBER = WA_ITEM.
*wa_comp1-special_stock = 'B'.
    WA_COMP1-REQUIREMENT_QUANTITY = '1102'.
*wa_comp1-stge_loc = '0001'.
*wa_comp1-backflush = 'X'.
    APPEND WA_COMP1 TO T_COMP.


****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
    WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
    APPEND WA_COMP_UP TO T_COMP_UP.


  ENDLOOP.

ENDIF.
X_HEADER-ORDERID = '000004000180'.
APPEND X_HEADER TO IT_HEADER.





***WA_METH-REFNUMBER = '000001'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***WA_METH-REFNUMBER = '000002'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***WA_METH-REFNUMBER = '000003'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***WA_METH-REFNUMBER = '000004'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***
***WA_METH-REFNUMBER = '000005'.
***WA_METH-OBJECTTYPE = 'COMPONENT'.
***WA_METH-METHOD = 'CHANGE'.
***WA_METH-OBJECTKEY(12) = '000004000180'.
****WA_METH-OBJECTKEY+12(4) = '0020'.
****WA_METH-OBJECTKEY+16(4) = '0020'.
***APPEND WA_METH TO T_METH.
***
***
***
***
***X_HEADER-ORDERID = '000004000180'.
***APPEND X_HEADER TO IT_HEADER.
***
*****Component Internal table
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0002'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0020'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '12102'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0003'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0030'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '13013'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0004'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0040'.
****wa_comp1-special_stock = 'B'.
***WA_COMP1-REQUIREMENT_QUANTITY = '14014'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
***WA_COMP_UP-SPECIAL_STOCK = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0005'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0050'.
****wa_comp1-MATERIAL = '803'.
***WA_COMP1-REQUIREMENT_QUANTITY = '15013'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
****wa_comp_up-MATERIAL = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.
***
***
***WA_COMP1-RESERV_NO = '0000001461'.
***WA_COMP1-RES_ITEM = '0006'.
***WA_COMP1-ACTIVITY = '0010'.
***WA_COMP1-ITEM_NUMBER = '0060'.
****wa_comp1-MATERIAL = '803'.
***WA_COMP1-REQUIREMENT_QUANTITY = '11563'.
****wa_comp1-stge_loc = '0001'.
****wa_comp1-backflush = 'X'.
***APPEND WA_COMP1 TO T_COMP.
***
****Component Update Internal table
****wa_comp_up-MATERIAL = 'X'.
****wa_comp_up-backflush = 'X'.
***WA_COMP_UP-REQUIREMENT_QUANTITY = 'X'.
****wa_comp_up-stge_loc = 'X'.
***APPEND WA_COMP_UP TO T_COMP_UP.


PERFORM CALL_BAPI.

*&---------------------------------------------------------------------*
*&      Form  CALL_BAPI
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM CALL_BAPI .
  CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
  TABLES
  IT_METHODS = T_METH
  IT_HEADER = IT_HEADER
*it_header_up = it_header_up
  IT_COMPONENT = T_COMP
  IT_COMPONENT_UP = T_COMP_UP
  RETURN = T_RET.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

  REFRESH: T_COMP,
           T_COMP_UP,
           T_RET.


ENDFORM.                    " CALL_BAPI

Check this code...., and also read the BAPI documentation it is explained very well...

Regards

Vijay

Former Member
0 Kudos
275

Hi ,

But the bapi ¨documentation says we cannot use it for service line items . But we are creating service line items in our call to IW32.

Please suggest if there is another BAPI or FM for the same.

REgards,

Divyanshu

Former Member
0 Kudos
275

Hi All,

As stated by Divyanshu we want to update/ insert the service line items and create PR line itme for the same.

Presently we are using BDC for the same.

Please suggest another BAPI or FM.

Thanks in advance,

Vithalpraad