Skip to Content
0
Former Member
Aug 11, 2007 at 06:34 AM

addition

13 Views

Hi to all experts(urgent).

I have a itab1

Doc no tax code amt

-


-


-


1 10 600

1 11 200

2 10 300

Itab2

Doc no tax code amt

-


-


-


1 10 100

1 12 400

2 10 300

I want to add both table.

But first preference is first table

Output in this way

Doc no tax code amt

-


-


-


1 10 600 -


from itab1

1 11 200-----from itab1

1 12 400----from itab2

2 10 300----from itab2

i.e. if itab1-doc no and tax code is same to itab2- doc no and tax code

then leave itab2 data. If it is not same then accept.

According to my logic.

Loop at itab1.

Move itab1-doc no, tax code , amt to itab3-doc no, tax code, amt.

Append itab3.

Read table itab2 with key doc no = itab1-doc no

Tax code = itab1-tax code.

If sy-subrc ne 0.

Move itab2-doc no, tax code, amt to itab3-doc no, tax code, amt.

Append itab3.

Endloop.

Is this correct. If some thing wrong solve it .

Thanks in advance and reward also.

Regard : deep