Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_PO_CREATE1 - valorize the Items

Former Member
0 Likes
1,684

Hi Chaps,

I am using the BAPI BAPI_PO_CREATE1

It took me time but it works with one exception : only the first item is valorized : the others items are saved with a price = 0

How could I fix the problem?

12 REPLIES 12
Read only

Former Member
0 Likes
1,613

Hi,

Can you post your code here.

Read only

Former Member
0 Likes
1,613

Here for the header

ls_poheader-po_number = is_zamm_dda_ent-ebeln.

ls_poheader-comp_code = is_zamm_dda_ent-bukrs.

ls_poheaderx-comp_code = 'X'.

ls_poheader-creat_date = sy-datum.

ls_poheaderx-creat_date = 'X'.

ls_poheader-created_by = is_zamm_dda_ent-achname.

ls_poheaderx-created_by = 'X'.

ls_poheader-vendor = is_zamm_dda_ent-lifnr.

ls_poheaderx-vendor = 'X'.

ls_poheader-langu = sy-langu.

ls_poheaderx-langu = 'X'.

ls_poheader-purch_org = is_zamm_dda_ent-ekorg.

ls_poheaderx-purch_org = 'X'.

ls_poheader-pur_group = is_zamm_dda_ent-ekgrp.

ls_poheaderx-pur_group = 'X'.

ls_poheader-currency = is_zamm_dda_ent-waers.

ls_poheaderx-currency = 'X'.

ls_poheader-ref_1 = is_zamm_dda_ent-ihrez.

ls_poheaderx-ref_1 = 'X'.

ls_poheader-doc_type = is_zamm_dda_ent-bsart.

ls_poheaderx-doc_type = 'X'.

  • ls_poheader-doc_type = is_zamm_dda_ent-bstyp.

  • ls_poheaderx-doc_type = 'X'.

ls_poheader-doc_date = is_zamm_dda_ent-lidat_ent.

ls_poheaderx-doc_date = 'X'.

ls_poheader-doc_date = is_zamm_dda_ent-lidat_ent.

ls_poheaderx-doc_date = 'X'.

ls_poheader-vper_start = sy-datum. "vérifire quelle date mettre

ls_poheaderx-vper_start = 'X'.

*

Read only

Former Member
0 Likes
1,613

Now items

Items

LOOP AT lt_et_pos INTO ls_pos.

ls_poitem-po_item = ls_pos-ddapos.

ls_poitemx-po_item = ls_pos-ddapos.

ls_poitemx-po_itemx = 'X'.

ls_poitem-short_text = ls_pos-design_1.

ls_poitemx-short_text = 'X'.

ls_poitem-material = ls_pos-matnr.

ls_poitemx-material = 'X'.

ls_poitem-ematerial = ls_pos-matnr.

ls_poitemx-ematerial = 'X'.

ls_poitem-quantity = ls_pos-menge .

ls_poitemx-quantity = 'X'.

ls_poitem-po_unit = ls_pos-meins.

ls_poitemx-po_unit = 'X'.

ls_poitem-orderpr_un = ls_pos-bprme.

ls_poitemx-orderpr_un = 'X'.

lv_netpr = ls_pos-brutpr.

ls_poitem-net_price = lv_netpr.

ls_poitemx-net_price = 'X'.

ls_poitem-price_unit = 1.

ls_poitemx-price_unit = 'X'.

ls_poitem-plant = ls_pos-werks.

ls_poitemx-plant = 'X'.

IF ls_pos-aufnr IS NOT INITIAL.

ls_poitem-acctasscat = 'F'.

ls_poitemx-acctasscat = 'X'.

ENDIF.

APPEND ls_poitem TO lt_poitem.

APPEND ls_poitemx TO lt_poitemx.

*

    • alimenter les champs schedule

ls_bapimeposchedule-po_item = ls_pos-ddapos.

ls_bapimeposchedulex-po_item = ls_pos-ddapos.

CONCATENATE is_zamm_dda_ent-lidat_ent6(2) '.' is_zamm_dda_ent-lidat_ent4(2) '.' is_zamm_dda_ent-lidat_ent(4) INTO ls_bapimeposchedule-delivery_date.

