Skip to Content

reading Reference in Data in FOX for reposting

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2010 at 04:33 AM

    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:

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0d7036a-55f0-2910-3ea2-cf6651269024?quicklink=events&overridelayout=true

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.