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: 

To create subroutine with variable table type

Former Member
0 Kudos

I am using the FM ' REUSE_ALV_BLOCK_LIST_APPEND ' in my requirement . This FM is supposed to be called many times. So, to avoid redundancy of code, I want to use a subroutine passing the few tables and a field.

However, I am facing problem passing the data table which will always have different structure .

I am writing my part of code below :

PERFORM reuse_alv_block_list_append

TABLES

it_fieldcat[]

it_events[]

it_final_data[]

USING

c_it_header_date .

FORM reuse_alv_block_list_append

TABLES

p_fieldcat TYPE slis_t_fieldcat_alv

p_events TYPE slis_t_event

p_data_table TYPE table <<----


I am not able to find what type should I pass here ?

USING

p_tabname TYPE slis_tabname

endform. " REUSE_ALV_BLOCK_LIST_APPEND

Please help,

Regards,

Nibha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Priya,

FORM reuse_alv_block_list_append

TABLES

p_fieldcat TYPE slis_t_fieldcat_alv

p_events TYPE slis_t_event

*p_data_table "JUST DONT SPECIFY ANY TYPE AGAINST THIS"*

USING

p_tabname TYPE slis_tabname

endform. " REUSE_ALV_BLOCK_LIST_APPEND

Hope thi smay work

6 REPLIES 6

Former Member
0 Kudos

Hi,

PERFORM reuse_alv_block_list_append

TABLES

it_fieldcat[]

it_events[]

it_final_data[]

USING

c_it_header_date .

FORM reuse_alv_block_list_append

TABLES

p_fieldcat LIKE it_fieldcat

p_events LIKE it_events

p_data_table LIKE it_final_data <<----


I am not able to find what type should I pass here ?

USING

p_tabname TYPE slis_tabname

Use LIKE Table, it resolves ur problem

Rgds,

Pavan

Former Member
0 Kudos

Hi Priya,

FORM reuse_alv_block_list_append

TABLES

p_fieldcat TYPE slis_t_fieldcat_alv

p_events TYPE slis_t_event

*p_data_table "JUST DONT SPECIFY ANY TYPE AGAINST THIS"*

USING

p_tabname TYPE slis_tabname

endform. " REUSE_ALV_BLOCK_LIST_APPEND

Hope thi smay work

Former Member
0 Kudos

Hi priya

you need not mention the table type in the form.

form abc tables it_a using xyz type c.

Regards

Renu

0 Kudos

But I am getting an error that ' number of formal parameters : 5 and number of actual parameters : 4 ' .

why is this coming ?

0 Kudos

HI,

Try this way..

FORM reuse_alv_block_list_append
TABLES  p_fieldcat STRUCTURE slis_fieldcat_alv
              p_events STRUCTURE slis_alv_event
              p_data_table TYPE table 
USING    p_tabname TYPE slis_tabname

endform. " REUSE_ALV_BLOCK_LIST_APPEND

Former Member
0 Kudos

HI,

What you have declared is right

>>> At runtime p_innnn copies the defination from the actual patametes passed in the PERFROM Statement
FORM rh_read_infty_data  TABLES p_innnn TYPE table 
                                                    p_object STRUCTURE hrobject.
ENDFORM.