Page 1 of 1

Any table structure in a DDIC structure

Posted: Tue Jul 25, 2017 10:44 am
by sapmanie
I need a field in a DDIC structure (SE11) to hold table data. Normally I would use a table type reference, however the table structure containing the data can change. is it possible to create a structure with a "dynamic" table field?

e.g. If the structure was defined in a program, it would look something like the code below. I am looking to have the equivalent of "type any table" defined in the DDIC structure:

[code]data: begin of t_structure
tabname type string,
tabdata type any table, "ddic error
tabdata2 type lvc_t_fcat, "ddic ok but is fixed to the lvc_t_fcat structure
end of t_structure.[/code]


Any table structure in a DDIC structure

Posted: Fri Mar 02, 2018 6:53 am
by Maxmerdins
When youre looking at the structure of a table, SAP will let you print the structure, but it wont let you save the structure. This can be annoying. This report outputs the table structure to a list. At this point the user can use the System->List->Save->Local file command to save the list to a file.
Output Table Fields to a List


Re: Any table structure in a DDIC structure

Posted: Sat Apr 14, 2018 11:06 am
by Ditty
Do you think there's a chance for them to add a save option if someone requests it as a feature? I think that'd be neat to have because it really is annoying at times not to be able to do that.

Re: Any table structure in a DDIC structure

Posted: Mon May 07, 2018 7:25 pm
by Rich
That's what all the dynamic runtime stuff is for.

If you know the rules how to construct the table structure, then you can do stuff like:

Code: Select all

     If w_Structure_Name is not initial.
        Create Data o_Structure Type (w_Structure_Name).
        Create Data o_Structure Type (w_Structure_Name_Item).
     Assign o_Structure->* to <f_Struc>.
     Read Table t_OutTab Index pu_SelField-TabIndex Assigning <f_Struc>.

If the structures are to be used by a single program or class then do it in the program, otherwise create a new class to construct the tables for you and use that