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.
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