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

loop at internal Table inside Script

Former Member
0 Likes
2,582

Hi

I am filling a table in a subroutine in a program and calling it through 'Perform' from my Script,now the main issue is , How to display the table in my script ?

I want to loop through an internal table & display its content on my script , but i can't make changes in the calling program by any means.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,509

Hi Ajitabh ,

With PERFORM inside SAPSCRIPT you can only pass individual fields and also get back individual fields .

Check This

http://help.sap.com//saphelp_470/helpdata/EN/d1/802fd3454211d189710000e8322d00/frameset.htm

Only "USING" and CHANGING" options are allowed and that too only symbols available / defined in sapscript can be passed .

Even if you populate an internal table in the program you are calling with "PERFORM" there is no way to pass this internal table back to sapscript , also in SAPSCRIPT there is no way to loop .

If you are sure about the no of lines you are going to populate and all lines have only one column ( only one field ) you can try something like this .

/: PERFORM GET_VALUE IN PROGRAM <ZNAME>

/: USING &VAR1&

/: USING &VAR2&

/: CHANGING &ITAB1&

/: CHANGING &ITAB2&

/: CHANGING &ITAB3&

/: CHANGING &ITAB4&

/: ENDPERFORM

Anothe way is to loop in the main print program and call WRITE_FORM . But I guess your main print program is a SAP std program which you dont want to copy and change.

Cheers.

7 REPLIES 7
Read only

Former Member
0 Likes
1,509

Hi,

Can go through this link

http://www.sap-img.com/sapscripts.htm

Read only

Former Member
0 Likes
1,509

Hi Ajitabh,

>>>I want to loop through an internal table & display its content on my script , but i can't make changes in the calling program by any means.

Can you elaborate your issue and your requirement more clearly.

Read only

0 Likes
1,509

Interesting concept! I am very curious if you can make this work (and how).

The only idea I have is to loop at the table in the external perform and write to another textelement (which you should create perhaps).

Read only

0 Likes
1,509

I have got a solution for the above mentioned problem ..

I filled my internal table inside the perform in another program . Then in that perform i created a text object.

Now this text object is created using Function module

CREATE_TEXT ... using a object of the application i am working on , for eg QM(quality Management)...i usd QMEL..

then included that text object inside my script using

INCLUDE command directly... though there are limitations in the way it will be displayed on the script ... This might the only way to atleast get the data on the script correctly..

Read only

0 Likes
1,509

Great idea! I used it and it works.

There are two fields with table FLINES; TDFORMAT and TDLINE. I set TDFORMAT to the paragraph format I'm using in my SAPScript i.e. 'T1'. For whatever reason though, it does not save 'T1', instead, it saves it as an asterick '*'. This is the default paragraph in SAPScript command. I simply set the default paragraph of my window in SAPscript to 'T1' to overcome this issue.

With TDLINE, I place the separator markers ',,' accordingly and print my dynamic table. The users will never tell the difference, if there is only one line to print, or several.

Message was edited by: Sean Machado

Read only

0 Likes
1,509

Hi,

Can you please elaborate on how you have used the function module create_text?

What values to be passed to the import/export parameters?I am also facing the same problem of passing an internal table to the script using subroutines.

Thanks in advance.

Read only

Former Member
0 Likes
1,510

Hi Ajitabh ,

With PERFORM inside SAPSCRIPT you can only pass individual fields and also get back individual fields .

Check This

http://help.sap.com//saphelp_470/helpdata/EN/d1/802fd3454211d189710000e8322d00/frameset.htm

Only "USING" and CHANGING" options are allowed and that too only symbols available / defined in sapscript can be passed .

Even if you populate an internal table in the program you are calling with "PERFORM" there is no way to pass this internal table back to sapscript , also in SAPSCRIPT there is no way to loop .

If you are sure about the no of lines you are going to populate and all lines have only one column ( only one field ) you can try something like this .

/: PERFORM GET_VALUE IN PROGRAM <ZNAME>

/: USING &VAR1&

/: USING &VAR2&

/: CHANGING &ITAB1&

/: CHANGING &ITAB2&

/: CHANGING &ITAB3&

/: CHANGING &ITAB4&

/: ENDPERFORM

Anothe way is to loop in the main print program and call WRITE_FORM . But I guess your main print program is a SAP std program which you dont want to copy and change.

Cheers.