on 11-07-2008 1:07 PM
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.