‎2006 Oct 31 9:52 PM
Hello ABAPers,
I have this code:
SELECT ebeln bukrs
FROM ekko
INTO TABLE it_ekko
FOR ALL ENTRIES IN idata
WHERE ebeln = idata-vbeln_p.
LOOP AT idata WHERE ebeln IS NOT INITIAL.
READ TABLE it_ekko WITH KEY ebeln = idata-ebeln
bukrs = idata-bukrs_r.
MODIFY idata.
ENDLOOP.
I'm getting this error:
The internal table IT_EKKO has no header line - explicit specification of an output area with INOT wa or ASSIGNING <fs> is required.
I don't see what I'm doing wrong. Please advise.
Thanks in advance.
Ol Pom.
‎2006 Oct 31 9:56 PM
Hi,
The internal table it_ekko is declared with out header line..
For this...You have a declare a work area and use INTO addition for the READ TABLE IT_EKKO..
DATA: WA LIKE LINE OF it_ekko.
LOOP AT idata WHERE ebeln IS NOT INITIAL.
READ TABLE it_ekko <b>INTO WA</b>
WITH KEY ebeln = idata-ebeln
bukrs = idata-bukrs_r.
MODIFY idata.
Thanks,
Naren
‎2006 Oct 31 9:58 PM
‎2006 Oct 31 10:14 PM
just say
it_ekko occurs 0 with header line.
this should solve your problem.
Prince
‎2006 Oct 31 10:47 PM
Hi,
Once you do "READ TABLE it_ekko INTO WA" that record that matches the key will be stored in WA..You don't have to write specific move statement..
Is that what you are asking??
Thanks,
Naren
‎2006 Oct 31 10:51 PM
‎2006 Nov 01 2:52 AM
Hi Ol,
please tell us what it is you want to do with the internal table and we will be able to advise you.
‎2006 Oct 31 10:52 PM
others have pointed out why you are getting the syntax error.but why are you doing the read anyway? You are not referring to the data after the read and are immediately doing a modify. <b>This loop is not actually doing anything.</b>
LOOP AT idata WHERE ebeln IS NOT INITIAL.
READ TABLE it_ekko into wa WITH KEY ebeln = idata-ebeln
bukrs = idata-bukrs_r.
MODIFY idata.
ENDLOOP.
‎2006 Oct 31 10:56 PM
‎2006 Nov 01 1:11 AM
Hi Ol Pom
What Neil was pointing to is highlighted below. Please check the same to have some understanding.
<b>Current Logic</b>:
SELECT ebeln bukrs
FROM ekko
INTO TABLE it_ekko
FOR ALL ENTRIES IN idata
WHERE ebeln = idata-vbeln_p.
LOOP AT idata WHERE ebeln IS NOT INITIAL.
READ TABLE it_ekko WITH KEY ebeln = idata-ebeln
bukrs = idata-bukrs_r.
MODIFY idata.
ENDLOOP.
--> Nowhere between the loop and end, any data of
internal table <b>idata</b> is modified, hence the
statement MODIFY IDATA doesnt make any modifications.
For avoiding the syntax error, declare a work area of
type IT_EKKO or declare IT_EKKO with header line.
Options to do the same:
data: wa_ekko like it_ekko.
<b>OR</b>
data: begin of it_ekko <b>occurs 0</b>,
...
end of it_ekko.
Above will rectify the syntax error.
Please see that your code resembles something like below:
data: wa_ekko like it_ekko.
IF NOT it_ekko[] is INITIAL.
SELECT ebeln bukrs
FROM ekko
INTO TABLE it_ekko
FOR ALL ENTRIES IN idata
WHERE ebeln = idata-vbeln_p.
ENDIF.
LOOP AT idata WHERE ebeln IS NOT INITIAL.
READ TABLE it_ekko into it_ekko
WITH KEY ebeln = idata-ebeln
bukrs = idata-bukrs_r.
check sy-subrc eq 0.
* ... change contents of idata w.r.t it_ekko.
MODIFY idata.
ENDLOOP.Kind Regards
Eswar
‎2006 Oct 31 11:33 PM
Hi,
Looks like you want to update ebeln and bukrs in the internal table idata.
SELECT ebeln bukrs
FROM ekko
INTO TABLE it_ekko
FOR ALL ENTRIES IN idata
WHERE ebeln = idata-vbeln_p.
DATA: V_TABIX TYPE SYTABIX.
LOOP AT idata WHERE ebeln IS NOT INITIAL.
v_tabix = sy-tabix.
READ TABLE it_ekko into wa
WITH KEY ebeln = idata-vbeln_p.
if sy-subrc = 0.
idata-ebeln = wa-ebeln.
idata-bukrs_r = wa-bukrs.
MODIFY idata index v_tabix
transporting ebeln bukrs_r.
endif.
ENDLOOP.
Thanks,
Naren