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_SALESORDER_CREATEFROMDAT2 email

Former Member
0 Likes
1,612

Does anyone have any info on using this BAPI to create a sales order and also an email address against a one time customer?

Thanks, Mark

3 REPLIES 3
Read only

Former Member
0 Likes
717

Here is some sample code:

  • 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.

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 =
.

Message was edited by:

Pankaj Singh

Read only

Former Member
0 Likes
717

Add an address link to the Partner internal table and add this number to the Partner address

internal table.

Read only

Former Member
0 Likes
717

Hi Mark,

Yes you can fill email address against customer number.

In this function module there is table PARTNERADDRESSES.In this table you can fill email address in the field E_MAIL.But for this you have use following steps.

In the partner table ORDER_PARTNERS you have to give the address number of the customer in the filed ADDR_LINK.along with this you have to fill one more field in the same table ORDER_PARTNERS that is ADDR_ORIG = 'B'.

Then in the PARTNERADDRESSES table give the address number of the customer in the field ADDR_NO and you will give email address in the field E_MAIL.Then it will works fine .

Thanks,

shyla