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: 

Generic type in perform

Former Member
0 Kudos

I have 3 different types of ranges in a program, and i want to create a perform for append 1 in all of them, when i make the declarations i don´t put the type of the range, so i can pass it, but i can´t use the fields of the table.

is there any way of doing it?

Thanks in advance

Example simple:

ranges day for sy-datum.

ranges money for bseg-waers.

ranges price for bseg-kbetr.

perform ap1 tables day.

form ap1 tables tab1.

tab1-low = 1.

append tab1.

endform.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

ranges day for sy-datum.

ranges money for bseg-waers.

ranges price for bseg-kbetr.

perform ap1 tables day.

perform ap1 tables money.

perform ap1 tables price.

form ap1 tables tab1.

loop at tab1.

tab2-low = tab1-value.

append tab2.

endloop.

endform.

6 REPLIES 6

Former Member
0 Kudos

ranges day for sy-datum.

ranges money for bseg-waers.

ranges price for bseg-kbetr.

perform ap1 tables day.

perform ap1 tables money.

perform ap1 tables price.

form ap1 tables tab1.

loop at tab1.

tab2-low = tab1-value.

append tab2.

endloop.

endform.

0 Kudos

It gives me a sintax error, because it says that the tab1 has no estructure, so i can´t call value

regards

0 Kudos

Hi try this:

form xxx tables tab.

field-symbols: <fs_line>,

<fs_field>.

data: v_line type ref to data.

create data v_line like line of tab.

assign v_line->* to <fs_line>.

assign component 'LOW' of structure <fs_line> to <fs_field>.

if sy-subrc eq 0.

<fs_field> = '1'.

append v_line->* to tab.

endif.

endform.

0 Kudos

I think that it is a good idea to use field-symbols, but it gives me a syntax error, in

"append v_line->* to tab."

but i think that probably i will be able to use it for append and for read.

Thanks in advance

0 Kudos

Hi

It has to be: append <fs_line> to tab.

Anyway you can use only the field-symbols:

ranges day for sy-datum.
ranges money for bseg-waers.
ranges price for bseg-kbetr.

perform fill_range using: 'DAY',
                                   'MONEY',
                                   PRICE'.

FORM FILL_RANGE USING RANGE.
   DATA: RANGE_TAB(15) VALUE '&[]'.
   FIELD-SYMBOLS: <TRANGE> TYPE TABLE,
                               <W_RANGE> TYPE ANY, 
                               <VALUE>       TYPE ANY.


   REPLACE '&' WITH RANGE INTO RANGE_TAB.

   ASSIGN (RANGE_TAB) TO <TRANGE>.
   ASSIGN (RANGE)         TO <W_RANGE>.

   <W_RANGE>(3) = 'IEQ'.

   ASSIGN COMPONENT 'LOW' OF STRUCTURE <W_RANGE> TO <VALUE>.
  <VALUE> = '1'.
  APPEND <VALUE> TO <TRANGE>.

ENDFORM.

max

Former Member
0 Kudos

The reason is <b> STRUCTURE < STRUCTURE ></b> is missing.

perform ap1 tables day.

form ap1 tables tab1 <b>STRUCTURE < STRUCTURE >.</b>

tab1-low = 1.

append tab1.

endform.

whenever the internal table is passed the structure must be specified in the FORM section.

Regards

Kathirvel