Skip to Content
author's profile photo
Former Member

Reading table struc

Hi,

I have a function that returns me table Struc. I am trying to create another table by going through this table. The new table would contain the ObjectID and the ObjectID of its parent.

In order to find the parent first we have to look at the PUP column corresponding to the Object. This PUP is then matched with another column in the same table SQNR. If PUP = SQNR then we grab the ObjectID corresponding to that SQNR and this is the parent.

What would be an efficient way of achieving this? I would really appreciate the help!!

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Oct 07, 2005 at 12:51 PM

    Hi,

    I would suggest you do like this

    LOOP AT ITAB ASSIGNING <FS>.

    PERFORM FIND_PARENT

    TABLES ITAB

    <FS>-PUP

    <FS>-PARENT_FIELD

    ENDLOOP.

    form find_parent

    TABLES ENTRIES STRUCTURE..

    using value(PUP)...

    CHANGING PARENT...

    DATA : LW_REC LIKE LINE OF ENTRIES.

    READ TABLE ENTRIES INTO LW_REC

    WITH KEY SEQNR = PUP. " FIND THE PARENT

    PARENT = XXXX " FIELD OF THE PARENT OF LW_REC

    ENDFORM.

    If it did help reward me

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Stephan,

      Thanks for your reply. I am actually very new to ABAP programing. Could you please explain it a bit more. The function that I am calling is

      CALL FUNCTION 'RH_STRUC_GET'

      EXPORTING

      act_otype = otype

      act_objid = objid

      act_plvar = plvar

      act_wegid = pathid

      TABLES

      result_struc = result_struc

      EXCEPTIONS

      no_plvar_found = 1

      no_entry_found = 2

      OTHERS = 3.

      IF sy-subrc <> 0.

      RAISE no_roots_found.

      ENDIF.

      I am trying to make a new table with only two fields. The employeeID and the parentID. The table result_struc which is a type STRUC has a lot more fields that I do not require.

      I would really appreciate your help.

      Regards,

      Mark