Skip to Content
author's profile photo Former Member
Former Member

Need to load data from ODS or master data table

Hi folks,

I have a a situation where I have to populate Profit Center into my ODS when I load my data. The criteria is that if GL Accounts begin with '4' or '5' or '7' load Profit Center from /BI0/QCOSTCENTER <b>(master data)</b> and if GL Accounts begin with '1' or '2' or '3' load profit center from /BIC/AZPCA_F0800 (<b>ODS</b>) Here the code which doesn't seem to work. Please help.

<b>Tables: /BI0/PGL_ACCOUNT,

/BI0/QCOSTCENTER,

/BIC/AZPCA_F0800.</b>

data : itab like DATA_PACKAGE occurs 1 with header line.

loop at DATA_PACKAGE into itab.

if DATA_PACKAGE-GL_ACCOUNT eq '4' or DATA_PACKAGE-GL_ACCOUNT eq '5' or DATA_PACKAGE-GL_ACCOUNT eq '7*'.

select single Profit_CTR into ITAB-PROFIT_CTR

from /BI0/QCOSTCENTER where

Costcenter = DATA_PACKAGE-costcenter.

if sy-subrc = 0.

endif.

DATA_PACKAGE-Profit_CTR = ITAB-PROFIT_CTR.

modify DATA_PACKAGE.

elseif DATA_PACKAGE-GL_ACCOUNT eq '1' or DATA_PACKAGE-GL_ACCOUNT eq '2' or DATA_PACKAGE-GL_ACCOUNT eq '3*'.

select single Profit_CTR into ITAB-PROFIT_CTR from /BIC/AZPCA_F0800

where GL_ACCOUNT = DATA_PACKAGE-GL_ACCOUNT.

endif.

DATA_PACKAGE-Profit_CTR = ITAB-PROFIT_CTR.

endloop.

It is not working. Waiting for your response.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2006 at 09:52 AM

    hi Asad,

    try ?

    DATA_PACKAGE-GL_ACCOUNT+0(1) = '4' or ...

    and put a break-point to debug

    ...

    break-point.

    loop ..

    ...

    /BI0/QCOSTCENTER is time-dependent, check if you need to specify date from - date to.

    hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2006 at 10:36 AM

    Hi,

    Try this..

    ****************************************

    Tables: /BI0/PGL_ACCOUNT,

    /BI0/QCOSTCENTER,

    /BIC/AZPCA_F0800.

    data : itab like DATA_PACKAGE occurs 1 with header line.

    loop at DATA_PACKAGE into itab.

    IF DATA_PACKAGE-GL_ACCOUNT(1) eq '4' or DATA_PACKAGE-GL_ACCOUNT(1) eq '5' or DATA_PACKAGE-GL_ACCOUNT(1) eq '7'.

    SELECT single Profit_CTR into ITAB-PROFIT_CTR

    from /BI0/QCOSTCENTER where

    Costcenter = DATA_PACKAGE-costcenter.

    IF sy-subrc EQ 0.

    DATA_PACKAGE-Profit_CTR = ITAB-PROFIT_CTR.

    modify DATA_PACKAGE.

    ENDIF.

    ELSEIF DATA_PACKAGE-GL_ACCOUNT(1) <= '3'.

    SELECT single Profit_CTR into ITAB-PROFIT_CTR from /BIC/AZPCA_F0800

    where GL_ACCOUNT = DATA_PACKAGE-GL_ACCOUNT.

    IF sy-subrc eq 0.

    DATA_PACKAGE-Profit_CTR = ITAB-PROFIT_CTR.

    modify DATA_PACKAGE.

    ENDIF.

    ENDIF.

    endloop.

    ***********************************

    Regards,

    San!

    Message was edited by: San!

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Try this

      SELECT single Profit_CTR into S_DATA-PROFIT_CTR

      from /BI0/QCOSTCENTER where

      CO_AREA =s_data-co_area

      AND Costcenter = S_DATA-costcenter

      AND OBJVERS = 'A'

      AND OBJ_CURR NE INITIAL.

      from this "It has profit center only in Q table" you mean that You don't have costcenter and controlling area

      Regards,

      San!

      Message was edited by: San!

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.