‎2009 Feb 23 12:13 PM
HI All,
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = lv_ekpo_ebeln
TABLES
return = lt_returns
poitem = lt_items
poitemx = lt_itemxs.
In the above Function module lt_returns is internal table in this iam getting 3 error messages and coming to below function module CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
here iam getting only 1 error message .
here is the code which they have mentioned.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
CLEAR ls_ekpo_item_to_process.
LOOP AT lt_ekpo_items_to_process INTO ls_ekpo_item_to_process.
ls_ekpo_item_to_process-txz01 = c_failed_message_2.
APPEND ls_ekpo_item_to_process TO lt_processed_ekpo_items.
CLEAR ls_ekpo_item_to_process.
ENDLOOP.
ENDIF.
and i have wriiten the code as in CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
CLEAR ls_ekpo_item_to_process.
Data : w_msg type string.
Data : bapiret2 type BAPIRET2 occurs 0 with header line.
LOOP AT lt_ekpo_items_to_process INTO ls_ekpo_item_to_process.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = bapiret2-ID
LANG = '-D'
NO = bapiret2-number
V1 = bapiret2-MESSAGE_V1
V2 = bapiret2-MESSAGE_V2
V3 = bapiret2-MESSAGE_V3
V4 = bapiret2-MESSAGE_V4
IMPORTING
MSG = w_msg.
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
write : w_msg.
here it is going to dump can any one correct the syntax that where i have done the fault.
‎2009 Feb 23 2:02 PM
Simple example...
This one is setting a deletion indicator for 1 PO-number
DATA: po_num TYPE ebeln,
po_header TYPE bapimepoheader,
po_headerx TYPE bapimepoheaderx,
t_bapi_poitem TYPE bapimepoitem_tp,
t_bapi_poitemx TYPE bapimepoitemx_tp,
va_poitem TYPE bapimepoitem,
va_poitemx TYPE bapimepoitemx,
lt_return TYPE STANDARD TABLE OF bapiret2.
va_return TYPE bapiret2.
* Fill BAPI-structures
po_num = '4500376192'.
* Header
po_header-po_number = po_num.
po_header-delete_ind = 'L'.
po_header-doc_type = 'F'.
etc.
etc.
* HeaderX (the one you change)
po_headerx-po_number = po_num.
po_headerx-delete_ind = 'L'.
po_headerx-doc_type = 'F'.
* add Item(s)
va_poitem-.... = ...
va_poitem-.... = ...
APPEND va_poitem TO ta_poitem.
* add Item(X) (The one(s) U change
va_poitemx-.... = ...
va_poitemx-.... = ...
APPEND va_poitemx TO ta_poitemx.
* Call BAPI
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = po_num
poheader = po_header
poheaderx = po_headerx
TABLES
return = lt_return
poitem = ta_poitem
poitemx = ta_poitemx.
* Check errors
READ TABLE lt_return INTO va_return WITH KEY type = 'E'.
* No errors
IF sy-subrc NE 0.
* Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = va_return.
ENDIF.
Edited by: Rob Postema on Feb 23, 2009 3:03 PM
Edited by: Rob Postema on Feb 23, 2009 3:10 PM
Edited by: Rob Postema on Feb 23, 2009 3:26 PM
‎2009 Feb 23 2:08 PM
Hi,
After using 'BAPI_PO_CHANGE'
check IF sy-subrc 0. "no errors
Then Commit
'BAPI_TRANSACTION_COMMIT'
endif.
Thanks,
Krishna..
‎2009 Feb 23 4:50 PM
you are passing bapiret2 to the function module without any data! You would first need to read the proper record from bapiret2 internal table.
shahram
‎2009 Mar 10 2:45 AM
Hi Chalapathi,
Can You mention the dump please.
And As Kartik Tarla said to you in your previous post Emailid and firstname do that atleast in the weekends.
Thanks & Regards,
Dileep .C
‎2009 Mar 20 7:31 AM