‎2009 Jul 12 6:58 PM
Dear All,
I have to upload and create P.O from an excel file saved locally on the system.
I want to use BAPI for it.
Can anyone help me in the procedure?
Thanks.
‎2009 Jul 12 9:16 PM
Could you be more specific where is your problem? I guess it's not with the BAPI?
Is it that you don't know how to read the excel sheet from ABAP?
‎2009 Jul 12 9:21 PM
hi rohan
try the followin FM which ever best suits ur need.
BAPI_PO_CREATE or BAPI_CREATE_FROMDATA
if futher help required do ask.
regards
venkat
‎2009 Jul 14 4:28 PM
Hi Venkat,
I used the example given below by Krupa and seeing some other examples.
I tried to use other BAPI examples but there was no ouptput shown as i am not able to pass the values and return the purchase order number..
Can you help me by telling the process??/
‎2009 Jul 13 10:36 AM
example:-
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.
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.
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.
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.
‎2009 Jul 13 6:43 PM
Dear krupa jani ,
I am uploading the details of a P.O from an Excel,do need to pass all these values?
‎2009 Jul 14 4:32 PM
Dear krupa,
When i run your example by making some changes according to requirement here,does not return me any purchase order number.
Please help
‎2009 Jul 14 4:56 PM
Hi,
First fetch the data from XL into your internal table,
pass necessay parameters into 'BAPI_PO_CREATE1'
and commit BAPI on 'Success'.
Thanks,
Krishna..
‎2009 Jul 14 5:04 PM
Hi Krishna,
Do you have any example code for that??
I have uploaded the excel to internal tale but trying to do the BAPI.
Kindly let me know any example code you have.
Thanks
Rohan