Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on 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 a 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.