‎2006 May 20 9:12 AM
hi!
I'm doing a bapi which is similar on this table below. How will I start using the select statement? Can you help on this. Thanks!
SAMPLE
REF TABLE:
TRANS TABLE X
f1 | f2 | f3 | f4
A | 1 | |
B | 1 | 2 |
C | 1 | 2 | 3
TARGET TABLE:
FUNCTION MOD TABLE Y
f1 | f2
A | 1
B | 1
B | 2
C | 1
C | 2
C | 3
‎2006 May 20 9:25 AM
Hi,
Try this logic.
LOOP AT ITAB1.
ITAB2-F1 = ITAB1-F1.
IF NOT ITAB1-F2 IS INTIAL.
ITAB2-F2 = ITAB2-F2.
APPEND ITAB2.
ENDIF.
IF NOT ITAB1-F3 IS INTIAL.
ITAB2-F2 = ITAB2-F3.
APPEND ITAB2.
ENDIF.
IF NOT ITAB1-F4 IS INTIAL.
ITAB2-F2 = ITAB2-F4.
APPEND ITAB2.
ENDIF.
CLEAR ITAB2.
ENDLOOP.
Regards
Ravi
Note : Please mark all the helpful answers
‎2006 May 20 9:25 AM
Hi,
Try this logic.
LOOP AT ITAB1.
ITAB2-F1 = ITAB1-F1.
IF NOT ITAB1-F2 IS INTIAL.
ITAB2-F2 = ITAB2-F2.
APPEND ITAB2.
ENDIF.
IF NOT ITAB1-F3 IS INTIAL.
ITAB2-F2 = ITAB2-F3.
APPEND ITAB2.
ENDIF.
IF NOT ITAB1-F4 IS INTIAL.
ITAB2-F2 = ITAB2-F4.
APPEND ITAB2.
ENDIF.
CLEAR ITAB2.
ENDLOOP.
Regards
Ravi
Note : Please mark all the helpful answers
‎2006 May 20 9:31 AM
hi maui ,
define int_tab1 type ref tab
select from ref tab to int tab1 for all values
define int tab2 of type function mod table y
loop at int_tab1.
if int_tab-f2 is not initial.
int_tab2-f1 = int_tab1-f1
int_tab-f2 = int_tab1-f2
append int_tab2.
endif.
if int_tab-f3 is not initial.
int_tab2-f1 = int_tab1-f1
int_tab-f2 = int_tab1-f3
append int_tab2.
endif.
if int_tab-f4 is not initial.
int_tab2-f1 = int_tab1-f1
int_tab-f2 = int_tab1-f4
append int_tab2.
endif.
and so on
endloop