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

Expand a dynamic structure

Hello,

in German we say: "I am on the hose!"


I need your help.


In the CoQC Templates are different count of characteristics.


For Example - CoQC Profile for material XYZ has 10 characteristics and the profile for material ABC has 5 characteristics.


I want to read the characteristics, but not line by line, but by columns.


For example:


In ABAP I have define an structure:

Then each column for the characteristic needs to be added to this structure exactly.


For Example:



I've read that there are field symbols, but I do not understand how you then inserts these fields to the structure.


My definition:



<f> has the correct value. How do I get this value to the structure OUTPUT_CHAR?

Can anyone help me?


I hope you can understand me and my problem. ..


Best Regards,


Ulrike



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on May 07, 2015 at 12:06 PM

    Dear Ulrike,

    http://scn.sap.com/docs/DOC-42525

    Please reffer the below link

    Thanks

    Nishant

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 07, 2015 at 01:07 PM

    Hey Ulrike,

    see the code below:

    REPORT ZTEST.

    DATA: go_struct TYPE REF TO cl_abap_structdescr,

    go_table TYPE REF TO cl_abap_tabledescr,

    gd_dyn TYPE REF TO data,

    gt_comp TYPE cl_abap_structdescr=>component_table,

    gs_comp TYPE cl_abap_structdescr=>component.

    FIELD-SYMBOLS: <gs_dyn> TYPE ANY,

    <gt_dyn> TYPE STANDARD TABLE.

    * Character field

    gs_comp-name = 'F1'.

    gs_comp-type = cl_abap_elemdescr=>get_c( 10 ).

    APPEND gs_comp TO gt_comp. CLEAR gs_comp.

    * Packed field

    gs_comp-name = 'F2'.

    gs_comp-type = cl_abap_elemdescr=>get_p( p_length = 10 p_decimals = 2 ).

    APPEND gs_comp TO gt_comp. CLEAR gs_comp.

    * String field

    gs_comp-name = 'F3'.

    gs_comp-type = cl_abap_elemdescr=>get_string( ).

    APPEND gs_comp TO gt_comp. CLEAR gs_comp.

    TRY.

    * Create the dynamic structure

    go_struct = cl_abap_structdescr=>create( gt_comp ).

    CREATE DATA gd_dyn TYPE HANDLE go_struct. "Create dyn. data ref.

    ASSIGN gd_dyn->* TO <gs_dyn>. "Dereference the data ref.

    CLEAR gd_dyn.

    * Create the dyn. table

    go_table = cl_abap_tabledescr=>create( go_struct ).

    CREATE DATA gd_dyn TYPE HANDLE go_table. "Create dyn. data ref.

    ASSIGN gd_dyn->* TO <gt_dyn>. "Dereference the data ref.

    CATCH cx_sy_struct_creation .

    CATCH cx_sy_table_creation .

    ENDTRY.

    BREAK-POINT.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2015 at 08:39 AM

    Thank you - the examples have helped me!


    Best Regards,


    Ulrike

    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.