Capture Runtime data selection value - Custom C BSFN

w2vijay

w2vijay

Well Known Member
Jdelist,

I have a requirement that user enters load number(LDNM) in data selection at run time.
Ideally, If the load number is not present in the view the report does not run. But the entered load number can also be shipment number which I want to check against shipment header table. So I need to capture the entered load number in data selection.

Does anyone written custom C BSFN for the above requirement or can provide pseudo code. In meta-link and some of the jdelist posts suggested to use API ubeSection_GetDataSelection inside custom C BSFN. Help me how this API can be embedded in C BSFN.

I have reviewed the jdelist posts and seen the solutions such as print cover pages, usereportdataselection, use work file etc. which are not suitable for the requirement. For now I am using form to pass value and print the report.

Please let me know if you need any more details.
 
I am not entirely clear on what you are trying to accomplish so not sure if I am answering your question or not.

Using ubeSection_GetDataSelection you can verify that load number or shipment number are included in the data selection (entered by the user at runtime or otherwise). If neither are entered you could stop the UBE from processing and instead output some type of error message in the resulting UBE output.

Or, you could also just use processing options to prompt for for either load number or shipment number and programatically set data selection or prevent the UBE from running if neither value is entered. This would be a lot easier.

However, if you can't use processing options to prompt for values and you have to use the data selection dialog AND you need to programatically alter the entered data selection - i.e. user enters shipment number which you use to retrieve load number and use in the data selection in place of shipment number - then things get a LOT more complicated.
 
Brian,

Thanks for the reply. Let me explain in detail so that can understand the scenario.

At high level the functionality is user provides load number or shipment number and use this value to print Bill Of Lading documents. I have taken R42520 print pick slip report to accomplish this requirement.

To determine load/shipment number I should have driver section view on F4960 or F4215. Right now I have taken the driver section on table F4960, where the data selection would be "Where Load Number(LDNM) equal to Blank". The user will override the blank with a number at run time. For example use entered number 112 which is shipment number and not present in the table F4960 the report will exit and display 'data not selected". But this number is present in F4215 eligible for printing BOL documents.

So here is the need for me to capture the user entered value which I can use to verify against F4215 when F4960 fails. Since this is little complicated I am asking for help.

Hope this explanation helps in understanding the requirement.

I cannot use the processing option to enter the number.
 
Why can't you use processing options to prompt for Load Number or Shipment Number? I am guessing because of all the other options that are present for the R42520 that the users shouldn't change - which is a valid reason. My second approach might be a driver UBE that has processing options that prompt for the values and then calls R42520 passing Load Number as an RI values (sounds like you might all ready be doing something like this). If that also is not a possibility and you must use the data selection dialog prompt to capture the values then this is what I would do (I have done variations of this in the past).

1. Create a "Dummy" table that has the following fields (and any other fields you would want to "promopt" the user to enter.
VMCU - Planning Depot
LDNM - Load Number
SHPN - Shipment Number

This table needs to be gen'd but will never have any records. You will simply use it to "drive" the data selection dialog at run time.

2. Make this table your driver section on R42520 and have it prompt the user for data selection.

3. Use ubeSection_GetDataSelection to get the data selection - in this scenario you are really just getting the values you would have obtained through processing options.

4. If user entered shipment number use it to get load number else just use load number entered by user. Validate the load number if you need to and throw error and stop UBE execution if invalid. If you need to use the load number to set data selection in R42520 or for other purposes return it to R42520 so you can do what ever you need to do with it.


The downside to using the data selection dialog to prompt for values is that the user can really enter anything they want - even with a dummy table that restricts the fields. They could enter in a list of load number and/or shipment numbers. If you prompt for the values in this manner then you really have to interrogate the data selection to make sure the user entered in exactly what you want in the manner that you want, else throw some sort of error and stop execution.

I have never used this technique in this manner before so there may be other issues. Normally I have used this to capture data selection which I then apply to JDEBASE table I/O operation inside of a C BSFN. In that scenario I really don't care how the user enters the data selection (list of values, comparators, AND/OR clauses, etc.). I use it when I WANT complicated data selection that could not easily be done with a processing options.
 
Similar to what BOster said, use proc options.

No need to add a new section to R42520 or create a new view. Just capture the load/shipment number using proc options.

In the UBE, validate the load number/shipment number proc option value against F4960/F4215 in the "Initialize Report" event. "Initialize Report" is a report level event. It gets executed before ANY section related event/code executed.

If the validation fails, then force an error by "Set UBE Error" then "Stop Batch Processing" or some other variation. Once you get the general idea, there's lots of ways to skin this cat.
 
Back
Top