• 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!

Basic Code 8 advanced pricing business function

sysmk

Member
Hi all,

As per Oracles instructions and other threads on here to use P4072 ‘Object Library’ (stored in F4072.ADFRMN) to specify a custom business function we must use the data structure D4500210.
This data structure passes into the function “idF4211RowPtr” which is a pointer to the F4211 record in cache.

The only way I can see to use this value is the JDE standard API “jdeRetrieveDataPtr”
Called something like this..
lpdsF4211 = jdeRetrieveDataPtr(hUser,lpDS->idF4211RowPtr);

This is fine and works but most the fields it returns are blank? It returns the key fields and some pricing columns but most are blank (even though they were entered into the F4211 Edit Line and end up on the Sales Order).

Is there a way of getting the rest of the fields? I particularly need another order number to store like RORN or OORN.

Thanks a lot!
Mark
 

BOster

Legendary Poster
lpdsF4211 = jdeRetrieveDataPtr(hUser,lpDS->idF4211RowPtr);
jdeStoreDataPtr, jdeRetreiveDataPtr, jdeRemoveDataPtr are all platform independent ways to pass pointers around between C BSFNs.

In this particular case, the BSFN is expecting a handle returned by a call to jdeStoreDataPtr on a pointer to a F4211 record in caller allocated memory (not "cache"). This is all done in C, so you need to have a fairly strong understanding of C and C BSFNs. You also need to really understand how jdeStoreDataPtr, jdeRetrieveDataPtr and jdeRemoveDataPtr work or you can leak handles, leak memory, dereference null pointers or pointers to previously free'd memory, etc. all of which can crash your entire call object kernel.

Here is the generic pseudo code for this pattern:

BSFN: GetSalesDetailRecord
Code:
F4211  *pRecSalesDetail = (F4211 *)NULL;

pRecSalesDetail= jdeAlloc(COMMON_POOL, sizeof(F4211), MEM_ZEROINIT);
...
//JDEBASE code that gets the F4211 record and stores in the memory buffer pointed to by pRecSalesDetail
...
lpDS->idF4211RowPtr = jdeStoreDataPtr(hUser, pRecSalesDetail);
...
BSFN: what ever BSFN needs a F4211 record
Code:
F4211  *pRecSalesDetail = (F4211 *)NULL;

pRecSalesDetail = jdeRetrieveDataPtr(hUser, lpDS->idF4211RowPtr); //gets the pointer but doesn't release the handle
...
BSFN: FreeSalesDetailRecord
Code:
F4211  *pRecSalesDetail = (F4211 *)NULL;

pRecSalesDetail = jdeRemoveDataPtr(hUser, lpDS->idF4211RowPtr); //gets the pointer AND releases the handle
jdeFree(pRecSalesDetail);
You might be able to find a BSFN that returns a handle/pointer to a F4211 record and one that releases the returned handle and allocated memory in which case you won't need to write any C code but just glue everything together with ER code.
 
Last edited:

BSK

Active Member
Hi Brian,

I am having the same issue and "lpdsF4211 = jdeRetrieveDataPtr(hUser,lpDS->idF4211RowPtr" not returning values for all the fields from P4210 sales order entry. To my understanding that API should get all the fields for the Row Pointer we are passing in, is it anything we need to do? Our Custom BSFN being called by standard "jdeCallObject" API (from BSFN B4500050) by passing DSTR with F4211RowPointer value.

Any help is appreciated.

Thanks
Bala
E1: 9.2
 

BOster

Legendary Poster
Without a LOT more context it would be impossible to diagnose your problem, but I promise you the problem is NOT with jdeStoreDataPtr,jdeRetrieveDataPtr,jdeRemoveDataPtr. I have problems with the design of these APIs (static size) but the APIs as designed work perfectly. The problem is with the code that uses them - either the code that is returning the value you are using in idF4211RowPtr or your code which is trying to use the returned value.

All jdeRetrieveDataPtr does is return a memory location based on the handle in the second parameter which is set by calling jdeStoreDataPtr on said memory location. jdeRetrieveDataPtr/jdeRemoveDataPtr could care less about what TYPE of data is in the pointer or the contents. Think of them like a 1000 dimension array that stores a bunch of memory locations, and the handle that gets passed in effectively just indexes into that array and returns whatever memory location is at that index. I know the actual implementation for it is a lot more complicated, but from a caller's standpoint that is an easy way to think of it.
 

BSK

Active Member
Thanks Brian. I will debug again starting from F4211EditLine.

Just to give you additional details what we are trying to achieve here:
1. We are trying to use custom table to get the price adjustment (based on Primary Supplier in F4211 - SDVEND, Ship to location - SDSHAN, Item# - SDITM & Effective date), So I have created a C-BSFN by using the DSTR of D4200210
2. Added my custom BSFN in the Adjustment Detail "Object Library" field.
3. When I entered the Sales Order detail line, it called my custom BSFN without any issue but it did not return price adjustment from custom table and when I debugged the BSFN I noticed value for SDVEND is not getting retrieved by "jdeRetrieveDataPtr". I see values from some other fields, but not for SDVEND.
4. Without SDVEND value I can't get price adjustment from custom table.

Thanks
 

BSK

Active Member
Hi Brain,

Oracle accepted this as a bug ((Bug 31414850) and working on to release a patch for this bug and I will post here when it gets released.

Thanks
Bala
 
Top