04-14-2009 11:06 PM
I am trying to do a lookup in a BI transformation routine to get a value for PROFIT_CTR via the MATERIAL data that I have coming from my DataSource. The field association I need doesn't exist except as an attribute on the MAT_PLANT InfoObject.
Here is my non-working code ... could somebody tell me what I am missing or doing wrong? Any insights are really appreciated.
CLASS lcl_transform IMPLEMENTATION.
METHOD compute_0PROFIT_CTR.
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS-MAT_PLANT TYPE /BI0/OIMAT_PLANT
EXPORTING
RESULT type tys_TG_1-PROFIT_CTR
DATA:
MONITOR_REC TYPE rsmonitor.
$$ begin of routine - insert your code only below this line -
... "insert your code here
*-- fill table "MONITOR" with values of structure "MONITOR_REC"
*- to make monitor entries
... "to cancel the update process
raise exception type CX_RSROUT_ABORT.
... "to skip a record
raise exception type CX_RSROUT_SKIP_RECORD.
... "to clear target fields
raise exception type CX_RSROUT_SKIP_VAL.
DATA PRFTCTR(6) TYPE C.
SELECT PROFIT_CTR
INTO PRFTCTR
FROM /BI0/PMAT_PLANT
WHERE MAT_PLANT = SOURCE_FIELDS-MAT_PLANT.
ENDSELECT.
RESULT = PRFTCTR.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_0PROFIT_CTR
04-15-2009 2:59 AM
Hi Vipul,
Can you change the your code from:
SELECT PROFIT_CTR
INTO PRFTCTR
FROM /BI0/PMAT_PLANT
WHERE MAT_PLANT = SOURCE_FIELDS-MAT_PLANT.
ENDSELECT.
to:
SELECT PROFIT_CTR
INTO PRFTCTR
FROM /BI0/PMAT_PLANT UP TO 1 ROWS
WHERE MAT_PLANT = SOURCE_FIELDS-MAT_PLANT.
ENDSELECT.
And...
Have you checked the table content that it really has value for the selected material plant?
Regards,
Lim...
Edited by: Ruslim Chang on Apr 15, 2009 4:00 AM
04-15-2009 3:54 AM
I think you may be writing routine in wrong place. just check value of PRFTCTR in runtime by hard coding break point with in the method.
CLASS lcl_transform IMPLEMENTATION.
METHOD compute_0PROFIT_CTR.
DATA:
MONITOR_REC TYPE rsmonitor.
DATA PRFTCTR(6) TYPE C.
break-point.
SELECT PROFIT_CTR
INTO PRFTCTR
FROM /BI0/PMAT_PLANT
WHERE MAT_PLANT = SOURCE_FIELDS-MAT_PLANT.
ENDSELECT.
*--if you are getting value of PRFTCTR, check structure of RESULT prameter. i think RESULT parametr having select option structure.
RESULT = PRFTCTR.
ENDMETHOD. "compute_0PROFIT_CTR