2008 May 30 2:51 PM
hi,
in ECC 6.0, in an abap proxy class i have a loop statement as follows:
LOOP AT tablename.
sdfsdf
sfsfsf
s
fsf
ENDLOOP.
and i get the error, At "Loop At itab" one of the additions into/assigning or transporting no fields is required in OO context !! what does that mean ? in my abap proxy class can't i use the loop at statement's simplest form ?
whats the solution ?
2008 May 30 2:54 PM
hi,
in OO conetxt you cannot use internal table with header line, so you have to LOOP through the table INTO a work area or you have to ASSIGN a field symbol.
LOOP AT itab INTO wa .
...
ENDLOOP.
hope this helps
ec
2008 May 30 2:53 PM
2008 May 30 2:54 PM
hi,
in OO conetxt you cannot use internal table with header line, so you have to LOOP through the table INTO a work area or you have to ASSIGN a field symbol.
LOOP AT itab INTO wa .
...
ENDLOOP.
hope this helps
ec
2008 May 30 2:54 PM
Hello.
Is that tablename an input structure of the proxy?
You must create a work area for it, and then use:
LOOP AT tablename INTO wa.
...
ENDLOOP.
Best regards.
Valter Oliveira.
2008 May 30 2:54 PM
YOu can't use the normal internal table declared with OCCURS 0 extention in OO programming
You need to have the internal tables declared with type and you have to explicitally take the current row into the workarea.
Like:
types: begin of ty_tab,
field1 type vbeln,
end of ty_tab.
data: tablename type standard table of ty_tab,
wa_tab type ty_tab.
LOOP AT tablename into wa_tab.
wa_tab-vbeln = 'XXXX'.
ENDLOOP.
Regards,
Naimesh Patel
2008 May 30 2:54 PM
Hi,
In the OO concept we should not modify or process an internal table direcly.
A work area must be used for this purpose. The error will be thrown if WA is not used.
regards,
teja.
2008 May 30 2:55 PM
Hi
It means it can only use an internal table without header line, so it needs to create a workarea in order to see the data of a record of the table:
DATA: WA TYPE TABLENAME.
LOOP AT tablename INTO WA.
ENDLOOP.
Max
2008 May 30 2:56 PM
Sure you can, you just have to use an explicit workarea and use the INTO.
Types: begin of ttab,
fld1 type c,
fld2 type c,
end of ttab.
data: itab type table of ttab.
data: wa like line of itab.
Loop at itab INTO wa.
* Now the row is stord in WA, do what you need to here.
endloop.
YOu can NOT use internal tables with header lines in the OO context.
Regards,
Rich Heilman
2008 May 30 2:57 PM
You need to use work area when you are working with Object Oriented environment. I hope you are using the loop inside class or BSP or WDA or some BADI
LOOP AT ITAB INTO WA. use work area for all internal table processing.