Skip to Content
author's profile photo Former Member
Former Member

How to find a parent child relations in deep structures?

Hello Gurus

Is there any FM or class which will help me to fetch the parent child relation of the deep structures?

For example

Structure---> Z_test

Component -----> it_header. if you double click it there will be further two components ----> it_item and it_contact.

Now I want to get the parent child relation between these.

Please provide some info on this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2013 at 08:59 AM

    Hi Aashish,

    try this an example and put it into a recursive function. This should help. regards, Sascha


    deep_structure.png (28.2 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 23, 2013 at 06:20 PM

    Hi,

    did you check if cl_abap_typedescr can help? As you have the components available you should be able to determine the necessary info on your own.

    regards, Sascha

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Sascha

      I tried this code

      REPORT ZTEST_AASHISH.

      PARAMETERS: p_table LIKE dd03l-tabname OBLIGATORY.

      DATA : idetails TYPE abap_compdescr_tab.

      DATA : ref_table_des TYPE REF TO cl_abap_structdescr.

      * Get the components of the table.

      ref_table_des ?=

      cl_abap_typedescr=>describe_by_name( p_table ).

      idetails[] = ref_table_des->components[].

      But in idetails[] I only got IT_header not the deep structures

      Regards

      Aashish

  • author's profile photo Former Member
    Former Member
    Posted on Oct 24, 2013 at 06:11 AM

    In your example it_header is the parent structure and it_item , it_contact are the child structures. As these two structures are coming from the previous one.

    Same with class, you have a class say cl_parent then for adding some more functionality you inherit another class from it say cl_second. As cl_second got inherited from cl_parent so it will automatically have all the functionality of cl_parent. so cl_second is child class with some added functionality of cl_parent,the parent class.

    There is a lot of document available in internet for class inheritance like the below one:

    http://help.sap.com/saphelp_nw70/helpdata/en/1d/df5f54127111d3b9390000e8353423/content.htm

    Hope this helps.

    Regards,

    Supratik

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 24, 2013 at 06:48 AM

    Hi

    See this DEMO programs in SAP for your requirement

    BCALV_TREE_01 ALV Tree Control: Build Up the Hierarchy TreeBCALV_TREE_02 ALV Tree Control: Event HandlingBCALV_TREE_03 ALV Tree Control: Use an Own Context MenuBCALV_TREE_04 ALV Tree Control: Add a Button to the ToolbarBCALV_TREE_05 ALV Tree Control: Add a Menu to the ToolbarBCALV_TREE_06 ALV tree control: Icon column and icon for nodes/itemsBCALV_TREE_DEMO Demo for ALV tree controlBCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy treeBCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy treeBCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER

    BCALV_TREE_EVENT_RECEIVER01

    BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at RuntimeBCALV_TREE_MOVE_NODE_TEST Demo for ALV tree controlBCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMOBCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree
    Add a comment
    10|10000 characters needed characters exceeded

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.