‎2008 Mar 01 12:34 PM
Hi Sap Gurus,
I need to upload the ME21N using BAPI.
If i test the BAPI function module independently it is creating the PO.
but when i pass the data using porg. shown below it is going for dump saying like this..
*"Type conflict when calling a function module (field length)."
The call to the function module "BAPI_PO_CREATE1" is incorrect In the function module interface, you can specify only
fields of a specific type and length under "POHEADER".
Although the currently specified field
"I_POHEADER" is the correct type, its length is incorrect.*
report /scl/rummpurr_me21n1.
data:i_poheader type standard table of bapimepoheader,
i_poheaderx type standard table of bapimepoheaderx,
i_poitem type standard table of bapimepoitem,
i_poitemx type standard table of bapimepoitemx,
i_poschedule type standard table of bapimeposchedule,
i_poschedulex type standard table of bapimeposchedulx,
i_return type standard table of bapiret2.
*
*
data : wa_poheader type bapimepoheader,
wa_poheaderx type bapimepoheaderx,
wa_poitem type bapimepoitem,
wa_poitemx type bapimepoitemx,
wa_poschedule type bapimeposchedule,
wa_poschedulex type bapimeposchedulx,
wa_return type bapiret2.
wa_poheader-comp_code = 'Z010'.
wa_poheader-doc_type = 'NB'.
wa_poheader-creat_date = sy-datum.
wa_poheader-vendor = '0000000014'.
wa_poheader-purch_org = 'Z100'.
wa_poheader-pur_group = '110'.
append wa_poheader to i_poheader.
wa_poheaderx-comp_code = 'X'.
wa_poheaderx-doc_type = 'X'.
wa_poheaderx-creat_date = 'X'.
wa_poheaderx-vendor = 'X'.
wa_poheaderx-purch_org = 'X'.
wa_poheaderx-pur_group = 'X'.
append wa_poheaderx to i_poheaderx.
wa_poitem-po_item = '0010'."wa_item-po_item.
wa_poitem-material = '000000000010000029'.
wa_poitem-plant = 'Z100'.
wa_poitem-stge_loc = '002'.
wa_poitem-quantity = '10'.
wa_poitem-net_price = '20'.
wa_poitem-tax_code = 'P0'.
append wa_poitem to i_poitem.
*
wa_poitemx-po_item = '0010'.
wa_poitemx-material = 'X'.
wa_poitemx-plant = 'X'.
wa_poitemx-stge_loc = 'X'.
wa_poitemx-quantity = 'X'.
wa_poitemx-net_price = 'X'.
wa_poitemx-tax_code = 'X'.
append wa_poitemx to i_poitemx.
wa_poschedule-po_item = '0010'.
wa_poschedule-delivery_date = '20081231'.
append wa_poschedule to i_poschedule.
wa_poschedulex-po_item = '0010'.
wa_poschedulex-delivery_date = 'X'.
append wa_poschedulex to i_poschedulex.
call function 'BAPI_PO_CREATE1'
exporting
poheader = i_poheader
poheaderx = i_poheaderx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
tables
return = i_return
poitem = i_poitem
poitemx = i_poitemx
POADDRDELIVERY =
poschedule = i_poschedule
poschedulex = i_poschedulex
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
.
loop at i_return into wa_return.
write:/ wa_return-message,wa_return-type.
endloop.
Please correct this Prog. and send the answer ASAP.
.......points is sure for relavent answer......
Thanks in Advance,
Anil.
‎2008 Mar 01 12:56 PM
Hi,
Here I_POHEADER is an internal table. Please try to pass work area wa_poheader instead of i_poheader. Same thing applies for i_poheaderx. Here pass wa_poheaderx.
Check this. It will work.
Thanks,
Vinod.
‎2008 Mar 01 12:44 PM
poheader is an export parameter (as -x), not a table, and your program send a whole table. You have to loop at your table of po order header and call the BAPI for each po order.
call function 'DIALOG_SET_NO_DIALOG'.
...
loop at header_table.
...
call function 'BAPI_PO_CREATE1'
...
call function 'BAPI_TRANSACTION_COMMIT'
...
endloop.
....Regards
‎2008 Mar 01 12:56 PM
Hi,
Here I_POHEADER is an internal table. Please try to pass work area wa_poheader instead of i_poheader. Same thing applies for i_poheaderx. Here pass wa_poheaderx.
Check this. It will work.
Thanks,
Vinod.
‎2008 Mar 01 1:13 PM
Hi Vijay,
Thanks a lot for your valuable answer, now it is worikng fine....
Anil.