Linking F4211 to F4311

SALopez

Member
I'm well aware that the RORN number in F4311 (and F4801) are character based. I'm trying to convert the SO number in F4211 to a character and left pad with zeros so I can read through both the PO detail and WO header files to find orders that point back to open sales order lines.

I can left pad with character values, but I can't get my field to left pad with a character representation of zero.

My code is as follows:

Convert Math_Numeric To String
VA rpt_DerivedSoNumber=lpad([VA_rpt_DerivedUnPaddedSoNumber],"0",8)
RV TEST = VA rpt_DerivedSoNumber
F4311.Fetch Single

The Convert Math function is B8000094, with BC Document (Order No, Invoice, etc.) (F4211)(DOCO) being fed into the MathNumeric field and VA rpt_DerivedUnPaddedSoNumber receiving the output. This appears to work and show correctly when I point RV TEST to it.

The rpt_DerivedSoNumber number, however, remains unpadded when I use a zero in lpad. It will fill correctly if I use a character (h,H, etc). Both of the derived fields are 8 character variables built on RORN as the DD item.

What am I missing here? I know this is commonly done, but can't find any code samples either on line or in our system to see what other approach I can take.

We're on E1 9.0.1 and tools release 8.98.3.3.
 
What DD is RV TEST? Did you use RORN as well? You don't need VA rpt_DerivedSoNumber, do you?
RV TEST=lpad([VA_rpt_DerivedUnPaddedSoNumber],"0",8)
would have worked, too.

PS Did you try to use B0000083 Math Numeric To String Left Zero Pad, Convert?
 
When posting code, plz expand arguments.

Having said that, your code looks okay (See sample below). I'm guessing it must have something to do with the DD aliases you used for your variables as Adrian already said.

Convert Math_Numeric To String
BC Document (Order No, Invoice, etc.) (F4211) -> mnMathNumeric01
VA rpt_szDOCOtoRORN_RORN <- szString

VA rpt_szDOCOtoRORN_RORN = lpad([VA rpt_szDOCOtoRORN_RORN],"0",8 )

F4801.Select
BC Order Type (F4211) = TK Related PO/SO/WO Order Type
VA rpt_szDOCOtoRORN_RORN = TK Related PO/SO/WO Number
BC Line Number (F4211) = TK Line Number
BC Order Company (Order Number) (F4211) = TK Company - Key (Related Order)
 
Try ltrim(rtrim(var)) before padding and see if that makes a difference.
 
DD Elements were all based on RORN (for both the padded and unpadded character strings), as I mentioned above.

Part of this is I confused myself be creating a report variable and mapping the character string onto the report instead of looking at it in the debugger. When assigning my padded number to RV TEST, the TEST field showed on the report with no leading zeros. The debugger shows that the leading zeros are there in the report variable being used on the Fetch.

I've since gotten the F4311 lookup to work, am still not retrieving anything with the F4801 FetchSingle. Looking in the underlying database while running the lookup in debug, I can see I'm not pulling matches that should show up.

I've checked the Indices for F4801. There is standard one with Related Order No, Ty, Co. Since that is lacking the line number, I created a new one with RCTO, RORN, LNID, RKCO. In the debugger I can see that the values feeding in, basically just as shown in Remo's example above except that I use BC Company (CO). Yet the Fetch Single fails to find records that I know are there.
 
Sure enough. I blew away the Index I had built, created a new one using RORN, RCTO, RKCO, LNID and it worked like a charm.
 
Back
Top