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 Create Sales Order

Former Member
0 Likes
958

Hi all,

I want to Create a Sales order (VA01) with reference using a Contract created in VA41 (Rent contract).

I want to use a BAPI, but I'm not sure if I've to use BAPI_SALESORDER_CREATEFROMDAT2 or

BAPI_CUSTOMERRETURN_CREATE or any other...

and how to use it...

Can anybody help me?¿

Thanks and Regards.

Urtzi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
901

Hi,

Use FM: BAPI_SALESORDER_CREATEFROMDAT2 .

Go through the Fm documentation for more details.

Regards

Subramanian

5 REPLIES 5
Read only

Former Member
0 Likes
902

Hi,

Use FM: BAPI_SALESORDER_CREATEFROMDAT2 .

Go through the Fm documentation for more details.

Regards

Subramanian

Read only

Former Member
0 Likes
901

Hello,

  • one order with total sum of effort

clear: l_order_header,

l_salesdocument,

l_order_partners,

l_order_items,

l_order_schdl.

refresh: it_order_items,

it_order_partners,

it_order_schdl,

it_return.

  • ???????? get from material ...

  • Order header

l_order_header-doc_type = 'ZQBV'.

l_order_header-distr_chan = '10'.

l_order_header-division = '00'.

if g_qals-werk eq '1100'.

l_order_header-sales_org = '1000'.

else.

if g_qals-werk eq '3100'.

l_order_header-sales_org = '3000'.

else.

message i001(00) with text-005.

endif.

endif.

l_order_header-purch_no_c = g_qals-prueflos. " <= lot

  • Partner data

l_order_partners-partn_role = 'AG'.

l_order_partners-partn_numb = g_qals-kunnr.

append l_order_partners to it_order_partners.

  • Order items => only one

l_order_items-itm_number = 10.

l_order_items-material = g_qals-matnr.

l_order_items-target_qty = 1.

append l_order_items to it_order_items.

  • Schedules for quantity

l_order_schdl-itm_number = 10.

l_order_schdl-req_qty = 1. " <= only 1 !

append l_order_schdl to it_order_schdl.

  • Conditions for value

l_order_conditions-itm_number = 10.

l_order_conditions-cond_type = 'PR00'.

l_order_conditions-cond_value = g_effort_sum.

l_order_conditions-currency = g_effort_unit.

append l_order_conditions to it_order_conditions.

  • BAPI to create sales order

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

  • SALESDOCUMENTIN =

ORDER_HEADER_IN = l_order_header

  • ORDER_HEADER_INX =

  • SENDER =

  • BINARY_RELATIONSHIPTYPE =

  • INT_NUMBER_ASSIGNMENT =

  • BEHAVE_WHEN_ERROR =

  • LOGIC_SWITCH =

  • TESTRUN =

  • CONVERT = ' '

IMPORTING

SALESDOCUMENT = l_salesdocument

TABLES

RETURN = it_return

ORDER_ITEMS_IN = it_order_items

  • ORDER_ITEMS_INX =

ORDER_PARTNERS = it_order_partners

ORDER_SCHEDULES_IN = it_order_schdl

  • ORDER_SCHEDULES_INX =

ORDER_CONDITIONS_IN = it_order_conditions

  • ORDER_CONDITIONS_INX =

  • ORDER_CFGS_REF =

  • ORDER_CFGS_INST =

  • ORDER_CFGS_PART_OF =

  • ORDER_CFGS_VALUE =

  • ORDER_CFGS_BLOB =

  • ORDER_CFGS_VK =

  • ORDER_CFGS_REFINST =

  • ORDER_CCARD =

  • ORDER_TEXT =

  • ORDER_KEYS =

  • EXTENSIONIN =

  • PARTNERADDRESSES =

.

if not l_salesdocument is initial.

  • order successfully created

message i001(00) with text-001 l_salesdocument.

endif.

endif.

Vasanth

Read only

Former Member
0 Likes
901

Hi,

Try passing the contract in the following parameters

ORDER_HEADER_IN-REFOBJTYPE

ORDER_HEADER_IN-REFOBJKEY

ORDER_HEADER_IN-REFDOCTYPE

Thanks,

Naren

Read only

0 Likes
901

Hi,

Finally I've used BAPI_CUSTOMERRETURN_CREATE and I've get the Return Order, I can see in the flow:

. Rental Contract 40000118/10

CI Returns 20000212/10

But I need just oposite: to create the return depending of the rental contract:

This is made online:

Rental Contract 40000118/10

. CI Returns 20000196/10

Any help?

Thanks.

Urtzi.

Message was edited by:

Urtzi Barandiaran Aguirre

Read only

0 Likes
901

I've got it!!

Thanks for your help!!

Urtzi.