‎2005 Sep 28 6:22 AM
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.
‎2005 Sep 28 6:44 AM
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.
‎2005 Sep 28 6:24 AM
‎2005 Sep 28 6:35 AM
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.
‎2005 Sep 28 6:39 AM
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).
‎2005 Sep 28 10:03 AM
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..
‎2005 Oct 08 12:02 AM
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
‎2007 Jun 08 7:36 AM
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.
‎2005 Sep 28 6:44 AM
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.