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

Mapping Fields from table1 to Table2

Former Member
0 Likes
467

hi guys,

First of all, I don't have not much experience in ABAP Coding. But i hope with your help, i solve my problem.

I have a table..

SOURCE_PACKAGE:

Order (key) | item (key) | bonus | skonto | tax

100_______10______

100_______20______

200_______10______

Bonus, skonto, tax are condition types. These fields are at the beginning empty.

There is another table

BIC/AZDSO_ACN00:

Order (key) | item (key) | condition_type (key) | condition_value

100________10_______u2019bonusu2019_____________150

100________10_______u2019skontou2019_______ _____250

100________20_______u2019bonusu2019_____________100

200________10_______u2019taxu2019__________ _____100

Now, for all Order (key) & item (key) of SOURCE_PACKAGE, I want read the corresponding condition_value from the BIC/AZDSO_ACN00 into the fields bonus, skonto, tax of SOURCE_PACKAGE.

For all Order (key) & item (key) from SOURCE_PACKAGE there is at least one of the condition types or more.

The result should be:

SOURCE_PACKAGE:

Order (key) | item (key) | bonus | skonto | tax

100_______10________150___250_____empty

100_______20________100___empty___empty

200_______10________empty_empty___100

My first Step was, to read the active table 2 into an internal table:

DATA:it_docu_condition TYPE TABLE OF /BIC/AZDSO_ACN00,

wa_docu_condition LIKE LINE OF it_docu_condition.

select * from /BIC/AZDSO_ACN00 into table it_docu_condition
      FOR ALL ENTRIES IN SOURCE_PACKAGE
      WHERE DOC_NUMBER eq SOURCE_PACKAGE-DOC_NUMBER
        AND S_ORD_ITEM eq SOURCE_PACKAGE-S_ORD_ITEM
        AND ( condition_type = 'skonto' OR
              condition_type = 'bonus' OR
              condition_type = 'tax' ).

Now, i donu2019t know, how i can map this condition types into the fields of SOURCE_PACKAGE.

Thanx for help.

caro

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
428

Hi,

Try something like this. I could not try it in my system, if there are some error let me know.

FIELD-SYMBOLS 
     : <SOURCE_PACKAGE> LIKE LINE OF SOURCE_PACKAGE.

LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_PACKAGE>.

LOOP AT it_docu_condition into wa_docu_condition
               where Order = <SOURCE_PACKAGE>-Order  and
                        item   = <SOURCE_PACKAGE>-item.

CASE wa_docu_condition-condition_type.

when u2019bonusu2019.
<SOURCE_PACKAGE>-bonus = wa_docu_condition-condition_value.
when u2019skontou2019.
<SOURCE_PACKAGE>-skonto = wa_docu_condition-condition_value.
when u2019taxu2019.
<SOURCE_PACKAGE>-tax = wa_docu_condition-condition_value.
ENDCASE.

ENDLOOP.

Regards

2 REPLIES 2
Read only

Former Member
0 Likes
429

Hi,

Try something like this. I could not try it in my system, if there are some error let me know.

FIELD-SYMBOLS 
     : <SOURCE_PACKAGE> LIKE LINE OF SOURCE_PACKAGE.

LOOP AT SOURCE_PACKAGE ASSIGNING <SOURCE_PACKAGE>.

LOOP AT it_docu_condition into wa_docu_condition
               where Order = <SOURCE_PACKAGE>-Order  and
                        item   = <SOURCE_PACKAGE>-item.

CASE wa_docu_condition-condition_type.

when u2019bonusu2019.
<SOURCE_PACKAGE>-bonus = wa_docu_condition-condition_value.
when u2019skontou2019.
<SOURCE_PACKAGE>-skonto = wa_docu_condition-condition_value.
when u2019taxu2019.
<SOURCE_PACKAGE>-tax = wa_docu_condition-condition_value.
ENDCASE.

ENDLOOP.

Regards

Read only

0 Likes
428

hello,

thanx.. it works !!!

regards,

Caro