2009 Mar 24 1:15 PM
Hi All,
I am calling the BAPI BAPI_PO_CHANGE to change/add PO item confirmation in a report.
When i check it in debug mode, its returing 'No data changed'. I am passing PO number and item details to BAPI. Below is the code which i had used to change PO Item confirmation.
loop at ekes.
GS_POCONFIRMATION-PO_ITEM = ekes-ebelp.
GS_POCONFIRMATION-CONF_TYPE = ekes-ebtyp.
GS_POCONFIRMATION-DELIV_DATE = ekes-eindt.
GS_POCONFIRMATION-QUANTITY = ekes-menge.
GS_POCONFIRMATION-EXT_DOC_LONG = ekes-xblnr.
append GS_POCONFIRMATION to gt_POCONFIRMATION.
endloop.
*Update the PO
read table ekes index 1.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = ekes-ebeln
TABLES
RETURN = gt_poreturn
POCONFIRMATION = gt_poconfirmation.
Check the result
LOOP AT gt_poreturn INTO gs_poreturn.
IF gs_poreturn-type = 'E' OR gs_poreturn-type = 'A'.
ls_last_err = gs_poreturn.
ENDIF.
ENDLOOP.
IF ls_last_err IS INITIAL.
Commit if successful
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ELSE.
Raise exception if BAPI returned error
MESSAGE ID ls_last_err-id
TYPE ls_last_err-type
NUMBER ls_last_err-number
WITH ls_last_err-message_v1
ls_last_err-message_v2
ls_last_err-message_v3
ls_last_err-message_v4
RAISING error_occured.
ENDIF.
Can any suggest me what went wrong here. It will be very much helpfull if someone can identify what went wrong in the above code.
Thanks and Regards
Raghu
2009 Mar 24 1:52 PM
Hi Bas..
Could you please tell from where the data is coming into ekes internal table..
Might be that you are reading data from ekes table which is the confirmations table and trying to update the same PO.
Best Regards,
Pradeep.
2009 Mar 25 4:56 AM
Hi Pradeep,
Thanks for your answer.
We are filling the internal table EKES from Shipping notification Idoc(Message type DESADV).
We not not filling EKES internal table from EKES database table.
Thanks and Regards
Raghu
2009 Mar 25 5:34 AM
Hi..
Why don't you try this out.. May be the problem is b'cas you are not sending the item data as confirmation data is at item level.
i_poitem-poitem = '00010'.
Append i_poitem.
i_poitemx-PO_ITEM = '00010'.
i_poitemx-PO_ITEMX = '00010'.
APPEND i_poitemx.
Populate confirmation data.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = ekes-ebeln
TABLES
RETURN = gt_poreturn
POITEM = i_poitem
POITEMX = i_poitemx
POCONFIRMATION = gt_poconfirmation.
Please check if this sloves the issue.
Best Regards,
Pradeep.
2009 Mar 25 6:22 AM
Hi Pradeep,
Thanks for quick response.
I tried the option which you have suggested, but no result.
Thanks and Regards
Raghu
2009 Mar 31 6:32 AM
Hi Pradeep,
BAPI BAPI_PO_CHANGE doea't support for updating confirmation details in Purchase order.
You can refer OSS message 0000304243 for more details.
This is just for your information.
Thanks and Regards
2009 Mar 24 2:01 PM
Have you updated the corresponding fields in 'X' tables. There are some X structure and table for each and every data table. check all the corresponding fields. Check the documentation from SE37.
Kuntal
2009 Mar 25 5:01 AM
Hi Kuntal,
Thanks for your answer.
Yes, i am also thinking abou the 'X' fileds, but the 'X' fields needs to be filled to initialize the fields when those fields are getting from interfaces right? Any how i will check the documentation for further assistance on it.
Thanks and Regards
Raghu
2009 Mar 25 5:15 AM
Yes, as mentioned above, u hv to populate with 'X' explicitly.
thanq
2009 Mar 25 6:20 AM
Hi Kuntal,
Thanks for your quick reply.
I have tried by populating 'X' fields/Internal tables, but no luck.
Thanks and Regards
Raghu.
2010 Aug 26 11:52 PM
Hi,
Is there any standard function module to convert date format from dd.mm.yyyy to sy-datum format?
Thanks and Regards
Raghu
2010 Aug 27 2:05 AM
2009 Mar 24 2:28 PM
see CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' u can do like that
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = T_POHEADER-PO
POHEADER = T_BAPI_POHEADER
POHEADERX = T_BAPI_POHEADERX
TABLES
RETURN = T_BAPIRETURN
POITEM = T_BAPI_POITEM
POITEMX = T_BAPI_POITEMX.
READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x.
ENDIF.
or
also refer then following link
http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
2009 Mar 31 6:48 AM
see following exampl
REPORT ZPURCHASEORDER.
data:
header like BAPIMEPOHEADER,
headerx like BAPIMEPOHEADERX,
it_item like standard table of BAPIMEPOITEM,
it_itemx like standard table of BAPIMEPOITEMX,
return like standard table of BAPIRET2,
wa_item like BAPIMEPOITEM,
wa_itemx like BAPIMEPOITEMX,
p_int type i,
p_matnr like mara-matnr,
p_pono like ekko-ebeln.
DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.
constants:
c_x type c value 'X'.
header-comp_code = '3000'.
header-doc_type = 'DP25'.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = 'ARAMI-00'.
header-langu = sy-langu.
header-pmnttrms = '0001'.
header-purch_org = '3000'.
header-pur_group = '010'.
header-currency = 'USD'.
headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.
*LOOP AT it_final2 INTO wa_final2.
p_int = p_int + 10.
wa_item-po_item = p_int.
p_matnr = 'T-SRM01'.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
*IF sy-subrc = 0.
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
wa_item-material = p_matnr.
wa_item-plant = '3200'.
wa_item-quantity = 100.
wa_item-conf_ctrl = 'Z01'.
wa_item-ACKN_REQD = 'X'.
WA_ITEM-ERS = ''.
APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-stge_loc = c_x .
wa_itemx-quantity = c_x .
wa_itemx-item_cat = c_x .
wa_itemx-acctasscat = c_x .
wa_itemx-conf_ctrl = 'X'.
wa_itemx-ACKN_REQD = 'X'.
WA_ITEMX-ERS = 'X'.
APPEND wa_itemx TO it_itemx.
*ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.
write:/ p_pono.