Skip to Content
avatar image
Former Member

How to create deep structure dynamically using field symbol.

Hi All,

I've a requirement where I'm creating dynamic entity set whose names and structure will be derived from a table. So far, I'm successful in creating metadata of MPC class. But to send data back to service requires a structure, in this case a deep structure (Structure that may include multiple dynamic entries of Structure and Table).

I tried adding a structure inside structure but I don't understand field symbol completely. I made a R&D and found field symbol can add structures of same type or can append to a table. Can someone help on it.

My structure is:

ABC

| - A

| - B

| - C

| - D

| - E

| - F (Dynamic)

| - G (Dynamic)

| - (Table) (Dynamic)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • May 08 at 09:40 AM

    Use RTTC.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Horst, Thanks for reply. I read about RTTC but my main requirement is as follows:

      I've a table that maintains structures and entity set and node for structure to be added.

      I fetch details from table and had already created Metadata successfully in MPC class, but I'm unable to declare data for the same. I need to append structures on runtime (I don't know which structure will be appended with what name) it will create a service data to be sent in er_entity. Kindly help.

  • May 09 at 05:08 AM

    Hi Umang,

    Field-symbols example:

    DATA: gt_xpto TYPE STANDARD TABLE OF ty_xpto.
    ...
    DATA: lo_xpto TYPE REF TO data.
    ...
    GET REFERENCE OF gt_xpto INTO lo_xpto.
    ...
    CALL FUNCTION 'Z_TEST_REF_DATA'
    EXPORTING 
    it_xpto = lo_xpto
    ...
    * EXPORTING parameter (it_xpto) should be defined as TYPE REF TO data.
    
    * Function Module code
    ...
    assign it_xpto->* to lt_table.
    ...
    
    Add comment
    10|10000 characters needed characters exceeded