cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass internal table to a form(sap script)

Former Member
0 Kudos

Hi,

I want to know how can I pass internal table to a sapscript. I have added my piece of code in the driver program and I want this to be displayed in the output.

code in the driver program:

FORM get_data

my select statements and internal table declarations(it_output)

CALL FUNCTION 'OPEN_FORM'

EXPORTING

form = 'ZFORM'.

loop at it_output.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'ITEM'

WINDOW = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

ENDFORM. "get_data

I want to know how can I access the surbroutine GET_DATA from my Sap Script(ZFORM). any examples will be greatly appreciated

Thanks for your help!

siddu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I think you have the relationship between the SAPScript and the driver program a little mixed up --> you start the driver program and its purpose is to gather the relevant data, call the "OPEN_FORM" once, then call "WRITE_FORM" as many times as is necessary to fill in the values on the form, and then "CLOSE_FORM". Therefore the "get_data" subroutine you mentioned will have to be called from within the driver program, not from the SAPScript.

Jonathan

Former Member
0 Kudos

use loop at itab.

and then call function 'WRITE_FORM'

ELEMENT = ' '(NAME OF ELEMENT DECLARED IN MAIN WINDOW)

WINDOW = 'MAIN'.

iN SAPSCRIPT JUST

*(PARAGRAPH FORMAT YOU DEFINED) &ITAB-A(20)& ,, &ITAB-B+25(6)&

USE AMPERSAND FOR VARIABLES.

IF YOU WANT TO CALL SUBROUTINE FROM MAIN WINDOW

/: PERFORM GET_DATA IN PROGRAM ABC(PROGRAM WHERE SUBROUTINE GET_DATA EXISTS) ITCSY structure ITCSY OUTTAB STRUCTURE ITCSY

/:USING &VAR1&

/:USING &VAR2&( EXPORT VARIABLES TO BE PASSED TO SUBROUTINE)

/: CHANGING &VAR3&

/: CHANGING &VAR4& ( IMPORT VARIABLES TO BE PASSED FROM SUBROUTINE TO PROGRAM )

/: ENDPERFORM

in subroutine you have to write

form get_data structurE INTTAB STRUCTURE ITCSY OUTTAB STRUCTURE ITCSY.

DO SOMETHING.

ENDFORM