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: 

Mass sales order creation using BAPI

0 Kudos

Dear All,

Can anyone help in mass sales order creation using Bapi BAPI_SALESORDER_CREATEFROMDAT2.

For example if i want to create 3 sales order with three item per order . i am populating

HEADER = 3 Records

Item = 9 records

schedule = 9 records

partner = 1 record.

Then after populating the records I am calling Bapi BAPI_SALESORDER_CREATEFROMDAT2

to create order. It should have created three order but unfortunately it creates

only one sales order. I debugged and found that records are correct both in header,

item, scheudle and partners.

Could you please guide me what I am missing for creation of mass orders.

I appreciate your time and many thanks in advance.

cheers

chandra

11 REPLIES 11

Former Member
0 Kudos

Are you doing a commit work after each of the BAPI calls.

0 Kudos

Hi Martin,

Thanks for your quick response. Yes I am calling FM call

function 'BAPI_TRANSACTION_COMMIT'

importing

return = p_return.

after calling BAPI. Please note that I am calling bapi BAPI_SALESORDER_CREATEFROMDAT2 only after population of data.

That means not in a LOOP.

Could you please thow me light again on this.

cheers

chandra

0 Kudos

Hi,

It should create three orders, pls check all the parameters u have passing and check the bapi return table for more idea.

0 Kudos

Hi Chandra,

Do like this.

Loop at Header table into wa_header.

*-- Move BAPI Header data

Loop at item table into wa_item where condition.

*-- in this move all Item and Schedule line item to the BAPI.

At end of item .

Use the below function modules.

BAPI_SALESORDER_CREATEFROMDAT2

BAPI_TRANSACTION_COMMIT.

Endloop.

Endloop.

Regards,

Balavardhan.K

0 Kudos

Hi Bhavana,

Thanks for your quick suggestion. Can we get around LOOP process. The reason being if you are uploading 3000 orders for each record it calls BAPI and comit this will reduce the system perfomrance time and uncessary kill the processor.

Could you please suggest me doing without a LOOP. I think SAP has faciliated internal table for Header, Item and schedule to populate then why need to have

LOOP again that my question.

I appreciate your early reply.

cheers

chandra

0 Kudos

Performance will be a serious concern if u r going to use loop. So check your BAPI calling parameters.

0 Kudos

Hi Alexander,

Can you please what parameters I need to check. If possilbe forward an example to look at. Once again I appreciate your help.

Many thanks and looking forward your more advise.

cheers

chandra

Former Member
0 Kudos

Hello Chandra,

Use Loop. Populate one header with the corresponding items at a time, call BAPI and then COMMIT. hope this will work.

Regards,

Bhavana

Former Member
0 Kudos

Hi Chandra,

SAP has provided the option for internal table so that we can populate one header at a time not to populate all headers together.

You will get the clarification of this by doing the below steps.

1. Go to SE37. Give the BAPI Name-> API_SALESORDER_CREATEFROMDAT2.

2. Prerss F8. Now fill the values in header table ORDER_HEADER_IN. Once you double click the icon to fill the data, you will get we can populate only one header line at a time. There is no tab available to insert second line to populate the header data. Means you can't populate more than 1 header.

3. Now try to populate data in Iitem table. You will find there is an option to insert second line, third line.....

I just observe BAPI structure and replied. Hope it's clear now.

Regards,

Bhavana

0 Kudos

Hi Bhavana,

Thanks for your right response. That means SAP does not provide the mass creation of

Sales orders at one shot.

Have a nice day.

cheers

0 Kudos

Hello Chandra,

Please reward the points if my answers were helpful

Regards,

Bhavana