12-21-2006 9:54 AM
Hi i have a problem in using <b>for all entries</b>
i have declared the two internal tables as below
DATA: BEGIN OF ITAB OCCURS 10,
EBELN LIKE EKKO-EBELN,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
* MATNR LIKE EKPO-MATNR,
* TXZ01 LIKE EKPO-TXZ01,
VGABE LIKE EKBE-VGABE,
GJAHR LIKE EKBE-GJAHR,
KNUMV LIKE EKKO-KNUMV,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 10,
EBELN LIKE EKPO-EBELN,
MATNR LIKE EKPO-MATNR,
TXZ01 LIKE EKPO-TXZ01,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
MENGE LIKE EKPO-MENGE,
MWSKZ LIKE EKPO-MWSKZ,
LIFNR LIKE EKKO-LIFNR,
EBELP LIKE EKBE-EBELP,
BELNR LIKE EKBE-BELNR,
END OF ITAB1.
<b>and now i have tried to move the values in those internal tables using these statements</b>
SELECT A~EBELN A~LIFNR A~KNUMV B~VGABE B~EBELP B~GJAHR B~BELNR
FROM EKKO AS A
INNER JOIN EKBE AS B ON B~EBELN = A~EBELN
INTO CORRESPONDING
FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
SELECT EKPO~EBELN EKPO~MATNR EKPO~TXZ01 EKPO~WERKS EKPO~NETWR
EKPO~MENGE EKPO~MWSKZ
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE EBELN = ITAB-EBELN.
LOOP AT ITAB1.
READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN.
ITAB-EBELN = ITAB1-EBELN.
ITAB1-LIFNR = ITAB-LIFNR.
ITAB1-EBELP = ITAB-EBELP.
ITAB1-BELNR = ITAB-BELNR.
ITAB1-EBELP = ITAB-EBELP.
APPEND ITAB1.
ENDLOOP.
But when i was using loop then it was displaying values in debugging mode but while i was trying to execute it was taking a lot of time i thought that it was due to more information in the already declared internal table so i have tried to remove the previous entries but it was showing an error while i was removing the old entries
and when i remove the loop at itab1 then i'll get output directly but it was displaying the itab fields which is my 1st internal table but not the values of itab1 can u explain me what is the possible error for that
Regards ,
Pavan
12-21-2006 9:58 AM
12-21-2006 9:58 AM
12-21-2006 10:14 AM
READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN
THE CONDITION SHUD BE EBELN = ITAB1-EBELN IF U R HAVING LOOP ON ITAB1.
12-21-2006 9:59 AM
Hi ,
Few basic points
1. Please do not use into corresponding fields of , declare your internal table in the oder you are seelct the fields.
2. Perform join on all the three tables
3. Coule you tell me what does this code do
LOOP AT ITAB1.
READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN.
" What does the above statement do
ITAB-EBELN = ITAB1-EBELN.
ITAB1-LIFNR = ITAB-LIFNR.
ITAB1-EBELP = ITAB-EBELP.
ITAB1-BELNR = ITAB-BELNR.
ITAB1-EBELP = ITAB-EBELP.
APPEND ITAB1.
ENDLOOP
Regards
Arun
12-21-2006 10:08 AM
READ TABLE ITAB WITH KEY EBELN = ITAB1-EBELN.
as in the previous select statement i had defined the table and now i have tried to read the values from 1st interanl table to nxt internal table by mistake i have written as itab but it was itab1
12-21-2006 10:10 AM
Hi Pavan ,
That is fine , i just want to know what exactly do you want to acheive , please tell that so thet we can help you out .
What i mean is what exactly you wanted to acheive by executing the code.
Regards
Arun
12-21-2006 10:01 AM
Hi pavan,
LOOP AT ITAB1.
READ TABLE ITAB WITH KEY EBELN = ITAB1-EBELN.
<b> ITAB-EBELN = ITAB1-EBELN.</b>
ITAB1-LIFNR = ITAB-LIFNR.
ITAB1-EBELP = ITAB-EBELP.
ITAB1-BELNR = ITAB-BELNR.
ITAB1-EBELP = ITAB-EBELP.
APPEND ITAB1.
clear itab1.
ENDLOOP.
make <b> ITAB-EBELN = ITAB1-EBELN.</b> as
itab1-ebeln = itab-ebeln.
12-21-2006 10:16 AM
before using for all entries in, u need to check whether the driver internal table is empty, if it is empty, u should not enter into select statement.
if u wont use this check means, when the driver internal table is empty, the second select will take all the entires from the tables.
SELECT AEBELN ALIFNR AKNUMV BVGABE BEBELP BGJAHR B~BELNR
FROM EKKO AS A
INNER JOIN EKBE AS B ON BEBELN = AEBELN
INTO CORRESPONDING
FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
if itab[] is not initial.
SELECT EKPOEBELN EKPOMATNR EKPOTXZ01 EKPOWERKS EKPO~NETWR
EKPOMENGE EKPOMWSKZ
FROM EKPO
INTO CORRESPONDING FIELDS OF TABLE ITAB1
FOR ALL ENTRIES IN ITAB
WHERE EBELN = ITAB-EBELN.
endif.
I hope this will help u.
else,
Sujatha.
12-21-2006 10:23 AM
DATA: BEGIN OF ITAB OCCURS 10,
EBELN LIKE EKKO-EBELN,
LIFNR LIKE EKKO-LIFNR,
KNUMV LIKE EKKO-KNUMV,
MATNR LIKE EKPO-MATNR,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
MENGE LIKE EKPO-MENGE,
MWSKZ LIKE EKPO-MWSKZ,
VGABE LIKE EKBE-VGABE,
EBELP LIKE EKBE-EBELP,
GJAHR LIKE EKBE-GJAHR,
BELNR LIKE EKBE-BELNR,
END OF ITAB.
SELECT A~EBELN A~LIFNR A~KNUMV B~MATNR B~TXZ01 B~WERKS B~NETWR B~MENGE B~MWSKZ
C~VGABE C~EBELP C~GJAHR C~BELNR
FROM EKKO AS A
INNER JOIN EKPO AS B ON A~EBELN = B~EBELN
INNER JOIN EKBE AS C ON C~EBELN = A~EBELN
INTO TABLE ITAB WHERE C~VGABE = '2'.
12-21-2006 10:26 AM
Thanks for all your help i got the solution by re writing the statement as append to modify any way thanks for your help i also rewarded you points 4 ur help
12-21-2006 10:30 AM
HI Pavan,
Also avoid using "INTO CORRESPONDING FIELDS", it increases the execution time.
To avoid this keep the oredr of fileds in itab same as u have in select query.
Rgds,
prakash
12-21-2006 10:36 AM
U can combine the two queries into a single query.
SELECT AEBELN ALIFNR AKNUMV BVGABE BEBELP BGJAHR BBELNR CMATNR CTXZ01 CWERKS CNETWR CMENGE C~MWSKZ
FROM EKKO AS A
INNER JOIN EKBE AS B ON BEBELN = AEBELN
INNER JOIN EKPO AS C ON AEBELN = CEBELN
INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE B~VGABE = '2'.
Please make sure that you have included all the fields in ITAB.