‎2007 Nov 04 4:48 AM
Hi abapers,
I want to know the difference between statements.
SELECT MATNR MAKTX FROM MAKT INTO TABLE IT_MAKT.
SELECT EBELN EBELP ... ..... ..... FROM EKPO INTO IT_EKPO WHERE MATNR = IT_MAKT-MATNR.
1st statement
LOOP AT IT_MAKT INTO WA_MAKT.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY MATNR = IT_MAKT-MATNR.
2ND Statement
LOOP AT IT_EKPO INTO WA_EKPO.
READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = IT_EKPO-MATNR.
Frnds , can anyone please help me to understand the exact difference between the above statements.
Thanks,
satish
‎2007 Nov 04 5:15 AM
Hi,
SELECT MATNR MAKTX FROM MAKT INTO TABLE IT_MAKT.
collects matnr and maktx form makt and stores in it_makt
SELECT EBELN EBELP ... ..... ..... FROM EKPO INTO IT_EKPO WHERE MATNR = IT_MAKT-MATNR.
endselect.
selects ebeln and ebelp from ekpo and stores in it_ekpo
1st statement
LOOP AT IT_MAKT INTO WA_MAKT.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY MATNR = IT_MAKT-MATNR.
endloop.
looping at it_makt compares matnr from it_makt with it_ekpo. reads and stores in work area wa_makt with primary key as index
2ND Statement
LOOP AT IT_EKPO INTO WA_EKPO.
READ TABLE IT_MAKT INTO WA_MAKT WITH KEY MATNR = IT_EKPO-MATNR.
endloop.
looping at it_ekpo compares matnr from it_makt with it_ekpo . reads and stores in work area wa_ekpo with primary key as index
regards
‎2007 Nov 04 5:42 AM
hi satish,
Both the statements results the same.
Basic difference is u r looping at different tables.........
In the first loop, u r selecting the Material Description based on Purchase Order Material.
In the second Loop, u r selecting the PO based on if its Material description is available or not...
Basically both loop statements results in same.
Reward me if useful..........
Harimanjesh AN
‎2007 Nov 05 7:34 AM
Hi,
Both the statements will yield the same results.
I think should be this way....
1st statement
<b>LOOP AT IT_MAKT INTO WA_MAKT.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY MATNR = wa_MAKT-MATNR.</b>
<u>NOT</u>
1st statement
LOOP AT IT_MAKT INTO WA_MAKT.
READ TABLE IT_EKPO INTO WA_EKPO WITH KEY MATNR = IT_MAKT-MATNR.
Similarly for the same other statement also.
1.You are looping the MAKT table into workarea
2. And the reading the EKPO table into workarea with the key field.
Here both the statements infer same meaning.
Regards,
Vani.