There are many requirements where data from One table needs to be copied to another. There are also various ways available. But there are some APIs which provide this functionality in very optimum way. e.g. JDEDM_LoadDSfromTableRecord, JDEDM_LoadTableRecordfromDS.
Take example where one table contains 200 fields and due to interoperability one more table (Z-table) needs to be maintained with few extra fields. Now for doing this you need to assign each and every field before it gets updated to New table which is very time consuming and error prone activity and which also affect the performance. Not only this, table may contains different types of data types e.g. String, Numbers, characters etc.
Above mentioned APIs provide the functionality, which takes data from table and store it to Data Structure and vice versa. It basically checks the DD item for Copying the data from one to another as we know there can be only one unique DD item in Table.
- Consider there are two tables F01301D and F60098Z and most of the Data(Same Alias) needs to be copied from F01301D to F60098Z.
First Data From F1301D(lpF01301D) is fetched and stored in D6001301D (dsD6001301D) data structure thru following code.
JDEDM_LoadDSfromTableRecord( (hUser),NID_F01301D,(LPVOID)lpF01301D,_J("D6001301D"), &dsD6001301D);
- After that Data Structure D6001301D(dsD6001301D) can be copied to F60098Z(dsF60098Z) table stucture thru following code
- After this procedure, All fields with similar aliases are copied to destined Table structure and then Other fields also can be assigned and finally same structure can be used for inserting the data to destined Table.
Let me know for further information.