• Welcome to the upgraded JDELIST forum and thank you for your patience.
    Please restrict discussions and issues regarding the new forum software to the Off Topic forum. We will be monitoring that forum for issues.
    If you have trouble logging in, please reset your password using the forgotten password form: https://www.jdelist.com/community/index.php?lost-password/
    If you are unable to successfully reset your password, please contact us: Click here!
    We hope that you enjoy the upgraded forum.
  • Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

JDEDM_LoadDSfromDS

I'm trying to create F47011/12 records from F4201/F4211.

Being lazy - I thought I'd copy most of the fields with the following:


JDEDM_LoadDSfromDS( (HUSER)hUser, _J("F4201"),
(LPVOID)lpdsF4201,
_J("F47011"),
(LPVOID)lpdsF47011,
JDEDM_MATCHINGBY_DD);


But it gives me a memory error. I'm guessing it only works on JDE data structures??? (clue is in the name...)



E8.11/E9.2
 
I found these 2 apis on JDESource (thanks)


JDEDM_LoadDSfromTableRecord
JDEDM_LoadTableRecordfromDS


However it still looks like I might need to create a DS that matches either the source or destination table.


I could roll my own code - coping alot of the column mappings from B4201540.


Does anyone have a more intellegent way of doing it?
 

JMR

Member
How are you defining lpdsF47011? And lpdsF4201?

I'm assuming you already have the lpdsF4201 structure populated and that you're trying load lpdsF47011.

I would think you'd probably want to try something like the following:
F47011 dsF47011 = {0};

Then your API call for the F47011 line would like the following:
(LPVOID)&dsF47011,

If you defined lpdsF47011 as: LPF47011 lpdsF47011 = NULL; (or similar... as a pointer instead of a structure), then you would need to allocate memory for that pointer before you can reference it in the API call. Without doing so would cause a memory violation.
 

BOster

Member
I have used these quite a bit. JDEDM_LoadDSfromDS is for loading from a BSFN DS and if memory serves, I don't think it will work with tables (as you found out). I don't think there is one for table to table data structs oddly enough.
 
Thank guys.
@JMR - I'm allocating memory in pretty much that way.

From my testing, the clue is in the name. A JDE data structure is required when it is mentioned in the API.

I've ended up using the 2 api's below and created 2 new DS's to match F47011/F47012 (copied from D4202034/40 and enhanced).

JDEDM_LoadDSfromTableRecord
JDEDM_LoadTableRecordfromDS
 
Ball's. I replied to this thread but it's disappeared.

Ended up using the 2 API's below. Had to create 2 custom DS's to be the middle man.

JDEDM_LoadDSfromTableRecord
JDEDM_LoadTableRecordfromDS
 
We have done something generic using JDBRS_GetTableSpecsFromHandle on the source and destination tables. You can examine each of the columns in the tablecache structure of each handle. If they exist in both tables, the data can be copied to the destination using JDB_GetTableColValue and JDB_AssignColumnValue.

Craig
 
Top