Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to pass internal table to subroutine without TABLES and LIKE

former_member215563
Active Participant
0 Kudos


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

7 REPLIES 7

FredericGirod
Active Contributor
0 Kudos

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

0 Kudos

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


0 Kudos

Even tried

FORM get_tax_code USING pt_tab TYPE STANDARD TABLE gty_output.

still getting error

0 Kudos

Why do you say it's not working ?

0 Kudos

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.




0 Kudos

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

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