Skip to Content
avatar image
Former Member

WDDOINIT code error

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 24, 2008 at 02:11 AM

    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]

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 24, 2008 at 01:28 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 05, 2008 at 06:48 AM

    Resolved

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 05, 2008 at 03:44 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded