cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with end routine

Former Member
0 Kudos

Hi everybody!

This is the situation:

We have a transformation from a DSO to a CUBE. In the Cube we have the DOC_TYPE, but in the DSO we don't. So we do a lookup in the transformation to get the DOC_TYPE from a second DSO.

Until here we are OK. Then, in the end routine, we try to do the following: If a DOC_TYPE = 'ZNC' or 'ZND', then the ratios NETVAL_INV and INV_QTY must be equal zero for those records.

This is the code we are using:

DATA:

         DOC_TYPE type /BI0/OIDOC_TYPE,

         INV_QTY TYPE /BI0/OIINV_QTY,

         NETVAL_INV TYPE /BI0/OINETVAL_INV,

         lv_data type table of _ty_s_TG_1,

         wa_data type _ty_s_TG_1.

     loop at RESULT_PACKAGE into wa_data where doc_type = 'ZNC' or

     doc_type = 'ZND'.

       INV_QTY = '0'.

       NETVAL_INV = '0'.

       modify RESULT_PACKAGE from wa_data.

     endloop.

The DOC_TYPE has records, so the lookup is working fine, but the ratios netval_inv and inv_qty have quantities when they should be = '0'.

Accepted Solutions (0)

Answers (10)

Answers (10)

gabrielenosatti
Explorer
0 Kudos

Hi Ariel,

have a look at Nanda's reply: that's the suggested way to modify internal tables in transformation routines. That's what I'd write, but Nanda anticipated me.

Regards,

Gabriele

Former Member
0 Kudos

DATA:

         DOC_TYPE type /BI0/OIDOC_TYPE,

         INV_QTY TYPE /BIC/OIINV_QTY,

         NETVAL_INV TYPE /BIC/OINETVAL_INV,

         lv_data type table of _ty_s_TG_1,

         wa_data type _ty_s_TG_1.

     loop at RESULT_PACKAGE into wa_data where doc_type = 'ZNC' or

     doc_type = 'ZND'.

      <result_fields>- INV_QTY = '0'.

       <result_fileds>-NETVAL_INV = '0'.

       modify RESULT_PACKAGE from wa_data.

     endloop.

Thanks,

Dinesh.

Former Member
0 Kudos

Hi,

The code should be as follows:

DATA:

         DOC_TYPE type /BI0/OIDOC_TYPE,

         INV_QTY TYPE /BI0/OIINV_QTY,

         NETVAL_INV TYPE /BI0/OINETVAL_INV,

         lv_data type standard table of _ty_s_TG_1,

         wa_data type _ty_s_TG_1.

     loop at RESULT_PACKAGE into wa_data where doc_type = 'ZNC' or

     doc_type = 'ZND'.

       wa_data-INV_QTY= '0'.

       wa_data-NETVAL_INV = '0'.

       modify RESULT_PACKAGE from wa_data.

     endloop.

You have missed assigning the value to the work area in your code.

Regards,

Anupama

Loed
Active Contributor
0 Kudos

Hi Ariel,

Try to equate the value zero in the work area..

Do this:

DATA:

         DOC_TYPE type /BI0/OIDOC_TYPE,

         INV_QTY TYPE /BI0/OIINV_QTY,

         NETVAL_INV TYPE /BI0/OINETVAL_INV,

         lv_data type standard table of _ty_s_TG_1,

         wa_data type _ty_s_TG_1.

     loop at RESULT_PACKAGE into wa_data where doc_type = 'ZNC' or

     doc_type = 'ZND'.

       wa_data-INV_QTY = '0'.

       wa_data-NETVAL_INV = '0'.

       modify RESULT_PACKAGE from wa_data.

     endloop.


Just post here for any queries..

Regards,

Loed

vivek_ankit
Explorer
0 Kudos

Please share your full code please.

Thanks,

Vivek Ankit

former_member182346
Active Contributor
0 Kudos

Hi,

Try to update it with work area : update required fields with wa_data

ie :

wa_data-inv_qty = '0'.

wa_data-netval_inv = '0'.

Thank-You.

Regards,

VB

ccc_ccc
Active Contributor
0 Kudos

Hi Aiel,

Please try this code in end routine.

loop at result_package assigning <result_fields> where doc_type = 'ZNC' OR doc_type = 'ZND'.

<result_fields>-INV_QTY = '0'.

<result_fields>-NETVAL_INV = '0'.

endloop.

thank you,

Nanda

KodandaPani_KV
Active Contributor
0 Kudos

Hi,

above code you are not write the select query form DSO table which and with key fields combinations

please share the total code

-Phani.

anshu_lilhori
Active Contributor
0 Kudos

The lookup code on dso to get the doc type is also a part of end routine or its in start routine.

Can you share the complete code that you have in place.

Regards,

AL

KodandaPani_KV
Active Contributor
0 Kudos

Hi,

i think /BI0/OIINV_QTY and /BI0/OINETVAL_INV key have custom Key figures menas it will start -/BIC/XXXXX.

try the below code

DATA:

         DOC_TYPE type /BI0/OIDOC_TYPE,

         INV_QTY TYPE /BIC/OIINV_QTY,

         NETVAL_INV TYPE /BIC/OINETVAL_INV,

         lv_data type table of _ty_s_TG_1,

         wa_data type _ty_s_TG_1.

     loop at RESULT_PACKAGE into wa_data where doc_type = 'ZNC' or

     doc_type = 'ZND'.

       INV_QTY = '0'.

       NETVAL_INV = '0'.

       modify RESULT_PACKAGE from wa_data.

     endloop.

Thanks,

Phani.

carlospinto
Active Participant
0 Kudos

Hi Phani,

I am sorry, but I can't see the difference.

Thanks,

Carlos

Former Member
0 Kudos

your code

       INV_QTY = '0'.

       NETVAL_INV = '0'.

modifies the variables and not the record you are processing .

Using <result_fields> or adding wa_data like suggested

       wa_data-INV_QTY = '0'.

       wa_data-NETVAL_INV = '0'.

will solve.