Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Code to derive the characteristic from attribute

Former Member
0 Likes
390

Hi there, Please help me with this code , I am trying to derive the profit center from cost center since profit center is available as attribute of cost center in the transformation in BI 7.0. Please revise the code and let me know if i can get it resolved

but this code is giving me error as below

Thanks

Soniya Kapoor

<b>Error</b>

E:The data object "L_S_COSTCENTER" has no structure and therefore no

component called "PROFIT_CTR". called "PROFIT_CTR".

<b>

ABAP Code</b>

DATA: l_th_costcenter TYPE HASHED TABLE OF /BI0/QCOSTCENTER

WITH UNIQUE KEY costcenter.

DATA : l_S_COSTCENTER.

DATA : PROFIT_CTR.

IF SOURCE_FIELDS-profit_ctr = space.

IF l_th_costcenter[] IS INITIAL.

SELECT * FROM /BI0/QCOSTCENTER INTO TABLE l_th_costcenter

WHERE objvers = `A`

AND datefrom <= sy-Cdate

AND dateto >= sy-Cdate.

ENDIF.

READ TABLE l_th_costcenter INTO l_S_COSTCENTER

WITH TABLE KEY

costcenter = SOURCE_FIELDS-costcenter.

IF SY-SUBRC = 0.

RESULT = L_S_COSTCENTER-profit_ctr.

ELSE.

RESULT = `DUMMY`

END IF.

ELSE.

RESULT = SOURCE_FIELDS - profit_ctr.

ENDIF.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
346

Do not use table kay....

Use "with key" instead.....

Hope this solution was helpful

PS : Please award points if helpful.

Hi there, Please help me with this code , I am trying to derive the profit center from cost center since profit center is available as attribute of cost center in the transformation in BI 7.0. Please revise the code and let me know if i can get it resolved

but this code is giving me error as below

Thanks

Soniya Kapoor

<b>Error</b>

E:The data object "L_S_COSTCENTER" has no structure and therefore no

component called "PROFIT_CTR". called "PROFIT_CTR".

<b>

ABAP Code</b>

DATA: l_th_costcenter TYPE HASHED TABLE OF /BI0/QCOSTCENTER

WITH UNIQUE KEY costcenter.

DATA : l_S_COSTCENTER.

DATA : PROFIT_CTR.

IF SOURCE_FIELDS-profit_ctr = space.

IF l_th_costcenter[] IS INITIAL.

SELECT * FROM /BI0/QCOSTCENTER INTO TABLE l_th_costcenter

WHERE objvers = `A`

AND datefrom <= sy-Cdate

AND dateto >= sy-Cdate.

ENDIF.

READ TABLE l_th_costcenter INTO l_S_COSTCENTER

WITH TABLE KEY

costcenter = SOURCE_FIELDS-costcenter.

IF SY-SUBRC = 0.

RESULT = L_S_COSTCENTER-profit_ctr.

ELSE.

RESULT = `DUMMY`

END IF.

ELSE.

RESULT = SOURCE_FIELDS - profit_ctr.

ENDIF.

1 REPLY 1
Read only

Former Member
0 Likes
347

Do not use table kay....

Use "with key" instead.....

Hope this solution was helpful

PS : Please award points if helpful.