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

TABLES

Former Member
0 Likes
480

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
453

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

2 REPLIES 2
Read only

Former Member
0 Likes
454

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

Read only

Former Member
0 Likes
453

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