on 2015 May 14 4:02 PM
Hello Everyone,
I'm trying to do a look up in FOX to read Prices from another DSO. In my case, I won't be able to use "|" method as I need to loop Reference Data to apply some conditions. Prices DSO has the data at granularity customer & material, validity dates, price type. Filter was restricted to Plan DSO. Pricing DSO is already part of MP and Agg Level.
I don't see my code is working... even in debugging XF_REF_DATA internal table has Plan Data, not reference data. Am i missing something? I can see reference data for "|" method. Please let me know if you need more information. Thanks a lot for all your help.
Code:
CURDATE = VARV( 0DAT ).
FOREACH MATERIAL, CUSTOMER.
FOREACH MATERIAL_REF, CUSTOMER_REF,CALDAY_REF, CALDAY_FR, CALDAY_TO, CURRENCY, KNART IN REFDATA.
IF MATERIAL_REF = MATERIAL AND
KNART = 'ZNLP' AND
CURDATE >= CALDAY_FR AND
CURDATE <= CALDAY_TO.
L_LPRC = { 0KNVAL, CALDAY_REF, #, CUSTOMER_REF,CURRENCY,KNART, MATERIAL_REF, CALDAY_FR, CALDAY_TO }.
ENDIF.
ENDFOR.
{ 0PRICELIST, #, USD, CUSTOMER, #, #, MATERIAL, #, # } = L_LPRC.
ENDFOR.
Regards,
Benarji.
Request clarification before answering.
Hi Benarji,
your loops don´t work, becasue with the
FOREACH MATERIAL, CUSTOMER
you are within one combination of material and customer.
within this you can not do another loop for the same char.
regards
Cornelia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well, but as you experienced it - it is not working the way you defined the loops.
In your code you have to change as following:
1) take the material out of the fields to be changed, because of the IF MATERIAL_REF = MATERIAL
2) do the loops as below:
FOREACH CUSTOMER_REF, CALDAY_REF, CALDAY_FR, CALDAY_TO, CURRENCY, KNART IN REFDATA.
IF KNART = 'ZNLP' AND
change the logic here, you used the terms in wrong direction:
CALDAY_FR <= CURDATE AND
CALDAY_TO >= CURDATE.
L_LPRC = { 0KNVAL, CALDAY_REF, #, CUSTOMER_REF,CURRENCY,KNART, CALDAY_FR, CALDAY_TO }.
ENDIF.
ENDFOR.
foreach customer.
{ 0PRICELIST, #, USD, CUSTOMER, #, #, #, # } = L_LPRC.
ENDFOR.
what is still strange, if there are more than one data redord foun within the reference data, the last one will win ...
regards
Cornelia
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.