2006 Nov 30 6:24 PM
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.
2006 Nov 30 6:30 PM
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.
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.
2006 Nov 30 6:30 PM
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.
2006 Nov 30 6:52 PM
It gives me a sintax error, because it says that the tab1 has no estructure, so i can´t call value
regards
2006 Nov 30 7:02 PM
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.
2006 Dec 01 11:43 AM
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
2006 Dec 01 11:53 AM
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
2006 Nov 30 7:05 PM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |