‎2008 Aug 19 7:34 PM
Hello,
I am passing an internal table to an external sub-routine using the statement
PERFORM import_if
IN PROGRAM zrpcetmx0 USING display_table-pernr
seqnr_table-seqnr
fldid
CHANGING zl_table.I declared the internal table like this in the main program
DATA zl_table TYPE zl_struc OCCURS 0 WITH HEADER LINE.When I am trying to append the internal table zl_table in the sub-routine 'import_if' in the program ZRPCETMX0, it is giving a syntax error as ' "ZL_TABLE" is not an internal table'.
Please help me. As I see it, zl_table is an internal table right !
‎2008 Aug 19 7:42 PM
PERFORM import_if
IN PROGRAM zrpcetmx0 USING display_table-pernr
seqnr_table-seqnr
fldid
CHANGING zl_table[]. "use Body , it is taking header only
‎2008 Aug 19 7:42 PM
PERFORM import_if
IN PROGRAM zrpcetmx0 USING display_table-pernr
seqnr_table-seqnr
fldid
CHANGING zl_table[]. "use Body , it is taking header only
‎2008 Aug 19 8:00 PM
when I am trying to pass the internal table with body zl_table[] as you said, the following syntax error is showing up.
"In unicode programs, the following characters cannot appear in names, as it does here in the name zl_table[]"
any other way to this perform ..
my friend suggests giving it as
PERFORM import_if
IN PROGRAM zrpcetmx9
USING display_table-pernr
seqnr_table-seqnr
fldid CHANGING zl_table structure zl_struc. I could not get that correct for the "structure zl_struc" part.
Thx in advance.
‎2008 Aug 19 8:13 PM
this is working for me..
REPORT ZTEST_FORMTEST.
data: it_flight like TABLE OF sflight with HEADER LINE,
wa_flight type sflight.
PERFORM test_form inprogram ZTEST_FORMTEST2 USING wa_flight
CHANGING it_flight[].
check it once from your end..
REPORT ZTEST_FORMTEST2.
form test_form USING wa_flight type sflight
CHANGING flight type sflight_tab1.
endform.
‎2008 Aug 19 9:54 PM
hello vijay,
I did change and see in the sub-routine (form)
FORM import_if
USING $pernr
$seqnr
$fldid
$wa_ztab TYPE zl_struc
CHANGING zl_table TYPE zl_struc.but the syntax error is ' The type "zl_struc" is unknown'.
Do I have to declare the structure in the sub-routine as well?
Also you in your example gave the sub-routine a different structure in the changing part, was that intentional?
form test_form USING wa_flight type sflight
CHANGING flight type sflight_tab1.
the above one, we did not use sflight_tab1 structure anywhere right?
the code in the main program is like this
PERFORM import_if
IN PROGRAM zrpcetmx9 USING display_table-pernr
seqnr_table-seqnr
fldid
wa_ztab
changing zl_table[].
Thanks a lot for your help vijay .. once again
‎2008 Aug 19 10:10 PM
FORM import_if
USING $pernr
$seqnr
$fldid
$wa_ztab TYPE zl_struc
CHANGING zl_table TYPE zl_t_struc. "<------this should be table typezl_t_struc should be table type, which can be exists in side the program or Global dictionary level se11 also.
you can also do this...this works inyour case
PERFORM import_if
IN PROGRAM zrpcetmx9 USING display_table-pernr
seqnr_table-seqnr
fldid
wa_ztab
changing zl_table[].FORM import_if
USING $pernr
$seqnr
$fldid
$wa_ztab TYPE zl_struc
CHANGING zl_table TYPE type standard table.
‎2008 Aug 19 10:54 PM
Hi,
i think you are sending table structure which is not available globally then it should have some reference in called program
lets try this piece of code, u will understool
calling program
REPORT ZTEST_1.
data: begin of itab occurs 0,
line(10).
data end of itab.
itab-line = '1'.
append itab.
perform imp_sub in program ZTEST_2 TABLES itab.
REPORT ZTEST_2.
data: begin of itab1 occurs 0,
line(10).
data: end of itab1.
data w_line(10).
form imp_sub TABLES ITAB2 STRUCTURE ITAB1.
LOOP AT ITAB2 INTO W_LINE.
WRITE:/ W_LINE.
ENDLOOP.
endform.
this is how it works, no need to create any structure globally. Hope you got.
regards,
Vijay Kumar T (Yash Technologies )
Edited by: vijay thirumareddi on Aug 19, 2008 11:54 PM
‎2008 Aug 19 7:43 PM
TABLES declared with the OCCURS 0 must be the in the first place in the parameters of the subroutine.
Like:
PERFORM import_if
IN PROGRAM zrpcetmx0
TABLES Z_Itable "<<
USING display_table-pernr
seqnr_table-seqnr
fldid.
Subroutine must be:
FORM import_if.
TABLES Z_Itable "<<
USING display_table-pernr
seqnr_table-seqnr
fldid.
ENDFORM.
Regards,
Naimesh Patel