Skip to Content
0
Former Member
Dec 04, 2009 at 03:29 PM

Problem with structures and field symbols

53 Views

Hi,

First, sorry if I am not very accurate into my explanations but I am a SAP and abap beginner (and not very good in english !!!)

I am working into SLcM module.

Well, I'm trying to loop into a table resulting of a structure (QCAT_STRU).

My goal is to get data from a structure and display it into a field in my page within a context node (named 'HRP' with two attributes 'objid' and 'stext').

Here is my code:

  DATA lt_hrp TYPE wd_this->Elements_hrp.
  DATA ls_hrp TYPE wd_this->Element_hrp.
  DATA lo_stru_tab type ref to data.

  FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
                               <line>  TYPE ANY.

  CREATE DATA lo_stru_tab type STANDARD TABLE OF QCAT_STRU.
  ASSIGN lo_stru_tab->* TO <table>.

  CALL FUNCTION 'RHPH_STRUCTURE_READ'
    EXPORTING
      PLVAR                   = '01'
      OTYPE                   = 'O'
      OBJID                   = '50000083'
      WEGID                   = 'O-S-P'
    TABLES
      STRU_TAB                =   <table>.

  loop at <table> assigning <line>.
      ls_hrp-objid = <line>-objid.
      ls_hrp-stext = <line>-stext.
      append ls_hrp to lt_hrp.
      clear ls_hrp.
  endloop.

I've got an compile error onto "ls_hrp-objid = <line>-objid." and explains "the data object <line> has no structure and therefore no component called objid".

Running into debugger mode, field symbols is filled with the first line of <table> and contains every attributes of it. But I can"t access to its attributes.

Someone can help me ? 😊

Thanks