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

Optimizing multiple performs....

Former Member
0 Likes
563

Hi,

I basically want to embed multiple similar kind of performs in one single Perform.

There is a standard BAPI which get details of a given object number in multiple tables (54 internal tables). After that , I am using perform statement which does the initializaton check for each internal table, and then download data for each internal table in flat files as follows:

Call function 'XYZ'.

Exporting......

..............

Tables

PTRVG = A1[]

PTRVF = A2[]

.....

.....

PTGTR = A54[].

IF A1[] IS NOT INITIAL.

FNAME = 'A1.txt'.

perform download tables A1

using FNAME.

ENDIF.

.......

.......

......

IF A54[] IS NOT INITIAL.

FNAME = 'A54.txt'.

perform download tables A54

using FNAME.

ENDIF.

Now this creates 54 flat files using 54 internal tables. This is what I wanted.

<b>But, I don't want to write perform 54 times. I was wondering if there is a way I can write ONE perform inside a loop which will check for INITIAL for every internal table which will get looped one after another.</b>

I know a table called The table FUPARAREF which can get Table type parameters in an internal tables for given function module.

Select PARAMETER PPOSITION STRUCTURE FROM FUPARAREF into TABLE PARAMETER_TAB WHERE FUNCNAME = 'ABC'

AND PARAMTYPE = 'T'

ORDER BY PPOSITION.

I was wondering if this can be used to solve my issue ? If not , then any suggestions...

Regards,

Rajesh.

4 REPLIES 4
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
531

Hi

Use Case instead of Ifs.

Regards,

Sreeram

Read only

0 Likes
531

This is not an IF-ELSEIF condition which I can replace by case.

I think Case cannot solve this.

Read only

Former Member
0 Likes
531

Hi

Since you use the same fun module in all the cases (like GUI_DOWNLOAD) noo need to pass the fun module name in perform

better declare 54 ITABs and pass them and change the DB table A1

If not itaba1[] is initial.

perform download tables itaba1 changing A1.

...........

perform download tables itaba54 changing A54.

so you will pass the internal table to the function module and downloaded data to be passed to Db table A1 and it is returned.

reward points if useful

regards

Anji

Read only

Former Member
0 Likes
531

Rajesh,

See if the following works for your requirement.

REPORT ZTEST56 .

data: counter type sy-tabix.

Perform test.

*---- Form test

FORM test .

Write:/'test', counter.

counter = counter + 1.

  • Read an internal table for the values you want to pass to

  • the perform using this counter.

if counter GE 5.

exit.

else.

Perform test.

endif.

ENDFORM. " test