on 10-10-2014 4:31 PM
Hello Experts,
I have an issue with my end routine. My requirement is need to populate the key figure "days over due" using a calculation (Inspection lot end date - date of UD) * (-1). To achieve this i have created a key figure "daysoverdue" (data type is Number and DEC) and assigend to infocube.Data source is DSO. And the Inspection lot end date and ate of UD are navigational attributes in DSO. so i have written logic to read P-Table of infoobject (Inspection lot). Because inspection lot end date and date of usage decision infoobjects are attributes for the infoobject inspection lot.
So , i have written end routine and executed the dtp. But DTP got failed with following error.
"error when converting data base field to target field.". Please refer my screen shots.( 2 screens).
And here is my code in end routine:
DATA: lt_insplot TYPE HASHED TABLE OF /bi0/pinsp_lot //Declared internal table type of master data table with keys from same table.
WITH UNIQUE KEY soursystem
insp_lot.
DATA: ls_insplot TYPE /bi0/pinsp_lot . // structure like master data table.
DATA: lv_lopendd TYPE char10, // variable like infoobject which is using in calculation.
lv_loeudc TYPE char10, // variable like infoobject which is using in calculation.
lv_nddeudc TYPE char10. // lv_nddeudc is lv_lopendd - lv_loeudc. because these two are date fields.so
have used two variables to get result.may be date fields cant subtract in bw.not sure.
SELECT soursystem
insp_lot
/bic/lopendd
/bic/loeudc
FROM /bi0/pinsp_lot
INTO TABLE lt_insplot
WHERE objvers = 'A'.
CONSTANTS: lv_one TYPE char2 VALUE '-1'. // actual formula is (0INSP_LOT__LOPENDD – 0INSP_LOT__LOEUDC) * (-1). so taken '-1' like this.
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_insplot INTO ls_insplot
WITH KEY soursystem =
<result_fields>-soursystem
insp_lot =
<result_fields>-insp_lot.
IF sy-subrc IS INITIAL.
lv_lopendd = ls_insplot-/bic/lopendd.
lv_loeudc = ls_insplot-/bic/loeudc.
lv_nddeudc = lv_lopendd - lv_loeudc.
<result_fields>-/bic/lodaysod = lv_nddeudc * lv_one.
ENDIF.
CLEAR: ls_insplot,
<result_fields>,
lv_lopendd,
lv_loeudc,
lv_nddeudc.
ENDLOOP.
REFRESH lt_insplot.
This is not allowing us to debug also. i tried with break points in generated display program using simulate option in dtp.
So please give me your valuable replies.
Regards,
Raki.
Hi Raki,
There are few corrections required in your code.
Remove the red ones in your code and it should work fine.
Also if you get a error can you try to find on which line you got the error. You might want to look in ST22.
*****
DATA: lt_insplot TYPE HASHED TABLE OF /bi0/pinsp_lot //Declared internal table type of master data table with keys from same table.
WITH UNIQUE KEY soursystem
insp_lot.
DATA: ls_insplot TYPE /bi0/pinsp_lot . // structure like master data table.
DATA: lv_lopendd TYPE char10, // variable like infoobject which is using in calculation.
lv_loeudc TYPE char10, // variable like infoobject which is using in calculation.
lv_nddeudc TYPE char10. // lv_nddeudc is lv_lopendd - lv_loeudc. because these two are date fields.so
have used two variables to get result.may be date fields cant subtract in bw.not sure.
SELECT soursystem
insp_lot
/bic/lopendd
/bic/loeudc
FROM /bi0/pinsp_lot
INTO TABLE lt_insplot
WHERE objvers = 'A'.
CONSTANTS: lv_one TYPE char2 VALUE '-1'. // actual formula is (0INSP_LOT__LOPENDD – 0INSP_LOT__LOEUDC) * (-1). so taken '-1' like this.
LOOP AT RESULT_PACKAGE ASSIGNING <result_fields>.
READ TABLE lt_insplot INTO ls_insplot
WITH KEY soursystem =
<result_fields>-soursystem
insp_lot =
<result_fields>-insp_lot.
IF sy-subrc IS INITIAL.
lv_lopendd = ls_insplot-/bic/lopendd.
lv_loeudc = ls_insplot-/bic/loeudc.
lv_nddeudc = lv_lopendd - lv_loeudc.
<result_fields>-/bic/lodaysod = (ls_insplot-/bic/lopendd - ls_insplot-/bic/loeudc ) * lv_one.
ENDIF.
CLEAR: ls_insplot,
* <result_fields>, " this is not required
lv_lopendd,
lv_loeudc,
lv_nddeudc.
ENDLOOP.
REFRESH lt_insplot.
********************
Thanks
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi thanks a lot for your reply the code which i have written here is not allowed me to debug. after writing into corresponding tables it is allowed me to debug. And DTP executed successfully. In debug i can see calculation is working fine. but data is showing blank values in cube for all fields except inspection lot number. i have checked the P -table. it is not showing any data. but in debug of end routine we can see data and calculation results too.......any idea??
Hi amit dahiya ,amit sharma & Francisco, thanx a lot for your time...issue resolved. i have removed <result_fields) from the CLEAR statement. byt the result is coming like 13,000. i want 13only. for this i need to change key figure properties in BW. or can we achive the same in Bex?? correct me if i am wrong.
regards,
Raki
Hi Raki,
I think you need change to date your vars lv_lopendd and lv_loeudc. Change your var lv_nddeudc to integer or num and try.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
By looking at the error message it seems the issue is while assigning the date fields.
Try using the DATS type for declaration for lv_lopendd, lv_loeudc, lv_nddeudc instead of char.
Hope this helps.
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.