cancel
Showing results for 
Search instead for 
Did you mean: 

WDDOINIT code error

Former Member
0 Kudos

Friends,

I am trying to populate context attribute with values from database table MARC in WDDOINIT code.

I posted this question in Abap dictionary forum, but the answers received were not applicable to OO context. Hence posting it here.

This is my code:

data:begin of t_marc occurs 0,

strgr type marc-strgr,

end of t_marc.

select strgr from marc into table t_marc.

I am getting the error:

"Tables with headers are no longer supported in OO context"

Please let me know what is missing.

Thanks and Regards.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think the error message give you clear information.

In Abap OO we can not use internal table with header line. You have to create internal table WITHOUT header line.

Here sample code:


data:begin of ls_marc,
       strgr type marc-strgr,
     end of ls_marc,
     lt_marc like table of ls_marc.

select strgr from marc into table lt_marc.

loop at lt_marc into ls_marc.
  ....
endloop.

Regards,

$=====$

Are you newbie? Check this out: [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

First of all, although you were working within WDA there is not really anything Web Dynpro specific about this question. In the future please make sure that your questions are posted in the correct forum. I would think this question really should have been in the ABAP OO forum.

Second it is strongly advised not to perform SQL directly within WDA methods. You should always have your SQL abstracted out to a Model Class and only call methods of the model from WDA.

Former Member
0 Kudos

Resolved

alejandro_bindi
Active Contributor
0 Kudos

In general, even when you're not working inside OO coding, try to erradicate the use of OCCURS and header lines in internal tables. Get used to declare and use either a separate workarea or a field symbol for accessing/modifying table data instead.