cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSCRIPT - 'PERFORM STATEMENT'

Former Member
0 Kudos

Hi gurus.

With a 'Perform Statement' in SAP Script, how can i get to print values from a loop statement in the ABAP code.(OR there is another way)

I have a challenge because it appears like the 'Perform Statement' only retrieves one value yet I need to print all the values from a table.

Ponit will be awarded for valuable answers.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You are correct, any loop processing in SAPscript takes place in the print program, not in the form itself. Smartforms has the concept of looping through data, but SAPscript does not.

I don't know your specific requirements, but if feels like you will need to change you print program.

Regards,

Nick

Answers (3)

Answers (3)

Former Member
0 Kudos

try with

loop

endloop

regards

Giridhar

Former Member
0 Kudos

hi

when using a perform there are opions like

using

changing and tables

try using tables

you will get multiple values at 1 go.

thanks

vivekanand

Former Member
0 Kudos

About Vivekanand's suggestion, can you give me the code example?

Former Member
0 Kudos

Vivekanand's suggestion is from regular ABAP, not SAPscript. The TABLES option is not available in the SAPscript version of PERFORM.

/: PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

/: CHANGING &OUTVAR2&

......

/: ENDPERFORM

And even if you could return a table from this PERFORM the SAPscript would not be able to loop around it.

Regards,

Nick

Former Member
0 Kudos

I also have the same situation of getting one entry always instead of multiple entries for vendor number in the output sap script form. This is my code in the form routine in driver program.

LOOP AT it_suz.

SELECT SINGLE name1 INTO l_name1 FROM lfa1

WHERE lifnr = l_mfrnr.

READ TABLE out_tab WITH KEY 'JO_MAN'.

out_tab-value = l_name1.

APPEND out_tab.

CLEAR l_mfrnr.

CLEAR l_name1.

ENDLOOP.

JO_MAN is the output variable in form &JO_MAN&

I am always getting the same JO_MAN value (Vendor number) for multiple entries in the LFA1 table for LIFNR in the output form. which is the last one in the out_tab-value. How to loop through and get all the values in the out_tab-value and form output

Thanks

former_member196280
Active Contributor
0 Kudos

Try to loop your window in the driver program... to display all values in the table..

Ex:

LOOP <internal table>

WRITE_FORM............

ENDLOOP.

Note: Perform Statement, used mostly to get the values when your driver program is not in your control.. it is not used to display group of all line items(if it is not looped in driver program)... in such case to display group of line items which are not controlled in your dirver program..good to customize your driver/print program

regards,

SaiRam