cancel
Showing results for 
Search instead for 
Did you mean: 

Issue With end routine.

former_member183113
Active Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

former_member183113
Active Participant
0 Kudos

and at select statement we can use into corresponding fields ryt?

Former Member
0 Kudos

Hi Raki,

No need to mention explicitly as you have declared your internal table of type  /bi0/pinsp_lot. So it iwll automatically do corresponding.

Did the above code resolve your issue? if not then let me know we will resolve it.

Thanks

Amit

former_member183113
Active Participant
0 Kudos

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

fcorodriguezl
Contributor
0 Kudos

Hi Raki,

Try change in transformation rules for this fields with CONSTANT in blank.

I recommend not use corresponding fields, is better select all fields and assign.

Regards.

former_member183113
Active Participant
0 Kudos

Constant in Blank..can u please elaborate it?

former_member183113
Active Participant
0 Kudos

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

fcorodriguezl
Contributor
0 Kudos

Hi Raki, nice you solve the problem.

To answer your question, all depend, but maybe you can try change to integer.

Regards.

former_member220624
Contributor
0 Kudos

Hi Raki,

You can also do it in query level.

Set the decimal places to 0 in the setting.

Thanks,

Amit

former_member183113
Active Participant
0 Kudos

Hello,

This is solved on Saturday and i tried with  integer type keyfigure. now values are coming like 13 instead of 13,000.  thanks to all......

Answers (2)

Answers (2)

fcorodriguezl
Contributor
0 Kudos

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.

former_member183113
Active Participant
0 Kudos

TRIED THE SAME NOW. its not working. records are coming but blank values. some thing i am missing here.

former_member220624
Contributor
0 Kudos

Hi,

What you are missing is a Modify statement in the routine.

Please use Modify Result package at the end and let me know if this works.

Regards,

Amit.

former_member183113
Active Participant
0 Kudos

i thnk it is not required. because am using field symbols here.

former_member220624
Contributor
0 Kudos

did you give it a try?

former_member220624
Contributor
0 Kudos

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