Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with different storage location

Former Member
0 Kudos

Hi all,

Here i have one report which fetch data of material consumption. Report working properly. But here i have one Item like OIL and when this material use from two different storage location for making one Item. this time. My report fetch two time quantity value in ALV. means i am not getting sum of the use material like OIL which is use from two storage location.

So can u please kindly tell me how can i put If condition in my below coding . and this condition can i put on which table and which filed. Kindly tell me please.

My code is Below.



SELECT a~budat a~mblnr b~matnr b~menge b~bwart b~charg
         INTO CORRESPONDING FIELDS OF TABLE it_rawmat
         FROM    mkpf as a inner join mseg as b on a~mblnr = b~mblnr
         where b~bwart = '261' and b~werks in werks and b~matnr in matnr and a~budat in budat.



  IF sy-subrc <> 0.
    MESSAGE ' No Data For This Selection' TYPE 'I'.
    SUBMIT ZPP_RAWMAT_CONSUMPTION VIA SELECTION-SCREEN.

  ENDIF.

  LOOP AT it_rawmat.

    select single maktx
      from makt
      into it_rawmat-maktx
      where matnr = it_rawmat-matnr.

    select single matnr menge charg
      from mseg
      into (it_rawmat-matnr1, it_rawmat-menge1 , it_rawmat-charg1)
      where mblnr = it_rawmat-mblnr AND bwart = '131'.
      



      SELECT SINGLE maktx
        from makt
        into it_rawmat-maktx2
        where matnr = it_rawmat-matnr1.

      SELECT single matnr stlnr
       from mast
       INTO (it_rawmat-matnr3, it_rawmat-stlnr)
       where matnr = it_rawmat-matnr1.


       select SINGLE menge
         from stpo
         into it_rawmat-bomit
         where stlnr = it_rawmat-stlnr and idnrk = it_rawmat-matnr.

      if it_rawmat-bomit <> 0.
          it_rawmat-bom_prcntge = ( it_rawmat-bomit * 100 ).
      endif.

      CONCATENATE IT_RAWMAT-MATNR IT_RAWMAT-CHARG INTO IT_RAWMAT-objek.

       SELECT SINGLE CUOBJ
         FROM INOB
         INTO IT_RAWMAT-CUOBJ
      WHERE OBJEK = IT_RAWMAT-objek.

 IT_RAWMAT-OBJEK1 = IT_RAWMAT-CUOBJ .

 SELECT SINGLE ATWRT
       FROM AUSP
      INTO IT_RAWMAT-ATWRT
     WHERE OBJEK = IT_RAWMAT-OBJEK1.

Thanks

keyur chauhan

1 REPLY 1

Former Member
0 Kudos

not answer