ls_bapimeposchedulex-delivery_date = 'X'.

ls_bapimeposchedule-stat_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-stat_date = 'X'.

ls_bapimeposchedule-quantity = ls_pos-menge.

ls_bapimeposchedulex-quantity = 'X'.

ls_bapimeposchedule-po_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-po_date = 'X'.

ls_bapimeposchedule-ms_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-ms_date = 'X'.

*

**

APPEND ls_bapimeposchedule TO lt_bapimeposchedule.

APPEND ls_bapimeposchedulex TO lt_bapimeposchedulex.

*

*

Edited by: Vincent Chesneau on Feb 8, 2010 8:20 AM

Edited by: Vincent Chesneau on Feb 8, 2010 8:23 AM

Read only

Former Member
0 Likes
1,613

ls_pocond-itm_number = ls_poitem-po_item.

ls_pocond-cond_st_no = c_condstno.

ls_pocond-cond_value = ls_totaux-sstt_net. "todo voir quel montant mettre

ls_pocondx-cond_value = 'X'.

ls_pocond-cond_count = c_condcount.

ls_pocondx-cond_count = 'X'.

ls_pocond-currency = is_zamm_dda_ent-waers.

ls_pocondx-currency = 'X'.

ls_pocond-change_id = 'I'.

ls_pocondx-change_id = 'X'.

ls_pocondx-itm_number = ls_pocond-itm_number.

ls_pocondx-cond_st_no = c_condstno.

ls_poitemx-ir_ind = 'X'.

APPEND ls_pocond TO lt_pocond.

APPEND ls_pocondx TO lt_pocondx.

  • Renseigner le centre de coûts ou de l'ordre interne selon la zone qui a été utilisée dans le mouvement

ls_poaccount-gl_account = ls_pos-sakto.

ls_poaccountx-gl_account = 'X'.

  • ls_poaccount-costcenter = ls_pos-sakto.

  • ls_poaccountx-costcenter = 'X'.

IF NOT ls_pos-aufnr IS INITIAL.

ls_poaccount-orderid = ls_pos-aufnr.

ls_poaccountx-orderid = 'X'.

ENDIF.

  • 012 - Fin

ls_poaccount-po_item = ls_poitem-po_item.

  • t_poaccount-gl_account = t_edm_mm-kstar.

  • t_poaccountx-gl_account = 'X'.

ls_poaccountx-po_item = ls_poitem-po_item.

APPEND ls_poaccount TO lt_poaccount.

APPEND ls_poaccountx TO lt_poaccountx.

ENDLOOP.

Edited by: Vincent Chesneau on Feb 8, 2010 8:19 AM

Read only

Former Member
0 Likes
1,613

Schedule

    • alimenter les champs schedule

ls_bapimeposchedule-po_item = ls_pos-ddapos.

  • ls_bapimeposchedulex-po_itemx = 'X'.

ls_bapimeposchedulex-po_item = ls_pos-ddapos.

  • ls_bapimeposchedule-sched_line = ls_bapimeposchedule-sched_line + 1.

CONCATENATE is_zamm_dda_ent-lidat_ent6(2) '.' is_zamm_dda_ent-lidat_ent4(2) '.' is_zamm_dda_ent-lidat_ent(4) INTO ls_bapimeposchedule-delivery_date.

ls_bapimeposchedulex-delivery_date = 'X'.

  • ls_bapimeposchedule-delivery_date = ls_ent_e-lidat_ent.

ls_bapimeposchedule-stat_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-stat_date = 'X'.

ls_bapimeposchedule-quantity = ls_pos-menge.

ls_bapimeposchedulex-quantity = 'X'.

ls_bapimeposchedule-po_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-po_date = 'X'.

ls_bapimeposchedule-ms_date = is_zamm_dda_ent-lidat_ent.

ls_bapimeposchedulex-ms_date = 'X'.

*

**

APPEND ls_bapimeposchedule TO lt_bapimeposchedule.

APPEND ls_bapimeposchedulex TO lt_bapimeposchedulex.

Read only

Former Member
0 Likes
1,613

Pcond :

