02-21-2014 7:01 AM
I want to pass an internal table into a subroutine. But I have been told that the tables statement is obsolete so I shouldn't use that.
So I have to use 'USING' /CHANGING' but then if we use using or changing ,we cannot declare using custom structure with type.
We have to use like which is again obsolete.
Please help.
Regards,
Faiz
02-21-2014 7:09 AM
Hi,
1. Declare your structure, table globally using the statement : TYPES
2. Call you form using statement USING or CHANGING without passing the header line. If you still declare your table with header line you could put [] at the end of the table name.
IT_DATA[] means only the table without the header line.
3. In your form you just have to specify the type of the table corresponding to the type you have declare in the first step.
TYPES : begin of ts_data ,
one(1) ,
two(1) ,
end of ts_data ,
tt_data type table of ts_data.
form p_one.
data : it_data type tt_data.
perform p_apple using it_data.
endform.
form p_apple using lt_data type tt_data.
end
regards
Fred
02-21-2014 7:39 AM
Hi Fred,
This is how I have declared
types: begin of gty_output,
.........
end of gty_output.
data:gt_output type standard table of gty_output.
In the form
FORM get_tax_code USING pt_tab TYPE gt_output.
But still its not working
02-21-2014 7:41 AM
Even tried
FORM get_tax_code USING pt_tab TYPE STANDARD TABLE gty_output.
still getting error
02-21-2014 7:42 AM
02-21-2014 7:44 AM
types: begin of gty_output,
.........
end of gty_output,
gtt_output type table of gty_output.
data:gt_output type gtt_output.
In the form
FORM get_tax_code USING pt_tab TYPE gtt_output.
02-21-2014 7:45 AM
Change it like this
types: begin of gty_output,
.........
end of gty_output,
tt_output TYPE STANDARD TABLE of ty_output.
In the form
FORM get_tax_code USING pt_tab TYPE tt_output
Now it should work
Thanks, Abhinab
02-21-2014 7:47 AM
You need to explicitly define the table type :
TYPES: BEGIN OF gty_output,
"....
END OF gty_output,
gtty_output TYPE STANDARD TABLE OF gty_output.
DATA: gt_output TYPE gtty_output.
PERFORM get_tax_code USING gt_output.
*&---------------------------------------------------------------------*
*& Form get_tax_code
*&---------------------------------------------------------------------*
FORM get_tax_code USING pt_tab TYPE gtty_output.
"...
ENDFORM. "get_tax_code
Regards,
Raymond