‎2006 Nov 09 8:02 PM
Hi!
How can I insert data in a structure ?
For example:
I have this code to insert data in a table of db:
REPORT ZLOAD.
tables T006a.
data: tab type standard table of T006a with header line.
tab-mandt = '100'.
tab-spras = 'D'.
tab-msehi = 'G'.
tab-mseh3 = 'G'.
tab-mseh6 = 'g'.
tab-mseht = 'g'.
tab-MSEHL = 'Gramm'.
move-corresponding tab to T006A.
insert T006A.
but,if I want to insert data in the structure RMMG1, which is the form?
Thanks.
‎2006 Nov 09 8:06 PM
Hi Ana,
change the last two lines to as written below:
append tab.
insert t006a from tab.
Sajan.
ANNEX: you cannot insert data into a DDIC structure..Structures doesnt hold data except in runtime..
you can move data to a structure..but that will not get saved in the database.
rmmg1 = tab will polulate the structure rmmg1 when the header line of tab is not initial (if initial read with index 1).
Message was edited by: Sajan Joseph
‎2006 Nov 09 8:11 PM
Hi, welcome to SDN. There are couple things wrong with your program, first, you are trying to directy update a standard SAP table which is not a good idea. Second you are using the header line of an internal table as a work area which is not a good programming practice. If tab was a work area, defined like below, then really you are filling a structure(or work area), this is how you would fill the structure RMMG1, remember that a structure defined in the data dictionary does not actually hold data, it is just a skeleton or blue print of how the data may look, usually structures are used to defined the fields in a screen and the data is moved from the database table into the structure at runtime of the program.
data: tab type T006a .Regards,
Rich Heilman