Application Development and Automation 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: 
Read only

passing args to routine

Former Member
0 Likes
547

Hi,

this is my problem: I want to set the length of data in a subroutine according to a parameter passed as argument:

FORM string2table TABLES   table
                  USING    line_length
                  CHANGING string.
  " conversion

  " working area
  DATA table_line(line_length) TYPE c.
  ...
ENDFORM

but I get an error about the declaration of data: I want to use this function for creating table of any length of line. Is impossible to have something like this?

thanks

Gabriele

Hi,

this is my problem: I want to set the length of data in a subroutine according to a parameter passed as argument:

FORM string2table TABLES   table
                  USING    line_length
                  CHANGING string.
  " conversion

  " working area
  DATA table_line(line_length) TYPE c.
  ...
ENDFORM

but I get an error about the declaration of data: I want to use this function for creating table of any length of line. Is impossible to have something like this?

thanks

Gabriele

3 REPLIES 3
Read only

Former Member
0 Likes
518

Hello,

Try in this way it will work.

Field-symbols: <table_line> type ANY

FORM string2table TABLES table

USING line_length

CHANGING string.

" conversion

" working area

  • DATA table_line(line_length) TYPE c.

Assign line_length to <table_line>.

Now the field symbol will take the lenght of the line_length.

...

ENDFORM

Read only

Former Member
0 Likes
518

Hi you can try this

FORM string2table TABLES table TYPE ANY

USING line_length TYPE ANY

CHANGING string TYPE ANY.

" conversion

" working area

DATA table_line(line_length) TYPE c.

...

ENDFORM

Read only

Former Member
0 Likes
518

thanks ... you put me on the correct way for the answer. This is is how I solved:

FORM string2table TABLES   table
                  USING    line_length
                  CHANGING string.

  " line of the table
  FIELD-SYMBOLS: <table_line> TYPE ANY.
  
  " get type of line
  DATA ref_wa TYPE REF TO data.
  CREATE DATA ref_wa LIKE LINE OF table.
  ASSIGN ref_wa->* TO <table_line>.

...
ENDFORM.

Edited by: Gabriele Montori on Nov 7, 2008 10:02 AM