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

Internal Tables

Former Member
0 Likes
698

Hi Everyone,

I am new to the abap. Regarding these questions have a doubt pls let me know completely.

1) Have a 2 internal tables say itab1 and itab2, those having a one field.

My query is to pass the common records to 3rd internal table say final?

2) say 2 internal tables itab1 and itab2. Itab1 having 4 fields say f1,f2,f3,f4 and first two fields f1,f2 have

data and another itab2 having 3 fields f1,f3,f4 and last two fields have a data such as f3,f4.

I need to move the itab2 data to itab1 such as itab2-f3,itab2-f4 to itab1-f3,itab1-f4.

2) Difference between stock transport order and sales order?

Could u please anyone for the above...

Thanks&regards,

Rahul

Hi Everyone,

I am new to the abap. Regarding these questions have a doubt pls let me know completely.

1) Have a 2 internal tables say itab1 and itab2, those having a one field.

My query is to pass the common records to 3rd internal table say final?

2) say 2 internal tables itab1 and itab2. Itab1 having 4 fields say f1,f2,f3,f4 and first two fields f1,f2 have

data and another itab2 having 3 fields f1,f3,f4 and last two fields have a data such as f3,f4.

I need to move the itab2 data to itab1 such as itab2-f3,itab2-f4 to itab1-f3,itab1-f4.

2) Difference between stock transport order and sales order?

Could u please anyone for the above...

Thanks&regards,

Rahul

5 REPLIES 5
Read only

Former Member
0 Likes
670

HI,

Check this code

Loop at itab1.
g_index = sy-tabix.
clear itab2.
read table itab2 with key f1 = itab1-f1.
if sy-aubrc eq 0.
itab1-f3 = itab2-f3.
itab1-f4 = itab2-f4.
Modify itab1 index g_index.
endif.
Endloop.

Edited by: Avinash Kodarapu on Jan 24, 2009 8:13 AM

Read only

Former Member
0 Likes
670

Hai,

loop at itab1.

read table itab2 with key f1 = itab1-f1 binary search.

if sy-subrc eq 0.

itab1-f3 = itab2-f3.

itab1-f4 = itab2-f4.

endif.

endloop.

interrelationship between Stock transport order and sales order :

Stock transport order acts as purchase order for the receiving plant

whereas it acts as a sales order for supplying plant. It contains the

shipping information in the purchase order itself.

i hope it will work out for you.

With Regards,

R.Dhineshraj.

Edited by: dhinesh raj on Jan 24, 2009 5:27 AM

Read only

Former Member
0 Likes
670

hi,

1.

for example if ur itab1 itab2 is as follows

itab1

f1 f2

x x

y y

z z

itab2

f1 f2

y y

z z

a a

loop at itab1.

loop at itab2.

if itab1-f1 eq itab2-f1.

if itab2-f2 eq itab2-f2.

final-f1 = itab1-f1.

final-f2 = itab1-f2.

exit.

endif.

endif.

endloop.

endloop.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
670

Hi Rahul,

Use this code to populated itab3 using itab1 and itab2.

Say you have:-

internal_table , work_area

itab1, wa1 ;

itab2 , wa2 ;

itab3 , wa3.


loop at itab1 into wa1.
  wa3-f1 = wa1-f1.
  wa3-f2 = wa1-f2.
  read table itab2 into wa2 with key f1 = wa1-f1. "read itab2
  if sy-subrc eq 0. "if record found
    wa3-f3 = wa2-f3.
    wa3-f4 = wa2-f4.
  endif.
  append wa3 to itab3. "append into itab3
  clear wa3. "clear work_area
  clear wa2. "clear work_area
  clear wa1. "clear work_area
endloop.

Hope this solves you problem.

Thanks & Regards,

Tarun Gambhir

Read only

faisalatsap
Active Contributor
0 Likes
670

Hi, Rahul

Test the following code, hope will help you to solve your problem,

TYPES: BEGIN OF t_it,
  name(10),
  sale TYPE p DECIMALS 0,
  END OF t_it.

DATA: it1 TYPE STANDARD TABLE OF t_it WITH HEADER LINE,
      it2 TYPE STANDARD TABLE OF t_it WITH HEADER LINE,
      it3 TYPE STANDARD TABLE OF t_it WITH HEADER LINE.

it1-name = 'F1'.
it1-sale = 10.
APPEND it1 TO it1.
it1-name = 'F2'.
it1-sale = 10.
APPEND it1 TO it1.
it1-name = 'F3'.
it1-sale = 10.
APPEND it1 TO it1.
it1-name = 'F4'.
it1-sale = 10.
APPEND it1 TO it1.

it2-name = 'F1'.
it2-sale = 10.
APPEND it2 TO it2.
it2-name = 'F2'.
it2-sale = 10.
APPEND it2 TO it2.
it2-name = 'F3'.
it2-sale = 10.
APPEND it2 TO it2.

LOOP AT it1 INTO it1.
  READ TABLE it2 INTO it2 WITH KEY name = it1-name.
  IF sy-subrc = 0.
    APPEND it2 TO it3.
  ENDIF.
ENDLOOP.

Please Reply if any Issue,

Kind Regards,

Faisal