cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSCRIPT : How to pass Internal table into the MAIN Window

Former Member
0 Kudos

Hi ,

I need to pass an internal table into the MAIN Window of a SAPSCRIPT that is used for invoice check printing.

I have created a subroutine to fetch the data for line items but not getting how to pass that table into the window,like we pass text symbols to/from the Script window to the subroutine of a subroutine pool.

Any hints greatly appreciated.

Regards,

Sandip.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member585060
Active Contributor
0 Kudos

Hi,

If the fields in the internal table are few, just declare them using DEFINE statement in FORM and use PERORM statement to fetch the data from the subroutine,

SAPScript Text editor

/: DEFINE &DDDD& = 'ZZZZZZZZ'

/: DEFINE &EEEE& = 'ZZZZZZZZ'

/: DEFINE &FFFF& = 'ZZZZZZZZ'

/: DEFINE &GGGG& = 'ZZZZZZZZ'

/: DEFINE &HHHH& = 'ZZZZZZZZ'

/: PERFORM GET_COMCODE IN PROGRAM ZQCJPERFO

/: USING &ABCD&

/: CHANGING &DDDD&

/: CHANGING &EEEE&

/: CHANGING &FFFF&

/: CHANGING &GGGG&

/: CHANGING &HHHH&

/: ENDPERFORM

P1 &DDDD&,,&EEEE&,,&FFFF&,,&GGGG&,,&HHHH&

Subroutine Program

FORM get_comcode TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

READ TABLE in_tab INDEX 1.

w_bukrs = in_tab-value.

SELECT butxt

rcomp

land1 FROM t001 INTO (w_name1, w_rcomp, w_land1)

WHERE bukrs = w_bukrs.

SELECT SINGLE stret

pstlc

city FROM t880 INTO (w_stret, w_pstlc, w_city)

WHERE rcomp = w_rcomp.

SELECT SINGLE landx FROM t005t INTO w_landx

WHERE land1 = w_land1

AND spras = w_spras.

ENDSELECT.

READ TABLE out_tab INDEX 1.

MOVE w_name1 TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 2.

MOVE w_stret TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 3.

MOVE w_city TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 4.

MOVE w_pstlc TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

READ TABLE out_tab INDEX 5.

MOVE w_landx TO out_tab-value.

MODIFY out_tab INDEX sy-tabix.

ENDFORM. "get_comcode

Regards

Bala Krishna

Edited by: Bala Krishna on Nov 11, 2008 10:19 PM

Former Member
0 Kudos

Hi,

Declare internal table in global definition,

call the write_form function and use the Text element to pass the itab to main window.

this is like passing any other information to any secondaywindow. let me know if u have any more doubts on it

Tirumal.

Former Member
0 Kudos

Actually mine was a standard program.So I cannot declare anything there.

Any other ways to do it ? Inside the sapscript ?

Regards,

Sandip.

Former Member
0 Kudos

Hi,

In case of standard program you can not actually pass the internal table,but if you require to do that you need to go through the User Exits.