on 09-03-2018 5:58 AM
Hi,
We are trying to lookup to another model X_PNL from X_PNLACC. With the following logic script mentioned below.
However, the data in X_PNLACC is getting multiplied 4 times to the original value and it is not fetching data at 1020 entity level. Only data at 1010 entity is getting fetched.
Since there are multiple entities too, do I need to create a separate variable for that and loop it in WHEN ?
*SELECT(%EX%,"[ID]","APL_ENTITY","[ENT_ATTR] = 'E'")
*SELECT(%ACC%,"[ID]","APL_ACCOUNTS","[PNL] = 'P'")
*LOOKUP X_PNL
*DIM APL_TIMES = %APL_TIMES_SET%
*DIM APL_KEYFIGURE = "AMT"
*DIM APL_PC = "PC_NONE"
*DIM APL_PRODUCT = "NOPRODUCT"
*DIM APL_CC = "NOCC"
*DIM APL_PLANYEAR = "NOPLANYEAR"
*DIM APL_AUDITTRAIL = "333"
*DIM APL_CURRENCY = "LC"
*DIM APL_CATEGORY = "ACT"
*FOR %V1% = %ACC%
*DIM X_%V1%:APL_ACCOUNTS = %V1%
*NEXT
*ENDLOOKUP
*XDIM_MEMBERSET APL_ACCOUNTS = %ACC%
*XDIM_MEMBERSET APL_TIMES = %APL_TIMES_SET%
*XDIM_MEMBERSET APL_KEYFIGURE = AMT,Dummy_test
*XDIM_MEMBERSET APL_PC = PC_NONE
*XDIM_MEMBERSET APL_PRODUCT = NOPRODUCT
*XDIM_MEMBERSET APL_CC = NOCC
*XDIM_MEMBERSET APL_PLANYEAR = NOPLANYEAR
*XDIM_MEMBERSET APL_AUDITTRAIL = 333
*XDIM_MEMBERSET APL_CURRENCY = LC
*XDIM_MEMBERSET APL_CATEGORY = ACT
*XDIM_MEMBERSET APL_ENTITY = %EX%
*WHEN APL_TIMES *IS %APL_TIMES_SET%
*WHEN APL_ENTITY *IS 1020,1010
*FOR %V2% = %ACC% *REC(EXPRESSION = LOOKUP(X_%V2%),APL_TIMES = %APL_TIMES_SET%,APL_ACCOUNTS = %V2%,APL_KEYFIGURE = Dummy_test) *NEXT
*ENDWHEN
*ENDWHEN
After you have provided a clear explanation I am able to answer your question!
First: *REC(EXPRESSION=LOOKUP(...),..) is never used to copy data from one model to another!
Second: you have to push data from source model to destination model using:
*DESTINATION_APP ... in the script called from source model
Third: If you want to launch the script from destination model you have to implement RUNLOGIC_PH badi
And the last thing - it's better to clear destination scope before copy
Hope it's clear!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks like it's a new Community bug! I will check and report.
Please accept the correct answer.
P.S. Code looks absolutely strange, can you explain the required logic in words, without code? And some data sample?
Please read: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Source model : X_PNL
We are trying to read the model X_PNL with lookup for a set of GL codes.
I have used a For loop for reading the List of GL's from X_PNL.
I am trying to read the GLs for a set of entities 1010,1020 etc.
With this current script am able to access only a single entity data.
I want the script to return a set of GLs against a set of entities for the scope defined.
Thank you.
There are a set of GLs against which monthly TB flows in model X_PNL, they have an attribute 'P' maintained against the property 'PNL'.
We want to lookup this set of GLs data in our model X_PNLACC.
I wrote a script that performs a lookup and returns the value of the GLs against specific entity '1010'.
Now I have a set of entities eg, 1010,1020,2010; against which I want those GLs.
I tried by creating another dynamic variable and then looping but I guess the method was wrong because it returned data for only 1010 and the value was 4 times the original value stored in backend.
Attaching below the code and ujkt log. Am sorry for the inconvenience before.
I have written *FOR/*NEXT to fetch dynamic set of GL codes and stored them in a variable. I am confused about the approach to take now for multiple entities.
LGX:
*LOOKUP APL_PNL
*DIM APL_TIMES = 2017.05
*DIM APL_KEYFIGURE = "AMT"
*DIM APL_PC = "PC_NONE"
*DIM APL_PRODUCT = "NOPRODUCT"
*DIM APL_CC = "NOCC"
*DIM APL_PLANYEAR = "NOPLANYEAR"
*DIM APL_AUDITTRAIL = "333"
*DIM APL_CURRENCY = "LC"
*DIM APL_CATEGORY = "ACT"
*DIM X_F02007:APL_ACCOUNTS = F02007
*DIM X_G04565:APL_ACCOUNTS = G04565
*DIM X_J01007:APL_ACCOUNTS = J01007
*DIM X_P01256:APL_ACCOUNTS = P01256
*ENDLOOKUP
*XDIM_MEMBERSET APL_ACCOUNTS = F02007,G04565,J01007,P01256
*XDIM_MEMBERSET APL_TIMES = 2017.05
*XDIM_MEMBERSET APL_KEYFIGURE = AMT,Dummy_test
*XDIM_MEMBERSET APL_PC = PC_NONE
*XDIM_MEMBERSET APL_PRODUCT = NOPRODUCT
*XDIM_MEMBERSET APL_CC = NOCC
*XDIM_MEMBERSET APL_PLANYEAR = NOPLANYEAR
*XDIM_MEMBERSET APL_AUDITTRAIL = 333
*XDIM_MEMBERSET APL_CURRENCY = LC
*XDIM_MEMBERSET APL_CATEGORY = ACT
*XDIM_MEMBERSET APL_ENTITY = 1010,1020
*WHEN APL_TIMES
*IS 2017.05
*WHEN APL_ENTITY
*IS 1020,1010
*REC(EXPRESSION = LOOKUP(X_F02007),APL_TIMES = 2017.05,APL_ACCOUNTS = F02007,APL_KEYFIGURE = Dummy_test)
*REC(EXPRESSION = LOOKUP(X_G04565),APL_TIMES = 2017.05,APL_ACCOUNTS = G04565,APL_KEYFIGURE = Dummy_test)
*REC(EXPRESSION = LOOKUP(X_J01007),APL_TIMES = 2017.05,APL_ACCOUNTS = J01007,APL_KEYFIGURE = Dummy_test)
*REC(EXPRESSION = LOOKUP(X_P01256),APL_TIMES = 2017.05,APL_ACCOUNTS = P01256,APL_KEYFIGURE = Dummy_test)
*ENDWHEN
*ENDWHEN
-------------------------------------------------------------------------------------------------------------------------------------
LOG:
FILE:\ROOT\WEBFOLDERS\ASIAN_PAINTS_LTD_NEW \ADMINAPP\APL_PNL_ACC\TEST.LGF
USER:P00117570
APPSET:ASIAN_PAINTS_LTD_NEW
APPLICATION:APL_PNL_ACC
[INFO] GET_DIM_LIST(): I_APPL_ID="APL_PNL_ACC", #dimensions=12
APL_ACCOUNTS,APL_AUDITTRAIL,APL_CATEGORY,APL_CC,APL_CURRENCY,APL_ENTITY,APL_KEYFIGURE,APL_PC,APL_PLANYEAR,APL_PRODUCT,APL_TIMES,MEASURES
#dim_memberset=11
APL_ACCOUNTS:F02007,G04565,J01007,P01256,4 in total.
APL_TIMES:2017.05,1 in total.
APL_KEYFIGURE:AMT,Dummy_test,2 in total.
APL_PC:PC_NONE,1 in total.
APL_PRODUCT:NOPRODUCT,1 in total.
APL_CC:NOCC,1 in total.
APL_PLANYEAR:NOPLANYEAR,1 in total.
APL_AUDITTRAIL:333,1 in total.
APL_CURRENCY:LC,1 in total.
APL_CATEGORY:ACT,1 in total.
APL_ENTITY:1010,1020,2 in total.
REC :LOOKUP(X_F02007)
REC :LOOKUP(X_G04565)
REC :LOOKUP(X_J01007)
REC :LOOKUP(X_P01256)
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 1.00 ms. 7 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
QUERY LOOKUP DATA FROM APPLICATION: APL_PNL
QUERY TIME : 0.00 ms. 4 RECORDS QUERIED OUT.
CALCULATION TIME IN TOTAL :0.00 ms.
4 RECORDS ARE GENERATED.
CALCULATION END.
SCRIPT RUNNING TIME IN TOTAL:1.00 s.
Sorry, but the following:
"We want to lookup this set of GLs data in our model X_PNLACC.
I wrote a script that performs a lookup and returns the value of the GLs against specific entity '1010'.
Now I have a set of entities eg, 1010,1020,2010; against which I want those GLs."
Is not a logic description!
The correct description is like:
I have the data in the model xxx with the scope ...
I want to copy this data to another model yyy
During copy I want to change dimensions zzz
Etc...
Sorry will try to be concise and specific now :
We have data in model X_PNL at the scope[these dimensions remain same for all the GLs and Entity]:
APL_TIMES = 2017.05
APL_KEYFIGURE = "AMT"
APL_PC = "PC_NONE"
APL_PRODUCT = "NOPRODUCT"
APL_CC = "NOCC"
APL_PLANYEAR = "NOPLANYEAR"
APL_AUDITTRAIL = "333"
APL_CURRENCY = "LC"
APL_CATEGORY = "ACT"
We want to copy the data to X_PNLACC at scope
While copying the data, I would change only one dimension(APL_KEYFIGURE) and copy the data as it is from the source model to here with rest of dimensions remaining constant.
APL_TIMES = 2017.05
APL_KEYFIGURE = "Dummy_test"
APL_PC = "PC_NONE"
APL_PRODUCT = "NOPRODUCT"
APL_CC = "NOCC"
APL_PLANYEAR = "NOPLANYEAR"
APL_AUDITTRAIL = "333"
APL_CURRENCY = "LC"
APL_CATEGORY = "ACT"
I have different Entities(1010,1020) for which I want to fetch data for the GLs.
Thank you for your co-operation !
Please correct line breaks, code unreadable!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
15 | |
4 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.