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

Re: output problem in coois

$
0
0

Hi Prathmesh,

Last record is fetched because you have used LOOP statement instead of Read statement. Read statement always fetches single record which is first occured. In this case, Loop fully runs and fetches the last record.

LOOP AT it_afko INTO wa_afko.

     wa_final-aufnr = wa_afko-aufnr.

     wa_final-igmng = wa_afko-igmng.

     wa_final-plnbez = wa_afko-plnbez.

     wa_final-gamng = wa_afko-gamng.

     p_short = wa_afko-gamng - wa_afko-igmng.

     wa_final-p_short = p_short.

    

     CLEAR wa_aufm.


"Please Give appropriate condition

     READ TABLE it_aufm INTO wa_aufm WITH KEY aufnr = wa_afko-aufnr.

     IF sy-subrc = 0.

       IF wa_aufm-bwart = '101'.

         wa_final-erfmg = wa_aufm-erfmg.

         wa_final-matnr = wa_aufm-matnr.

         wa_final-erfme = wa_aufm-erfme.

         wa_final-charg = wa_aufm-charg.

         wa_final-werks = wa_aufm-werks.

         wa_final-lgort = wa_aufm-lgort.

         wa_final-bwart = wa_aufm-bwart.

       ELSEIF wa_aufm-bwart NE '101'.

         wa_final-erfmg = wa_aufm-erfmg.

         wa_final-matnr = wa_aufm-matnr.

         wa_final-erfme = wa_aufm-erfme.

         wa_final-charg = wa_aufm-charg.

         wa_final-werks = wa_aufm-werks.

         wa_final-lgort = wa_aufm-lgort.

         wa_final-bwart = wa_aufm-bwart.

       ENDIF.

     ENDIF.

     CLEAR wa_resb.

 

 

"Please Give the appropriate condition

     READ TABLE it_resb INTO wa_resb WITH  KEY aufnr = wa_afko-aufnr.

     IF sy-subrc = 0.

       IF wa_resb-shkzg = 'S'.

         wa_final-bdmng = wa_final-kzear - wa_resb-bdmng.

       ELSEIF wa_resb-shkzg = 'H'.

         wa_final-bdmng = wa_final-kzear + wa_resb-bdmng.

       ENDIF.

      

       IF wa_resb-shkzg = 'S'.

         wa_final-enmng = wa_final-kzear - wa_resb-enmng.

       ELSEIF wa_resb-shkzg = 'H'.

         wa_final-enmng = wa_final-kzear + wa_resb-enmng.

       ENDIF.

      

       p_rsb = wa_final-bdmng - wa_final-enmng.

       wa_final-posnr = wa_resb-posnr.

       wa_final-bdter = wa_resb-bdter.

       wa_final-p_rsb = p_rsb.

     ENDIF.

 

     CLEAR wa_aufm.

     APPEND wa_final TO it_final.

     CLEAR wa_final.

 

   ENDLOOP.

  

   SORT it_final by aufnr.

delete ADJACENT DUPLICATES FROM it_final COMPARING aufnr.

 

Regards

 

Rajkumar Narasimman


Viewing all articles
Browse latest Browse all 9159

Trending Articles



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