Application Development 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: 

How to upload a data using BAPI_SALESORDER_CREATEFROMDAT2 without using LSM

Former Member
0 Kudos

Hi,

I want to upload a data from an input file on the presentation server using BAPI_SALESORDER_CREATEFROMDAT2 first uploading the data and then creating sales orders out of it.

I will be highly obliged if anyone can guide me with it.

I have tried the same using LSMW got succeeded in posting the idocs correctly and now I want to do it without using LSMW. The main intention of not using LSMW is that after creating sales orders, I want to display the messages related to number of sales order created, Number of records uploaded, Number of records.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

BAPI_SALESORDER_CREATEFROMDAT2

____________________________________________________

Text

Sales order: Create Sales Order

Functionality

You can use this method to create sales orders.

You must enter at least sales order header data (via ORDER_HEADER_IN structure) and partner data (via the ORDER_PARTNERS table) as input parameters.

Enter the item data via the ORDER_ITEMS_IN table. You can allocate item numbers manually, by filling in the relevant fields, or the system does it, according to the settings for Customizing, by leaving the relevant fields blank.

If you have configurable items, you must enter the configuration data in the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.

Credit cards can be transferred via the BAPICCARD structure, on the one hand, data for card identification, on the other, data for a transaction which has taken place in an external system.

Once you have created the sales order successfully, you will receive the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.

If no sales area has been created in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been entered in the partner table. If a clear sales area cannot be created, you will receive a system message, and the sales order will not be created.

Notes

1. Mandatory entries:

ORDER_HEADER_IN : DOC_TYPE Sales document type

SALES_ORG Sales organization

DISTR_CHAN Distribution channel

DIVISION Division

ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party

PARTN_NUMB Customer number

ORDER_ITEMS_IN..: MATERIAL Material number

2. Ship-to party:

If no ship-to party is entered, use the following: Ship-to party =

sold-to party.

3. Commit control:

The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.

4. German key words:

The following key words must be entered in German, independantly of

the logon language:

DOC_TYPE Sales document type, for example: TA for standard order

PARTN_ROLE Partner role, for example: WE for ship-to party

Further Information

You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.

Parameters

SALESDOCUMENTIN

ORDER_HEADER_IN

ORDER_HEADER_INX

SENDER

BINARY_RELATIONSHIPTYPE

INT_NUMBER_ASSIGNMENT

BEHAVE_WHEN_ERROR

LOGIC_SWITCH

TESTRUN

CONVERT

SALESDOCUMENT

RETURN

ORDER_ITEMS_IN

ORDER_ITEMS_INX

ORDER_PARTNERS

ORDER_SCHEDULES_IN

ORDER_SCHEDULES_INX

ORDER_CONDITIONS_IN

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

Regards

Raj

3 REPLIES 3

Former Member
0 Kudos

Hi

BAPI_SALESORDER_CREATEFROMDAT2

____________________________________________________

Text

Sales order: Create Sales Order

Functionality

You can use this method to create sales orders.

You must enter at least sales order header data (via ORDER_HEADER_IN structure) and partner data (via the ORDER_PARTNERS table) as input parameters.

Enter the item data via the ORDER_ITEMS_IN table. You can allocate item numbers manually, by filling in the relevant fields, or the system does it, according to the settings for Customizing, by leaving the relevant fields blank.

If you have configurable items, you must enter the configuration data in the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.

Credit cards can be transferred via the BAPICCARD structure, on the one hand, data for card identification, on the other, data for a transaction which has taken place in an external system.

Once you have created the sales order successfully, you will receive the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.

If no sales area has been created in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been entered in the partner table. If a clear sales area cannot be created, you will receive a system message, and the sales order will not be created.

Notes

1. Mandatory entries:

ORDER_HEADER_IN : DOC_TYPE Sales document type

SALES_ORG Sales organization

DISTR_CHAN Distribution channel

DIVISION Division

ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party

PARTN_NUMB Customer number

ORDER_ITEMS_IN..: MATERIAL Material number

2. Ship-to party:

If no ship-to party is entered, use the following: Ship-to party =

sold-to party.

3. Commit control:

The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.

4. German key words:

The following key words must be entered in German, independantly of

the logon language:

DOC_TYPE Sales document type, for example: TA for standard order

PARTN_ROLE Partner role, for example: WE for ship-to party

Further Information

You can find further information in the OSS. The note 93091 contains general information on the BAPIs in SD.

Parameters

SALESDOCUMENTIN

ORDER_HEADER_IN

ORDER_HEADER_INX

SENDER

BINARY_RELATIONSHIPTYPE

INT_NUMBER_ASSIGNMENT

BEHAVE_WHEN_ERROR

LOGIC_SWITCH

TESTRUN

CONVERT

SALESDOCUMENT

RETURN

ORDER_ITEMS_IN

ORDER_ITEMS_INX

ORDER_PARTNERS

ORDER_SCHEDULES_IN

ORDER_SCHEDULES_INX

ORDER_CONDITIONS_IN

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

Regards

Raj

Anjhi
Contributor
0 Kudos

Hi Ameet,

May I know your requirement clearly? Are you expecting the program code or the step to build your own code?

Rgds,

Kumar

Former Member
0 Kudos

Hi,

My requirement is that I want to create Upload the data from an input file on my PC and then create sales orders out of it. I tried first using LSMW.

Now i want to try it out through coding and using the BAPI_SALESORDER_CREATEFROMDAT2 function module and I need the steps to proceed with it and finally i want to display messages such as number of sales orders created, number of records failed, Total Number of records processed etc.

I hope you got what is my requirement.

Regards,

Ameet