Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2806

Transformation: Issue in End-Routine

$
0
0

Dear all ;

 

Currently I’m having an issue in the end routine and I hope you can help me.

 

The goal is, in a transformation between 2 DSOs, populate a counter.

 

In DSO 1 (source) I have as key the Delivery and Shipment (1:1) were in DSO 2 (target) the Delivery and Material. I can have multiple materials per delivery and the counter should be populated in all.

 

In the start routine:

    TYPES: BEGIN OF s_odgi,

      deliv_numb TYPE /bi0/oideliv_numb,

     /material TYPE //bi0/oimaterial,

    END OF s_odgi.

 

    DATA: it_odgi TYPE SORTED TABLE OF s_odgi

          WITH NON-UNIQUE KEY deliv_numb,

          wa_odgi TYPE s_odgi.

 

 

    DATA: it_odgi_aux TYPE STANDARD TABLE OF s_odgi,

          wa_odgi_aux TYPE s_odgi.

 

 

 

DATA: t_sp TYPE STANDARD TABLE OF _ty_s_sc_1 .

 

    REFRESH it_odgi.

 

    t_sp[] = SOURCE_PACKAGE[] .

 

    SORT t_sp BY deliv_numb .

    DELETE ADJACENT DUPLICATES FROM t_sp COMPARING deliv_numb .

    DELETE t_sp WHERE deliv_numb IS INITIAL .

 

 

      SELECT deliv_numb material

             INTO TABLE it_odgi_aux FROM /BIC/ADSO1V00

             FOR ALL ENTRIES IN t_sp

             WHERE deliv_numb = t_sp-deliv_numb.

      SORT it_odgi_aux BY deliv_numb material.

*      DELETE ADJACENT DUPLICATES FROM it_odgi_aux COMPARING

*      deliv_numb

*      material

*      .

 

      it_odgi[] = it_odgi_aux[].

      FREE it_odgi_aux.

    ENDIF.

 

In the transformation:

ZCOUNTER as constant 1

 

 

In the End-Routine:

    LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.

      CLEAR wa_odgi.

      LOOP AT it_odgi INTO wa_odgi

      WHERE DELIV_NUMB = <RESULT_FIELDS>-DELIV_NUMB.

        IF sy-subrc = 0.

          <RESULT_FIELDS>-material= wa_ODGI-material.

        ELSE.

          DELETE RESULT_PACKAGE.

        ENDIF.

      ENDLOOP.

    ENDLOOP.

 

 

I also try this one :

    LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>

    WHERE DELIV_NUMB IS NOT INITIAL.

      READ TABLE it_odgi INTO wa_odgi

      WITH TABLE KEY DELIV_NUMB = <RESULT_FIELDS>-DELIV_NUMB.

 

      IF sy-subrc = 0.

        <RESULT_FIELDS>-/material = wa_ODGI-material.

      ELSE.

        DELETE RESULT_PACKAGE.

      ENDIF.

    ENDLOOP.

 

But the result is the same : one the last material of the sort will be delivered.

I note the different materials are in it_odgi but the loop will overwrite the last one.

 

Can anyone help?

Thanks in advance


Viewing all articles
Browse latest Browse all 2806

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>