2010 Aug 22 3:43 AM
Hi all,
I have some problem with BAPI_PO_CREATE1,reference PR(service) create PO.
Any one has an example of it?
Thanks
sam_bingxing
Edited by: sam_bingxing on Aug 22, 2010 10:44 AM
2010 Aug 22 7:49 PM
l_wa_pohead-comp_code = l_co_cd.
l_wa_pohead-doc_type = l_doc_typ.
l_wa_pohead-purch_org = l_pur_org.
concatenate 'V' wa_ret_order-zzissu_plant into l_wa_pohead-vendor.
l_wa_pohead-pur_group = '999'.
l_wa_pohead-currency = l_waers.
l_wa_pohead-doc_date = sy-datum.
l_wa_pohead-ref_1 = wa_ret_order-zzreturn_dispo.
l_wa_pohead-our_ref = wa_ret_order-zzsub_ret_ord.
l_wa_pohead-suppl_plnt = wa_ret_order-zzissu_plant. "'1090'
l_wa_poheadx-comp_code = c_check.
l_wa_poheadx-ref_1 = c_check.
l_wa_poheadx-our_ref = c_check.
l_wa_poitem-po_item = '00010'.
l_wa_poitem-material = wa_ret_order-zzmat_no.
l_wa_poitem-plant = wa_ret_order-zzdest_plant.
l_wa_poitem-stge_loc = wa_ret_order-zzdest_strg_loc = '0500'.
l_wa_poitem-suppl_stloc = wa_ret_order-zzissu_strg_loc.
l_wa_poitem-qual_insp = stk_type.
l_wa_poitem-matl_group = '01'.
l_wa_poitem-quantity = wa_ret_order-zzqty_entered.
l_wa_poitem-po_unit = l_meins.
l_wa_poitem-orderpr_un = l_meins.
l_wa_poitem-gr_ind = c_check.
l_wa_poitem-ir_ind = c_check.
append l_wa_poitem to l_i_poitem.
l_wa_poitemx-po_item = '00010'.
l_wa_poitemx-over_dlv_tol = c_check.
append l_wa_poitemx to l_i_poitemx.
l_wa_poschedule-quantity = wa_ret_order-zzqty_entered.
append l_wa_poschedule to l_i_poschedule.
l_wa_poschedulex-po_item = '00010'.
l_wa_poschedulex-sched_line = '0001'.
l_wa_poschedulex-po_itemx = c_check.
append l_wa_poschedulex to l_i_poschedulex.
call function 'BAPI_PO_CREATE1'
exporting
poheader = l_wa_pohead
poheaderx = l_wa_poheadx
importing
exppurchaseorder = l_po_num
expheader = l_wa_expheader
tables
return = l_i_return
poitem = l_i_poitem
poitemx = l_i_poitemx
poschedule = l_i_poschedule
poschedulex = l_i_poschedulex.
if l_po_num is not initial.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = c_check.
endif.
Edited by: Subhankar Garani on Aug 22, 2010 8:53 PM
HI there,
Try to post the PO manual without using any BAPI in ME22N.
U will hit and error for the account assignment.
Later go and meet your MM consultant.
Ask him to give the correct account no.
Later try to post again.if successful than use back the BAPI...
2010 Aug 22 7:49 PM
l_wa_pohead-comp_code = l_co_cd.
l_wa_pohead-doc_type = l_doc_typ.
l_wa_pohead-purch_org = l_pur_org.
concatenate 'V' wa_ret_order-zzissu_plant into l_wa_pohead-vendor.
l_wa_pohead-pur_group = '999'.
l_wa_pohead-currency = l_waers.
l_wa_pohead-doc_date = sy-datum.
l_wa_pohead-ref_1 = wa_ret_order-zzreturn_dispo.
l_wa_pohead-our_ref = wa_ret_order-zzsub_ret_ord.
l_wa_pohead-suppl_plnt = wa_ret_order-zzissu_plant. "'1090'
l_wa_poheadx-comp_code = c_check.
l_wa_poheadx-ref_1 = c_check.
l_wa_poheadx-our_ref = c_check.
l_wa_poitem-po_item = '00010'.
l_wa_poitem-material = wa_ret_order-zzmat_no.
l_wa_poitem-plant = wa_ret_order-zzdest_plant.
l_wa_poitem-stge_loc = wa_ret_order-zzdest_strg_loc = '0500'.
l_wa_poitem-suppl_stloc = wa_ret_order-zzissu_strg_loc.
l_wa_poitem-qual_insp = stk_type.
l_wa_poitem-matl_group = '01'.
l_wa_poitem-quantity = wa_ret_order-zzqty_entered.
l_wa_poitem-po_unit = l_meins.
l_wa_poitem-orderpr_un = l_meins.
l_wa_poitem-gr_ind = c_check.
l_wa_poitem-ir_ind = c_check.
append l_wa_poitem to l_i_poitem.
l_wa_poitemx-po_item = '00010'.
l_wa_poitemx-over_dlv_tol = c_check.
append l_wa_poitemx to l_i_poitemx.
l_wa_poschedule-quantity = wa_ret_order-zzqty_entered.
append l_wa_poschedule to l_i_poschedule.
l_wa_poschedulex-po_item = '00010'.
l_wa_poschedulex-sched_line = '0001'.
l_wa_poschedulex-po_itemx = c_check.
append l_wa_poschedulex to l_i_poschedulex.
call function 'BAPI_PO_CREATE1'
exporting
poheader = l_wa_pohead
poheaderx = l_wa_poheadx
importing
exppurchaseorder = l_po_num
expheader = l_wa_expheader
tables
return = l_i_return
poitem = l_i_poitem
poitemx = l_i_poitemx
poschedule = l_i_poschedule
poschedulex = l_i_poschedulex.
if l_po_num is not initial.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = c_check.
endif.
Edited by: Subhankar Garani on Aug 22, 2010 8:53 PM
2010 Aug 23 3:41 AM
Thanks,but my goal is creating po by service purchase req. the below is my test data.
erros SE 518 occus ,plz friends help me. thanks
Line: -
Carga datos de Cabecera del pedido de Compra
CLEAR w_poheader.
w_poheader-doc_type = 'NB'.
w_poheader-vendor = '0040192130'. "P_LIFNR.
w_poheader-langu = 'ZH'.
w_poheader-purch_org = 'JLPM'. "'101'.
w_poheader-pur_group = 'JLE'. "'043'.
w_poheader-currency = 'RMB'.
w_poheader-comp_code = '1710'. "P_BUKRS.
w_poheader-doc_date = SY-DATUM. "doc_date.
Marca los campos para que se tomen.
CLEAR w_poheaderx.
w_poheaderx-doc_type = 'X'.
w_poheaderx-vendor = 'X'.
w_poheaderx-purch_org = 'X'.
w_poheaderx-pur_group = 'X'.
w_poheaderx-currency = 'X'.
w_poheaderx-comp_code = 'X'.
w_poheaderx-doc_date = 'X'.
*Posiciones de pedido
po_item-po_item = '00010'.
po_item-short_text = 'TEST FOR CREATE PO'.
po_item-acctasscat = '9'.
po_item-item_cat = 'F'.
po_item-po_unit = 'AU'.
po_item-matl_group = '90'. "'90 IS SERVICE.
po_item-plant = 'JL00'. "'0690'.
po_item-quantity = '1' .
po_item-NET_PRICE = '1100.01' .
po_item-conv_num1 = '1'.
po_item-conv_den1 = '1'.
po_item-price_unit = '1'.
po_item-prnt_price = 'X'.
po_item-unlimited_dlv = 'X'.
po_item-preq_no = '0010000204'.
po_item-preq_item = '00010'.
*po_item-gr_ind = 'X' .
po_item-ir_ind = 'X' .
po_item-gr_basediv = 'X'.
po_item-pckg_no = '1980'.
*po_item-preq_name = sy-uname.
APPEND po_item. CLEAR po_item.
*Flags de Posiciones de pedido
po_itemx-po_item = '00010'.
po_itemx-po_itemx = 'X'.
po_itemx-short_text = 'X'.
po_itemx-acctasscat = 'X'.
po_itemx-item_cat = 'X'.
po_itemX-po_unit = 'X'.
po_itemx-matl_group = 'X'.
po_itemx-plant = 'X'.
po_itemx-quantity = 'X' .
po_itemx-NET_PRICE = 'X' .
po_itemx-conv_num1 = 'X'.
po_itemx-conv_den1 = 'X'.
po_itemx-price_unit = 'X'.
po_itemx-prnt_price = 'X'.
po_itemx-unlimited_dlv = 'X'.
po_itemx-preq_no = 'X'.
po_itemx-preq_item = 'X'.
*po_itemx-gr_ind = 'X' .
po_itemx-ir_ind = 'X' .
po_itemx-gr_basediv = 'X'.
po_itemx-pckg_no = 'X'.
*po_itemx-preq_name = 'X'.
APPEND po_itemx. CLEAR po_itemx.
2010 Aug 23 3:44 AM
*POSCHEDULE
POSCHEDULE-PO_ITEM = '00010'.
POSCHEDULE-SCHED_LINE = '0001'.
POSCHEDULE-DEL_DATCAT_EXT = 'D'.
POSCHEDULE-DELIVERY_DATE = SY-DATUM + 1.
POSCHEDULE-QUANTITY = '1'.
POSCHEDULE-STAT_DATE = SY-DATUM + 1.
POSCHEDULE-PREQ_NO = '0010000204'.
POSCHEDULE-PREQ_ITEM = '00010'.
*POSCHEDULEX
POSCHEDULEX-PO_ITEM = '00010'.
POSCHEDULEX-SCHED_LINE = '0001'.
POSCHEDULEX-PO_ITEM = 'X'.
POSCHEDULEX-SCHED_LINE = 'X'.
POSCHEDULEX-DEL_DATCAT_EXT = 'X'.
POSCHEDULEX-DELIVERY_DATE = 'X'.
POSCHEDULEX-QUANTITY = 'X'.
POSCHEDULEX-STAT_DATE = 'X'.
POSCHEDULEX-PREQ_NO = 'X'.
POSCHEDULEX-PREQ_ITEM = 'X'.
2010 Aug 23 3:44 AM
*Imputacion de pedido
poaccount-po_item = '10'.
poaccount-serial_no = '01'.
poaccount-sched_line_no = '0001'.
poaccount-creat_date = sy-datum .
poaccount-gl_account = '4100180200'.
poaccount-orderid = '008000070164'.
poaccount-bus_area = '2000'.
poaccount-bus_area = '2000'.
APPEND poaccount. CLEAR poaccount.
*Flags de imputacion
poaccountx-po_item = '10'.
poaccountx-po_itemx = 'X' .
poaccountx-serial_no = 'X'.
poaccountX-sched_line_no = 'X'.
poaccountx-creat_date = 'X' .
poaccountx-gl_account = 'X'.
poaccountx-orderid = 'X'.
poaccountX-bus_area = 'X'.
poaccountX-bus_area = 'X'.
APPEND poaccountx. CLEAR poaccountx.
2010 Aug 23 3:45 AM
Distribucion de imputacion
srvaccessvalues-pckg_no = '0000001980'.
srvaccessvalues-line_no = '0000000001' .
srvaccessvalues-serno_line = '01'.
srvaccessvalues-percentage = '100'.
srvaccessvalues-serial_no = '01'.
srvaccessvalues-NET_VALUE = '1100.01'.
srvaccessvalues-quantity = '1'.
APPEND srvaccessvalues. CLEAR srvaccessvalues.
Servicios encabezado
service-pckg_no = '1980'.
service-line_no = '0000000001' .
service-ext_line = '0000000000' .
*service-outl_level = '0'.
*service-outl_no = ' '.
*service-outl_ind = 'X'.
service-subpckg_no = '1981'.
*service-edition = '0000' .
*service-ovf_tol = '0'.
service-gr_price = '0'.
*service-from_line = '1'.
*service-DISTRIB = '2'.
service-short_text = ' TEST FOR SERVICE HEADER'.
APPEND service. CLEAR service.
servicio 1 asociado al encabezado
service-pckg_no = '1981'.
service-line_no = '0000000002' .
service-ext_line = '10' .
*service-outl_level = '0'.
*service-subpckg_no = '0000000000'.
*service-edition = '0000' .
service-base_uom = 'AU' .
service-quantity = '1' .
service-price_unit = '1' .
*service-ovf_tol = '0' .
service-short_text = ' TEST FOR SERVICE ITEM'.
service-gr_price = 1100.01.
service-matl_group = '90'.
APPEND service. CLEAR service .
2010 Aug 23 3:56 AM
error SE 518 "No account assignment exists for service line 0000000010"
how to solve it ,please give me detail code,thanks
Edited by: sam_bingxing on Aug 23, 2010 10:56 AM
2010 Aug 23 5:26 AM
HI there,
Try to post the PO manual without using any BAPI in ME22N.
U will hit and error for the account assignment.
Later go and meet your MM consultant.
Ask him to give the correct account no.
Later try to post again.if successful than use back the BAPI...
2010 Aug 23 5:40 AM
dear mrsaravannan
account no "4100180200" is copied from PR'0010000204',can u tell me detail code?
Kind regards,
sam_bingxing
2010 Aug 23 9:05 AM
HI Mr Sam,
I am not so sure about your error..Because i dont much understand the business process.
DId you tried to do the PO by manual method. Are u hitting any error with the same data for the BAPI.
Test it first using manual method...
Later i will guide u again mr sam..
2010 Aug 23 9:22 AM
dear mrsaravannan
with the same data,i can create po by manual method
i modified my test data like the below.
the errors ( E SE518 ) disappeared
but new error occurse: E V1 302 Sales document & is not available
can u show me how to solve it.
Distribucion de imputacion
srvaccessvalues-pckg_no = '0000001981'.
srvaccessvalues-line_no = '0000000002' .
srvaccessvalues-serno_line = '01'.
srvaccessvalues-percentage = '100'.
srvaccessvalues-serial_no = '01'.
srvaccessvalues-NET_VALUE = '1100.01'.
srvaccessvalues-quantity = '1'.
APPEND srvaccessvalues. CLEAR srvaccessvalues.
Servicios encabezado
service-pckg_no = '1980'.
service-line_no = '0000000001' .
service-ext_line = '0000000000' .
*service-outl_level = '0'.
*service-outl_no = ' '.
*service-outl_ind = 'X'.
service-subpckg_no = '1981'.
*service-edition = '0000' .
*service-ovf_tol = '0'.
service-gr_price = '0'.
*service-from_line = '1'.
*service-DISTRIB = '2'.
service-short_text = ' TEST FOR SERVICE HEADER'.
APPEND service. CLEAR service.
servicio 1 asociado al encabezado
service-pckg_no = '1981'.
service-line_no = '0000000002' .
service-ext_line = '10' .
*service-outl_level = '0'.
*service-subpckg_no = '0000000000'.
*service-edition = '0000' .
service-base_uom = 'AU' .
service-quantity = '1' .
service-price_unit = '1' .
*service-ovf_tol = '0' .
service-short_text = ' TEST FOR SERVICE ITEM'.
service-gr_price = 1100.01.
service-matl_group = '90'.
APPEND service. CLEAR service .
sam_bingxing
Edited by: sam_bingxing on Aug 23, 2010 4:22 PM
2010 Sep 03 2:46 PM
Hi Sam,
Which table in the BAPI have you passed the sales order.
Sujay
2010 Sep 04 10:19 AM
Sujay
No sale order is passed in bapi table.
I want to create po with reference pr.
what do you mean?
Edited by: sam_bingxing on Sep 4, 2010 5:21 PM
2010 Sep 02 4:21 PM
wish your help
Edited by: sam_bingxing on Sep 3, 2010 8:32 AM
2010 Sep 04 10:45 AM
Hi Sam,
You got the error sales document & is not available. right. So, I wanted to know where you are passing the sales document no in the BAPI
Sujay
2010 Sep 05 11:17 AM
Thanks all.
Problem is solved,poaccount-sched_line_no = '0001'.
and POSCHEDULE-SCHED_LINE = '0001'. must be changed to
poaccount-sched_line_no = '0000'.
and POSCHEDULE-SCHED_LINE = '0000'.
po_item-pckg_no = '1980'. and service-pckg_no = '1980'.and
service-pckg_no = '1981'. must be got from MS_ESLL reference PR
sam
2010 Sep 05 11:18 AM
Thank you very much for your help.
sam
Edited by: sam_bingxing on Sep 5, 2010 6:19 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |