cancel
Showing results for 
Search instead for 
Did you mean: 

Start routine issue

former_member183113
Active Participant
0 Kudos

Hello All,

i have a requirement like below. After developing logik am getting empty values to that key figure in DSO. Wrote logik between DSO to DSO.

Requirement : Need to add a keyfigure : 0NETVAL_INV based on some conditions between DSo to DSo transformation. for this i used look up.Below is the code.

TYPES: BEGIN OF ty_zbt8,

bill_num   TYPE /bi0/oibill_num,

bill_item  TYPE /bi0/oibill_item,

         netval_inv TYPE /bi0/oinetval_inv,

bill_type  TYPE /bi0/oibill_type,

         doc_number TYPE /bi0/oidoc_number,

         s_ord_item TYPE /bi0/ois_ord_item,

       END OF ty_zbt8.

////Here zbt8 is lookup DSO. Our keyfigure hav to populate  from this DSO only.

DATA: lit_zbt8 TYPE STANDARD TABLE OF ty_zbt8,

      lwa_zbt8 TYPE ty_zbt8.

DATA : r_billtype TYPE RANGE OF /bic/azbt800-bill_type,

       r_btyp_wa  LIKE LINE OF r_billtype.

r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZBV'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZF2'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZF2C'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZG2'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZGS'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZIG'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZIV'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZL2'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZLFS'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZLFT'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZRE'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZS1'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZS2'.

      APPEND r_btyp_wa TO r_billtype.

      r_btyp_wa-sign = 'I'.

      r_btyp_wa-option = 'EQ'.

      r_btyp_wa-low = 'ZVS'.

      APPEND r_btyp_wa TO r_billtype.

      SELECT bill_num

bill_item

        SUM( netval_inv ) AS netval_inv

bill_type

doc_number

s_ord_item

*       SUM( NETVAL_INV ) AS NETVAL_INV

INTO TABLE lit_zbt8

FROM /bic/azbt800

WHERE bill_type IN r_billtype

GROUP BY bill_num bill_item netval_inv bill_type doc_number

s_ord_item.

      IF sy-subrc = 0.

        DELETE ADJACENT DUPLICATES FROM lit_zbt8 COMPARING

        netval_inv.

        SORT lit_zbt8 BY netval_inv.

      ENDIF.

    ENDIF.

Pls tell me what went wrong in this code?  Do the keys for both DSos ( lookup one also) should be same?

Regards,

Raki

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rai,

You have not a loop endloop statement?

Regards,

Gorka.

former_member183113
Active Participant
0 Kudos

actually am new to ABAP writing... may be missed it....

Former Member
0 Kudos

Hi Raki,

What do you want to do exactly?. Your code is a bit confusing for me.

Regards,

Gorka.

former_member183113
Active Participant
0 Kudos

Hello Gorka,

Actually i need to populate a keyfigure 0netval_inv using a lookup in start routine. i have included the same field in target DSO.

requirement  is :

Transformation to ZBT4 (target DSO )  to populate 0NETVAL_INV is SUM(ZBT8-NETVAL_INV) where S_ORD_ITEM = ZBT4-S_ORD_ITEM and DOC_NUMBER = ZBT4-DOC_NUMBER and BILL_TYPE is one of the following :

ZBV        Cash sale invoice

ZF2         Sales invoice

ZF2C      Sales invoice

ZG2        Credit memo

ZGS        Cancel ICM

ZIG         Internal credit memo

ZIV Intercompany invoice

ZL2         Debit memo

ZLFS       Cancellation invoice

ZLFT       LFT Posting Invoice

Here zbt8 is souc dso (lookup0 and zbt4 is target DSO.

Former Member
0 Kudos

Hi Raki,

And the key fields for both DSO's?

In your code you delete records and I do not why.

Regards,

Gorka.

former_member183113
Active Participant
0 Kudos

that deletion is to delete duplicate records if any are there....

former_member223526
Participant
0 Kudos

Hi Raki,

Are the Doc number and Order item combination not Unique in source DSO?

is the BILL_TYPE present in the target DSO.

Kindly make this clear.

Thanks,

Madhu.

former_member183113
Active Participant
0 Kudos

they are  unique

BILL_TYPE not present in target dso.


Thank you..

Former Member
0 Kudos

Please I am waiting for source dso key fields and target dso key fields.

You are deleting data by a key figure, if the value 50, for example, is repeated in various documents.... you want to delete them?

Former Member
0 Kudos

If I am not wrong... you are reading 13_vditm (zbt8 dso). Target is Consolidation DSO for sales order item which has billing done. Source is Sales order item

SELECT bill_num

bill_item

        SUM( netval_inv ) AS netval_inv

bill_type

doc_number

s_ord_item

*       SUM( NETVAL_INV ) AS NETVAL_INV

INTO TABLE lit_zbt8

FROM /bic/azbt800

for all entries in Source_package

WHERE bill_type IN r_billtype

doc_number = source_package-doc_number

s_ord_item = source_package-s_ord_item

GROUP BY bill_num bill_item bill_type doc_number

s_ord_item.

IF sy-subrc = 0.

        DELETE ADJACENT DUPLICATES FROM lit_zbt8 COMPARING

        bill_num bill_item.

        SORT lit_zbt8 BY doc_number s_ord_item.

      ENDIF.

ENDIF.

Loop at source_package assiging <sp>

     read table lit_zbt8 into wa_zbt8 with key doc_number = <sp>-doc_number s_ord_item = <sp>-s_ord_item binary search.

     if sy-subrc eq 0.

     <sp>-netval_inv = wa_zbt8-net_inv

     endif.

endloop.

Answers (0)