ls_pocond-itm_number = ls_poitem-po_item.

ls_pocond-cond_st_no = c_condstno.

ls_pocond-cond_value = ls_totaux-sstt_net. "todo voir quel montant mettre

ls_pocondx-cond_value = 'X'.

ls_pocond-cond_count = c_condcount.

ls_pocondx-cond_count = 'X'.

ls_pocond-currency = is_zamm_dda_ent-waers.

ls_pocondx-currency = 'X'.

ls_pocond-change_id = 'I'.

ls_pocondx-change_id = 'X'.

ls_pocondx-itm_number = ls_pocond-itm_number.

ls_pocondx-cond_st_no = c_condstno.

ls_poitemx-ir_ind = 'X'.

APPEND ls_pocond TO lt_pocond.

APPEND ls_pocondx TO lt_pocondx.

  • Renseigner le centre de coûts ou de l'ordre interne selon la zone qui a été utilisée dans le mouvement

ls_poaccount-gl_account = ls_pos-sakto.

ls_poaccountx-gl_account = 'X'.

  • ls_poaccount-costcenter = ls_pos-sakto.

  • ls_poaccountx-costcenter = 'X'.

IF NOT ls_pos-aufnr IS INITIAL.

ls_poaccount-orderid = ls_pos-aufnr.

ls_poaccountx-orderid = 'X'.

ENDIF.

  • 012 - Fin

ls_poaccount-po_item = ls_poitem-po_item.

  • t_poaccount-gl_account = t_edm_mm-kstar.

  • t_poaccountx-gl_account = 'X'.

ls_poaccountx-po_item = ls_poitem-po_item.

APPEND ls_poaccount TO lt_poaccount.

APPEND ls_poaccountx TO lt_poaccountx.

ENDLOOP.

Read only

Former Member
0 Likes
1,613

Bapi :

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = ls_poheader

poheaderx = ls_poheaderx

  • POADDRVENDOR =

testrun = ip_test

  • MEMORY_UNCOMPLETE =

  • MEMORY_COMPLETE =

  • POEXPIMPHEADER =

  • POEXPIMPHEADERX =

  • VERSIONS =

  • NO_MESSAGING =

  • NO_MESSAGE_REQ =

  • NO_AUTHORITY =

  • NO_PRICE_FROM_PO =

IMPORTING

exppurchaseorder = lv_exppurchaseorder

expheader = ls_expheader

exppoexpimpheader = ls_exppoexpimpheader

TABLES

return = lt_return

poitem = lt_poitem

poitemx = lt_poitemx

  • POADDRDELIVERY =

poschedule = lt_bapimeposchedule

poschedulex = lt_bapimeposchedulex

poaccount = lt_poaccount

  • POACCOUNTPROFITSEGMENT =

poaccountx = lt_poaccountx

  • POCONDHEADER =

  • POCONDHEADERX =

pocond = lt_pocond

pocondx = lt_pocondx

  • POLIMITS =

  • POCONTRACTLIMITS =

  • POSERVICES =

  • POSRVACCESSVALUES =

  • POSERVICESTEXT =

  • EXTENSIONIN =

  • EXTENSIONOUT =

  • POEXPIMPITEM =

  • POEXPIMPITEMX =

  • POTEXTHEADER =

  • POTEXTITEM =

  • ALLVERSIONS =

  • POPARTNER =

  • POCOMPONENTS =

  • POCOMPONENTSX =

  • POSHIPPING =

  • POSHIPPINGX =

  • POSHIPPINGEXP =

Read only

Former Member
0 Likes
1,613

Hi Satya,

I hope you find your way with the items part, if not I can post the code in several part (there I tried twice but it is unredable to me...)

Tks

Vincent

Read only

Former Member
0 Likes
1,613

Any idea some body?

Read only

Former Member
0 Likes
1,613

This message was moderated.

Read only

0 Likes
1,613

I think this is your 3rd or 4th id in SDN. And still you haven't learned your lessons? If you keep continuing this, be ready to create the next id 'Krupaj'

Read only

Former Member
0 Likes
1,613

Ok,

it works, I don't know exactly what was wrong...