on 10-07-2010 5:21 PM
Hi all,
I have some problem writing data for the below scenario .i am reposting using FOX code and doing some validation checks also.
Say for example : i have costcenter, division and subdivision. division and subdivision are atributes of costcenter.
Master data:
CC | DIV| SUBDIV |
abc| 123| A123 |
Transaction Data:
CC | DIV| SUBDIV |
abc| 456| A456 |
efg| 456| A456 |
my expected transactional data OUTPUT is:
CC | DIV| SUBDIV |
abc| 123| A123 |
efg| 123| A123 |
my scenario is to repost Div value from '456' to '123' and also sdiv values.
In the filter , I will restrict 'DIV'(write value) as variable input for end user. User enters value '123'.
My scenario is to repost all 'div' and 'subdiv' for all the costcenters. if it is feasible to work?
My question is how to read the data for 'Div' value '456' in Fox , if in the filter value '123' is restricted.
I tried the below fox code , but it did not work:
********
DATA CC_IC TYPE 0COSTCENTER.
DATA DIV_IC TYPE ZDIV.
DATA sDIV_IC TYPE ZSUBDIV.
DATA CC_m TYPE 0COSTCENTER.
DATA DIV_M TYPE ZDIV.
DATA sDIV_M TYPE ZSUBDIV.
DIV_IC = VARV (ZVAR).
FOREACH CC_IC.
IF DIV_M = DIV_IC.
CC = cc_IC.
DIV_M = ATRV(ZDIV,CC_IC).
sDIV_M = ATRV(ZSUBDIV,CC_IC).
FOREACH DIV_IC, SDIV_IC IN REFDATA.
{ZAMT , CC, DIV_M, SDIV_M} = {ZAMT , CC, DIV_IC, SDIV_IC}
{ZAMT , CC, DIV_IC, SDIV_IC} = 0.
ENDFOR.
ENDIF.
ENDFOR.
***********
thanks in advance.
Regards
Veera
Hi Veera,
As per my understanding whatever we restrict in filter is for both reading and writing to the underlying infoprovider,you can read the data which is not been restricted but cannot be amended .In your example you can read data for 456 as reference data but cann't amend it.System will through an error message when you will try to do so.
Now secondly I think your fox need to be corrected :
DATA CC_IC TYPE 0COSTCENTER.
DATA DIV_IC TYPE ZDIV.
DATA sDIV_IC TYPE ZSUBDIV.
DATA CC_m TYPE 0COSTCENTER.
DATA DIV_M TYPE ZDIV.
DATA sDIV_M TYPE ZSUBDIV.
*Current value of sub division from variable.Get subdivision ,cost cente correspondigly.
DIV_IC = VARV (ZVAR).
sDIV_IC = objv().
CC_IC = objv().
*Read Similar cost center through reference data.
FOREACH CC_m in refdata.
If CC_IC = CC_M.
DIV_M = ATRV('0COSTCENTER',CC_m).
*Check division is not similar.
IF DIV_M <> DIV_IC .
SDIV_M = ATRV(ZSUBDIV,CC_m).
*Copy values.
{ZAMT , CC_IC, sDIV_IC,DIV_IC} = {ZAMT , CC_m, DIV_M, sDIV_M}
{ZAMT , CC_m, DIV_M, sDIV_M} = 0.
endif.
endif.
ENDFOR.
Hope it may help.
Can refer to given link for any fox help:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Indu,
So in my case , I will not be able to amend the data for value '456' . So it looks like my requirement is not feasible.
I will look your updated code, OBJ() will be used to get the corresponding values of any master data right?
Thanks a lot for your file . I will go through it.
Regards,
veera
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.