‎2005 Apr 27 11:58 PM
Hello all,
I want to modify a layout set that we use for our accounts payable checks. Currently the stub has one line for each document that makes up this check. Now additional detail from each documents distribution lines has also been requested.
If there was a consistent number of detail lines for every document, I understand how this could be accomplished. But since the number of distribution lines varies for each document, I don't see any way that this can be done within the form itself because Sapscript does not have any syntax for looping (While.....Endwhile Loop....endloop Do....Endo).
A form could be performed in an external program to determine the number of distribution lines, but how would you move through those distribution lines and write information on the check stub?
I do not want to modify RFFOUS_C or copy this program and make a commodification to it.
Is anyone aware of any looping syntax for Sapscript in version 4 .7?
Thanks
Bruce
I know this syntax doesn't work, but this is what I am trying to accomplish.
/*>> Build ditribution line
/: DEFINE &V_DISTRIB& '123456789012345678901234567890'
/*>> Create a counter to keep track of Distrib line #
/: DEFINE &V_COUNT& '001'
/: WHILE V_DISTRIB& > ' '
/: &V_COUNT& = &V_COUNT& + 1
/: PERFORM 'Z_DISTRIBUTION' IN PROGRAM 'ZFM05A01'
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: USING &V_COUNT&
/: CHANGING &V_DISTRIB&
/: ENDPERFORM.
/*>> Write distribution line fields, from external program
T1 &V_DISTRIB&
/: ENDWHILE
‎2005 Apr 28 12:45 AM
I can see two solutions to your problem, a brute force approach and a difficult one.
1) Brute force
Write your /: PERFORM as follows:
/: DEFINE &V_LINE1& ' '
/: DEFINE &V_LINE2& ' '
...
/: DEFINE &V_LINE9& ' '
/: DEFINE &V_LINE10& ' '
/: PERFORM 'Z_DISTRIBUTION' IN PROGRAM 'ZFM05A01'
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: USING &V_COUNT&
/: CHANGING &V_LINE1&
/: CHANGING &V_LINE2&
...
/: CHANGING &V_LINE9&
/: CHANGING &V_LINE10&
/: ENDPERFORM.Then for each possible return line use an IF statement
/: IF &V_LINE1& NE ' '
T1 &V_LINE1&
/: ENDIFYou can do away with the IF statements if your form design will allow you to set the "No Blank Lines" box in the Standard Attributes of paragraph T1.
2) Difficult approach
In Z_DISTRIBUTION, write any number of lines into a standard text using FM SAVE_TEXT. Use the exact same paragraph fields in this text as you would in your SAPscript form text element lines. Then use the INCLUDE command to write them back out into your documents text elements like so:
/: INCLUDE <name> OBJECT <object> ID <id>or just
/: INCLUDE <name>if you stick to the default values of inside the SAPscript printing process.
‎2005 Apr 28 12:45 AM
I can see two solutions to your problem, a brute force approach and a difficult one.
1) Brute force
Write your /: PERFORM as follows:
/: DEFINE &V_LINE1& ' '
/: DEFINE &V_LINE2& ' '
...
/: DEFINE &V_LINE9& ' '
/: DEFINE &V_LINE10& ' '
/: PERFORM 'Z_DISTRIBUTION' IN PROGRAM 'ZFM05A01'
/: USING ®UP-BUKRS&
/: USING ®UP-BELNR&
/: USING ®UP-GJAHR&
/: USING &V_COUNT&
/: CHANGING &V_LINE1&
/: CHANGING &V_LINE2&
...
/: CHANGING &V_LINE9&
/: CHANGING &V_LINE10&
/: ENDPERFORM.Then for each possible return line use an IF statement
/: IF &V_LINE1& NE ' '
T1 &V_LINE1&
/: ENDIFYou can do away with the IF statements if your form design will allow you to set the "No Blank Lines" box in the Standard Attributes of paragraph T1.
2) Difficult approach
In Z_DISTRIBUTION, write any number of lines into a standard text using FM SAVE_TEXT. Use the exact same paragraph fields in this text as you would in your SAPscript form text element lines. Then use the INCLUDE command to write them back out into your documents text elements like so:
/: INCLUDE <name> OBJECT <object> ID <id>or just
/: INCLUDE <name>if you stick to the default values of inside the SAPscript printing process.
‎2009 Feb 18 6:29 PM