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: 

Problem on BAPI_SALESORDER_CREATEFROMDAT2 BAPI

former_member705696
Participant
0 Kudos

Guys,

I am facing a problem while using  BAPI_SALESORDER_CREATEFROMDAT2 BAPI in a program.

I am filling up header data  order_header_in     = lwa_header_in. For  lwa_header_in-purch_no_c   = lwa_success-tracking_num from flat file,

we have to pass different purchase order no. So we are using loop.

The requirement is, we have to avoid the loop to fill up header data. How to do that?

Regards,

Shyamal.

7 REPLIES 7

roberto_vacca2
Active Contributor
0 Kudos

Hi.

You can't use the bapi at once time for several headers orders.

You can figure out this limit by launching BAPI from SE37. The ORDER_HEADER_IN structure parameter in input, accept only 1 row.

In your situtation you should adopt SERIALIZATION, by calling n times the function module in the same session. That's a little more complicated but makes a difference in performance.

Hope to help

Bye

0 Kudos

Hi Roberto,

Can you please share a small program which explain me better.

Regards,

Shyamal.

0 Kudos

Hi.

BAPI_SALESORDER_CREATEFROMDAT2 comes with option remote function module  activated so you can do this.


CALL FUNCTION ‘BAPI_SALESORDER_CREATEFROMDAT2

STARTING NEW TASK ‘SALESORDER’

( DESTINATION NONE. <- is not mandatory).

In this way every order is processed in a single separated way and it doesn't need a linear execution of each ones.

In details:

When you call a remote function with the optional suffix STARTING NEW TASK, the system starts

the function in a new session. Rather than waiting for the remote call to be completed, the user

can resume processing as soon as the function module has been started in the target system.

Hope to help with this.

0 Kudos

Thanks Roberto.

I can not able to understand your suggestion. Can you please how the BAPI_SALESORDER_CREATEFROMDAT2 can be used.

1) Now the BAPI_SALESORDER_CREATEFROMDAT2 is used inside the loop. Can we use it outside for each Purchase order number while creating each sales order?

2) Please share a small piece of code - how to use the BAPI.


Is it like this?


Loop at it... into wa...


CALL FUNCTION ‘BAPI_SALESORDER_CREATEFROMDAT2

STARTING NEW TASK ‘SALESORDER’

( DESTINATION NONE. <- is not mandatory)


endloop.


If we code this way, then how performance will be tuned?


Regards,

Shyamal.

0 Kudos

HI. Sorry for the delay.

1) You cannot use BAPI_SALESORDER_CREATEFROMDAT2 for a massive update at once. You have to create each order.

2) If you use SET UPDATE TASK LOCAL, before BAPI call, you'll reduce task (probably you'll have an higher LOAD memory level).  Sorry but, before proceed, we have to understand what kind of limit you reach in order creation. I mean: How much time does it take to create 100 orders? Think that sales orders created by IDOCS in 5 second and with a parallel processing, should be ok.

Hope to help.

0 Kudos

Hi Roberto,

Thanks for your reply. It will be great if kindly share a small program since I am unable to understand your solution properly.

Regards,

Shyamal.

0 Kudos

Hi Shymal,

Sample code:

If time is an issue you can execute it in background.

Hope this helps.

Ernesto