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

Dynamically import parameters from a specific BAPI function

Former Member
0 Likes
686

Hi Experts,

I'm facing a little problem of improvement. Currently I'm using the BAPI_MATERIAL_GET_ALL on my program code.

What I actually need, is to dynamically say to the program to give me,

for example

CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'

EXPORTING

material = material

plant = plant

IMPORTING

plantdata = plantdetail

TABLES

return = return.

if the plantFLAG is set, elseif storagelocationdataFLAG set

CALL FUNCTION 'BAPI_MATERIAL_GET_ALL'

EXPORTING

material = material

plant = plant

stge_loc = stgeloc

IMPORTING

storagelocationdata = storagedetails

TABLES

return = return.

How can I say it with a minimum of code and a maximum of performance.

I don't want repeat the BAPI Function Call all the time, at least if it's in an other function that I can call.

Ps. Goal: Performance throughput and no redandance.

Best Regards.

1 ACCEPTED SOLUTION
Read only

former_member195698
Active Contributor
0 Likes
587

why can't you just make one FM call and get back both the Importing Parameters.

Use the required parameter based on the FLAG after the FM call

Regards,

Aj

2 REPLIES 2
Read only

former_member195698
Active Contributor
0 Likes
588

why can't you just make one FM call and get back both the Importing Parameters.

Use the required parameter based on the FLAG after the FM call

Regards,

Aj

Read only

0 Likes
587

Hi,

It's related to the fact that it could be that we have for example 10000 materials and this gone a take a very long time.

Also, I have used this technique for exporting material description, unitsofmeasure, longtext, extension.

Get from the bapi all of this and return only those where there flags are set.

But, this technique appear to be less effective when using 2000, 5000 or maybe 10000, 1million materials.

It's taking to long.

Hint: I'm using a range table for Material, I can have something like (I CP *) so get everything.

I just want something like

IMPORTING

plantdata = plantdetails (IF plantFLAG was set)

storagelocationdata = locationdetails (IF sglocFLAG is set)

....

It's not possible I know, but who knows?

Another Hint:

the import parameters of the BAPI_MATERIAL_GET_ALL are set by me.

This's done by getting the needed import parameters from the specified materials. (automatically)

Imagine if the user or program said:

Get plantdata, storagelocationdata

So, I used an itab to get the werks(plant) FROM MARC and sg_loc FROM MARAD, just for one time.

But this didn't actually speed up the program very much.

Because, the program said every time import from the bapi plantdata and after that import from the bapi a second time storagelocationdata.

Image now if I'll get everything and the program must find the appropriate parameters alone, this will take approximately a half a seconde for just one material, it's very very slow.

Regards,

Kais