Stock report with date range

Hi Experts.
Material stock report (unrestricted, blocked, quality) with in date range.
getting information in T-CODE:  MB52 but not in date range.
In mard table i did't find the date for unrestricted, blocked and quality.
from where can i get that information and how should i link all
Need a psudo code for it.
If any one worked on this kind of object plz send me the code.
Points assured..
Regards..
Ravi Reddy.

Hi
Check this sample code hope it will helpfull for you
*DATA: ED TYPE F.
DATA : ED(15) TYPE N .
TABLES: EKKO, EKBE, EKPO, KONH , KONV ,LFA1 ,ESLL.
TYPE-POOLS: SLIS.
DATA: val1  like konh-vakey.
Data:GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
     G_REPID LIKE SY-REPID,
     G_GRID_TITLE TYPE LVC_TITLE.
Data:G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
DATA:G_TABNAME TYPE SLIS_TABNAME VALUE 'ITAB1',
G_SAVE .
DATA:GS_VARIANT LIKE DISVARIANT.
DATA:LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA:GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
     G_SAVE = 'A'.
DATA: BEGIN OF ITAB OCCURS 10,
          EBELN LIKE EKKO-EBELN,
*          LIFNR  like p_vendor,
          LIFNR LIKE EKKO-LIFNR,
          NAME1 LIKE LFA1-NAME1,
          NAME2 LIKE LFA1-NAME2,
*          EBELP LIKE EKBE-EBELP,
          BELNR LIKE EKBE-BELNR,
          VGABE LIKE EKBE-VGABE,
          GJAHR LIKE EKBE-GJAHR,
          KNUMV LIKE EKKO-KNUMV,
          EKORG LIKE EKKO-EKORG,
          BEDAT LIKE EKKO-BEDAT,
*          VAKEY LIKE KONH-VAKEY,
     END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 10,
          NAME1 LIKE LFA1-NAME1,
          NAME2 LIKE LFA1-NAME2,
          EBELN LIKE EKPO-EBELN,
          LIFNR LIKE EKKO-LIFNR,
          EBELP LIKE EKPO-EBELP,
*          EBELP LIKE EKBE-EBELP,
          KNUMH LIKE KONH-KNUMH,
          BELNR LIKE EKBE-BELNR,
          MATNR LIKE EKPO-MATNR,
          TXZ01 LIKE EKPO-TXZ01,
          PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
          EXTROW LIKE ESLL-EXTROW,
          SRVPOS LIKE ESLL-SRVPOS,
          KTEXT1 LIKE ESLL-KTEXT1,
          KOSTL LIKE EKKN-KOSTL,
          NETPR LIKE EKPO-NETPR,
          NETWR LIKE EKPO-NETWR,
          ED1  TYPE p decimals 2,
          KBETR2 LIKE KONV-KBETR,
          KBETR1 LIKE KONV-KBETR,
          KBETR LIKE KONV-KBETR,
*          KBETR3 LIKE KONV-KBETR,
          KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
          KWERT1 LIKE KONV-KWERT, " THIS IS FOR PBXX OR PB00
          KWERT2 LIKE KONV-KWERT, " THIS FOR OTHER CONDITION
          MENGE LIKE EKPO-MENGE,
*          TOTAL(15) type  .
          TOTAL TYPE p decimals 2,
          VAKEY LIKE KONH-VAKEY,
          WERKS LIKE EKPO-WERKS,
          MWSKZ LIKE EKPO-MWSKZ,
          PACKNO LIKE EKPO-PACKNO,
          KNUMV LIKE KONV-KNUMV,
          SUB_PACKNO LIKE ESLL-SUB_PACKNO,
          GJAHR LIKE RSEG-GJAHR,
      END OF ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 10,
         EBELN LIKE EKKN-EBELN,
         EBELP LIKE EKKN-EBELP,
         PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
         KOSTL      LIKE EKKN-KOSTL,
      END OF ITAB2.
data: begin of itab3 occurs 10,
        KNUMH LIKE KONH-KNUMH,
        KSCHL LIKE KONH-KSCHL,
     end of itab3.
data: begin of itab4 occurs 10,
        KBETR LIKE KONP-KBETR,
      end of itab4.
data: begin of itab5 occurs 10,
        KPOSN LIKE KONV-KPOSN,
        KNUMV LIKE KONV-KNUMV,
        KSCHL LIKE KONV-KSCHL,
        KBETR LIKE KONV-KBETR,
        KWERT LIKE KONV-KWERT, " THIS IS FOR FREIGHT
*          KAWRT LIKE KONV-KAWRT,
     end of itab5.
DATA: BEGIN OF ITAB6 OCCURS 10,
*          PACKNO LIKE EKPO-PACKNO,
          SUB_PACKNO LIKE ESLL-SUB_PACKNO,
        END OF ITAB6.
DATA: BEGIN OF ITAB7 OCCURS 10,
       BELNR LIKE RSEG-BELNR,
       GJAHR LIKE RSEG-GJAHR,
END OF ITAB7.
DATA: BEGIN OF ITAB8 OCCURS 10,
       SUB_PACKNO LIKE ESLL-SUB_PACKNO,
       SRVPOS LIKE ESLL-SRVPOS,
       EXTROW LIKE ESLL-EXTROW,
       KTEXT1 LIKE ESLL-KTEXT1,
END OF ITAB8.
*selection-screen
*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*SELECTION-SCREEN SKIP 2.
*SELECTION-SCREEN BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 25(23) text-002.
**SELECT-OPTIONS: s_lifnr FOR ekko-lifnr.
*PARAMETERS:p_lifnr LIKE ekko-lifnr obligatory.
*SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
  PERFORM get_data.
*  PERFORM field_catalog.
*  PERFORM display_data.
END-OF-SELECTION.
**&      Form  display_data
**       text
*FORM display_data.
*data: new(15) TYPE N.
*  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
*    EXPORTING
*      i_callback_program = sy-repid
*      it_fieldcat        = int_cat[]
*    TABLES
*      t_outtab           = int_out
*    EXCEPTIONS
*      program_error      = 1
*      OTHERS             = 2.
*ENDFORM.                    "display_data
PERFORM GET_DATA.
PERFORM CALL_ALV_GRID.
FORM CALL_ALV_GRID.
PERFORM FIELDCAT_INIT USING GT_FIELDCAT[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM                = G_repid
      I_CALLBACK_USER_COMMAND           = G_USER_COMMAND
      I_GRID_TITLE                      = G_GRID_TITLE
      IT_FIELDCAT                       = GT_FIELDCAT[]
      I_DEFAULT                         = 'X'
      I_SAVE                            =  G_SAVE
      IS_VARIANT                        =  Gs_VARIANT
    TABLES
      T_OUTTAB                          = ITAB1.
ENDFORM.
FORM FIELDCAT_INIT
       USING RT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-seltext_l     = 'Vendo No'.
  LS_FIELDCAT-FIELDNAME     = 'LIFNR'.
  LS_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
  LS_FIELDCAT-REF_TABNAME   = 'EKKO'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
   CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L  = 'Vendor Name'.
  LS_FIELDCAT-FIELDNAME     = 'NAME1'.
  LS_FIELDCAT-REF_FIELDNAME = 'NAME1'.
  LS_FIELDCAT-REF_TABNAME   = 'LFA1'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-FIELDNAME     = 'NAME2'.
*  LS_FIELDCAT-REF_FIELDNAME = 'NAME2'.
*  LS_FIELDCAT-REF_TABNAME   = 'LFA1'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-seltext_l   = 'Purchase Document No'.
  LS_FIELDCAT-FIELDNAME     = 'EBELN'.
  LS_FIELDCAT-REF_FIELDNAME = 'EBELN'.
  LS_FIELDCAT-REF_TABNAME   = 'EKKO'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*  CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-FIELDNAME     = 'VGABE'.
*  LS_FIELDCAT-REF_FIELDNAME = 'VGABE'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKBE'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L     = 'Item No'.
  LS_FIELDCAT-FIELDNAME     = 'EBELP'.
  LS_FIELDCAT-REF_FIELDNAME = 'EBELP'.
  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*  CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-FIELDNAME     = 'BELNR'.
*  LS_FIELDCAT-REF_FIELDNAME = 'BELNR'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKBE'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
   CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L     = 'Document Con'.
  LS_FIELDCAT-FIELDNAME     = 'KNUMH'.
  LS_FIELDCAT-REF_FIELDNAME = 'KNUMH'.
  LS_FIELDCAT-REF_TABNAME   = 'KONH'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L = 'Service/Material No'.
*  LS_FIELDCAT-FIELDNAME     = 'MATNR'.
*  LS_FIELDCAT-REF_FIELDNAME = 'MATNR'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L = 'Service / Material description' .
*  LS_FIELDCAT-FIELDNAME     = 'TXZ01'.
*  LS_FIELDCAT-REF_FIELDNAME = 'TXZ01'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L =  'WBS Element' .
*  LS_FIELDCAT-FIELDNAME     = 'PS_PSP_PNR'.
*  LS_FIELDCAT-REF_FIELDNAME = 'PS_PSP_PNR'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L =  'Serial Number' .
*  LS_FIELDCAT-FIELDNAME     = 'EXTROW'.
*  LS_FIELDCAT-REF_FIELDNAME = 'PACKNO'.
*  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*  CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L =  'Service Number' .
*  LS_FIELDCAT-FIELDNAME     = 'SRVPOS'.
*  LS_FIELDCAT-REF_FIELDNAME = 'SRVPOS'.
*  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L =  'Dscription' .
*  LS_FIELDCAT-FIELDNAME     = 'KTEXT1'.
*  LS_FIELDCAT-REF_FIELDNAME = 'KTEXT1'.
*  LS_FIELDCAT-REF_TABNAME   = 'ESLL'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*   CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*    LS_FIELDCAT-SELTEXT_L = 'Cost Center'.
*  LS_FIELDCAT-FIELDNAME     = 'KOSTL'.
*  LS_FIELDCAT-REF_FIELDNAME = 'KOSTL'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-FIELDNAME     = 'NETWR'.
  LS_FIELDCAT-FIELDNAME     = 'NETPR'.
  LS_FIELDCAT-reptext_ddic = 'Basic'.
*  LS_FIELDCAT-SELTEXT_L    = 'Basic'.
   LS_FIELDCAT-REF_FIELDNAME = 'NETPR'.
  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-FIELDNAME     = 'NETWR'.
*  LS_FIELDCAT-FIELDNAME     = 'NETPR'.
*  LS_FIELDCAT-reptext_ddic = ''.
*  LS_FIELDCAT-SELTEXT_L    = 'Basic'.
   LS_FIELDCAT-REF_FIELDNAME = 'NETWR'.
  LS_FIELDCAT-REF_TABNAME   = 'EKPO'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
    LS_FIELDCAT-SELTEXT_L = 'Excise'.
  LS_FIELDCAT-FIELDNAME     = 'ED1'.
  LS_FIELDCAT-REF_FIELDNAME = 'ED1'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
   CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L = 'Insurance'.
  LS_FIELDCAT-FIELDNAME     = 'KBETR2'.
    LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L     = 'Frieght'.
  LS_FIELDCAT-FIELDNAME     = 'KWERT'.
  LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
* CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L     = '' .
*  LS_FIELDCAT-FIELDNAME     = 'KBETR1'.
*  LS_FIELDCAT-REF_FIELDNAME = 'KBETR'.
*  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
*CLEAR LS_FIELDCAT.
*  LS_FIELDCAT-TABNAME       = G_TABNAME.
*  LS_FIELDCAT-SELTEXT_L     = 'PBXX'.
*  LS_FIELDCAT-FIELDNAME     = 'KWERT1'.
*  LS_FIELDCAT-REF_FIELDNAME = 'KWERT'.
*  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
*  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L     = 'VAT/ST '.
  LS_FIELDCAT-FIELDNAME     = 'KBETR'.
  LS_FIELDCAT-REF_FIELDNAME = "KBETR".
  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L     = 'OTHER '.
  LS_FIELDCAT-FIELDNAME     = 'KWERT2'.
  LS_FIELDCAT-REF_FIELDNAME = "KWERT".
  LS_FIELDCAT-REF_TABNAME   = 'KONV'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
  CLEAR LS_FIELDCAT.
  LS_FIELDCAT-TABNAME       = G_TABNAME.
  LS_FIELDCAT-SELTEXT_L = 'TOTAL'.
  LS_FIELDCAT-FIELDNAME     = 'TOTAL'.
  LS_FIELDCAT-REF_FIELDNAME = 'TOTAL'.
*  LS_FIELDCAT-REF_TABNAME   = 'EKKN'.
  APPEND LS_FIELDCAT TO  RT_FIELDCAT.
   ENDFORM.                    " FIELDCAT_INIT
   FORM GET_DATA.
   SELECT  A~EBELN A~LIFNR  A~EKORG A~KNUMV B~VGABE  B~GJAHR B~BELNR
           L~NAME1 L~NAME2
        FROM  EKKO AS A
                      INNER JOIN EKBE  AS B ON  B~EBELN = A~EBELN
                      INNER JOIN LFA1 AS L ON L~LIFNR = A~LIFNR
                      INTO  CORRESPONDING
                      FIELDS OF TABLE ITAB.
*                      WHERE B~VGABE = '2'.
SELECT EKPO~EBELN EKPO~EBELP EKPO~MATNR EKPO~TXZ01 EKPO~WERKS
          EKPO~NETWR EKPO~MENGE EKPO~MWSKZ  EKPO~NETPR EKPO~PACKNO
          FROM EKPO
                    INTO CORRESPONDING FIELDS OF TABLE ITAB1
                    FOR ALL ENTRIES IN ITAB
                    WHERE EKPO~EBELN = ITAB-EBELN and
                          EKPO~BUKRS = 'company code'.
   SELECT EKKN~EBELN EKKN~EBELP EKKN~KOSTL EKKN~PS_PSP_PNR
      FROM EKKN
               INTO CORRESPONDING FIELDS OF TABLE ITAB2
               FOR ALL ENTRIES IN ITAB1
               WHERE EKKN~EBELN = ITAB1-EBELN  AND
                     EKKN~EBELP = ITAB1-EBELP.
   SELECT KONV~KNUMV KONV~KSCHL KONV~KBETR KONV~KWERT KONV~KWERT
              KONV~KPOSN
      FROM KONV
          INTO CORRESPONDING FIELDS OF TABLE ITAB5
          WHERE KONV~KNUMV =   ITAB1-KNUMV AND
                KONV~KPOSN = ITAB1-EBELP.
*    SELECT LFA1~NAME1 LFA1~NAME2 FROM LFA1
*    INTO CORRESPONDING FIELDS OF TABLE ITAB1
*    WHERE  LFA1~LIFNR = ITAB-LIFNR.
*  SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
*           ESLL~EXTROW  ESLL~KTEXT1 FROM ESLL
*       INTO CORRESPONDING FIELDS OF TABLE ITAB6
*       FOR ALL ENTRIES IN ITAB1
*       WHERE ESLL~PACKNO = ITAB1-PACKNO .
**         SELECT ESLL~SUB_PACKNO FROM ESLL
**       INTO CORRESPONDING FIELDS OF TABLE ITAB6
**       FOR ALL ENTRIES IN ITAB1
**       WHERE ESLL~PACKNO = ITAB1-PACKNO.
*        SELECT ESLL~SUB_PACKNO ESLL~SRVPOS
*           ESLL~EXTROW  ESLL~KTEXT1 FROM ESLL
*       INTO CORRESPONDING FIELDS OF TABLE ITAB8
*       FOR ALL ENTRIES IN ITAB6
*       WHERE ESLL~PACKNO = ITAB6-SUB_PACKNO .
* SELECT RSEG~BELNR RSEG~GJAHR FROM RSEG
*        INTO CORRESPONDING FIELDS OF TABLE  ITAB7
*        FOR ALL ENTRIES IN ITAB
*        WHERE RSEG~BELNR = ITAB-BELNR AND
*              RSEG~GJAHR = ITAB-GJAHR.
*LOOP AT ITAB1.
LOOP AT ITAB.
              READ TABLE ITAB1 WITH KEY EBELN = ITAB-EBELN.
*         IF ITAB1-EBELN = ITAB-EBELN.
                IF sy-subrc eq 0.
*                          ITAB1-EBELN = ITAB-EBELN.
                          ITAB1-LIFNR = ITAB-LIFNR.
*                          ITAB1-EBELP = ITAB-EBELP.
                          ITAB1-BELNR = ITAB-BELNR.
                          ITAB1-KNUMV = ITAB-KNUMV.
                          ITAB1-NAME1  = ITAB-NAME1.
                          ITAB-NAME2 = ITAB-NAME2.
                          ITAB1-GJAHR = ITAB-GJAHR.
                modify itab1 index   sy-tabix.
        ENDIF.
ENDLOOP.
*LOOP AT ITAB2.
*         READ TABLE ITAB1 WITH KEY EBELN = ITAB2-EBELN.
*          IF sy-subrc eq 0.
*              ITAB1-EBELN = ITAB2-EBELN.
*              ITAB1-PS_PSP_PNR = ITAB2-PS_PSP_PNR.
*              ITAB1-KOSTL = ITAB2-KOSTL.
*               modify itab1 transporting ps_psp_pnr kostl
*               where ebeln = Itab2-ebeln AND EBELP = ITAB2-EBELP.
*          ENDIF.
*ENDLOOP.
LOOP AT ITAB1.
**ON CHANGE OF   ITAB1-ebeln or itab1-ebelp.
*     concatenate itab1-werks itab1-lifnr itab1-matnr
*         into val1.
*   MOVE VAL1 TO ITAB1-VAKEY.
*   MODIFY ITAB1.
*    SELECT KONH~KNUMH KONH~KSCHL FROM KONH
*        INTO  CORRESPONDING FIELDS OF TABLE ITAB3
*        FOR ALL ENTRIES IN ITAB1
*        WHERE KONH~VAKEY = ITAB1-VAKEY.
**endon.
**        sort Itab3 by kschl descending.
**        Select konp-kbetr  from konp into itab4 where
**        KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL.
**ON CHANGE OF  ITAB1-ebelp.
**LOOP AT ITAB3
**  ON CHANGE OF  ITAB1-ebelp.
*              itab1-knumh = itab3-knumh.
**              SELECT  KONP~KBETR FROM KONP INTO CORRESPONDING FIELDS
**              OF  TABLE  ITAB4
**              FOR ALL ENTRIES IN ITAB3   WHERE
**              KONP~KNUMH = ITAB3-KNUMH AND KONP~KSCHL = ITAB3-KSCHL .
**              IF ITAB3-KSCHL = 'JMOP' .
**               ED = ITAB4-KBETR / 1000 * ITAB1-NETWR .
**              ENDIF.
**             IF ITAB3-KSCHL = 'JEC1'.
**              Itab1-ed1 = ITAB4-KBETR / 1000 * ED.
**              ADD ED TO ITAB1-ED1.
**             modify  ITAB1 transporting ed1.
**             ENDIF.
*              IF ITAB3-KSCHL = 'JMOP' .
*               ED = 16 / 100 * ITAB1-NETWR .
*              ENDIF.
*             IF ITAB3-KSCHL = 'JEC1'.
*              Itab1-ed1 = 2 / 100 * ED.
*              ADD ED TO ITAB1-ED1.
*             modify  ITAB1 transporting ed1.
*             ENDIF.
**        ENDLOOP.
**endon.
modify  ITAB1.
*endon.
  LOOP AT ITAB5.
     IF ITAB5-KSCHL = 'NAVS' OR ITAB5-KSCHL = 'NAVM'.
            ITAB1-KBETR = ITAB5-KBETR.
             modify  ITAB1 transporting KBETR
             where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP .
           ELSEIF ITAB5-KSCHL = 'FRA1' OR ITAB5-KSCHL = 'FRC1' OR
                ITAB5-KSCHL = 'FRB1'.
                   ITAB1-KWERT = ITAB5-KWERT .
                   modify  ITAB1 transporting KWERT
                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
*               IF ITAB5-KSCHL = 'FRA1'.
*                    ITAB1-KBETR1 = ITAB5-KBETR / 1000 * ITAB1-NETWR .
*                   modify  ITAB1 transporting KBETR1
*                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
*                 ELSEIF ITAB5-KSCHL = 'FRC1' .
*                   ITAB1-KBETR1 = ITAB5-KBETR * ITAB1-MENGE .
*                   modify  ITAB1 transporting KBETR1
*                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
*                 ELSEIF ITAB5-KSCHL = 'FRB1' .
*                    ITAB1-KBETR1 = ITAB5-KBETR .
*                   modify  ITAB1 transporting KBETR1
*                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
*              ENDIF.
*           **THIS  CODE IS FOR iNSURANCE  CONDITION
           ELSEIF ITAB5-KSCHL = 'ZGIN' OR ITAB5-KSCHL = 'ZIN2'.
                   ITAB1-KBETR2 = ITAB5-KBETR.
                   modify  ITAB1 transporting KBETR2
                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
*           **THIS  CODE IS FOR PBXX OR PB00  CONDITION
*          ELSEIF ITAB5-KSCHL = 'PBXX' OR ITAB5-KSCHL = 'PB00'.
*                   ITAB1-KWERT1 = ITAB5-KWERT1.
*                   modify  ITAB1 transporting KWERT1
*                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
**          ELSEIF ITAB5-KSCHL = 'JOCM' OR ITAB5-KSCHL = 'RA00' OR
**                 ITAB5-KSCHL = 'RA01' OR ITAB5-KSCHL = 'RB00' OR
**                 ITAB5-KSCHL = 'RC00' OR
**THIS  CODE IS FOR OTHER CONDITION
           ELSEIF ITAB5-KSCHL = 'RL01' OR ITAB5-KSCHL = 'ZA00' OR
                 ITAB5-KSCHL = 'ZA01' OR ITAB5-KSCHL = 'ZAE1' OR
                 ITAB5-KSCHL = 'ZAED' OR
                 ITAB5-KSCHL = 'ZAFR' OR ITAB5-KSCHL = 'ZB00' OR
                 ITAB5-KSCHL = 'ZBCH' OR ITAB5-KSCHL = 'ZBED' OR
                 ITAB5-KSCHL = 'ZC00' OR
                 ITAB5-KSCHL = 'ZCEX' OR ITAB5-KSCHL = 'ZCIF' OR
                 ITAB5-KSCHL = 'ZHC1' OR ITAB5-KSCHL = 'ZHC2' OR
                 ITAB5-KSCHL = 'ZHCT' OR
                 ITAB5-KSCHL = 'ZHCV' OR ITAB5-KSCHL = 'ZJOC' OR
                 ITAB5-KSCHL = 'ZOTH' OR ITAB5-KSCHL = 'ZOTP' OR
                 ITAB5-KSCHL = 'ZOTT' OR
                 ITAB5-KSCHL = 'ZPK1' OR ITAB5-KSCHL = 'ZPK2' OR
                 ITAB5-KSCHL = 'ZPK3' OR ITAB5-KSCHL = 'ZPK4' OR
                 ITAB5-KSCHL = 'ZRPO' OR
                 ITAB5-KSCHL = 'ZSE1' OR ITAB5-KSCHL = 'ZSED' OR
                 ITAB5-KSCHL = 'ZSFR' OR ITAB5-KSCHL = 'ZSTX' OR
                 ITAB5-KSCHL = 'ZTPI' OR
                 ITAB5-KSCHL = 'ZTPV' OR ITAB5-KSCHL = 'ZTRD' OR
                 ITAB5-KSCHL = 'ZWCT'.
                   ITAB1-KWERT2 = ITAB5-KWERT.
                   modify  ITAB1 transporting KWERT2
                   where  KNUMV =  ITAB1-KNUMV AND EBELP = ITAB1-EBELP
          modify itab1.
       ENDIF.
ENDLOOP .
ITAB1-TOTAL = ITAB1-NETWR + ITAB1-KWERT2 + ITAB1-KWERT + ITAB1-KBETR.
*              ITAB1-TOTAL = ITAB1-NETWR + ITAB1-ED1 + ITAB1-KBETR2 +
*                     ITAB1-KBETR1 + ITAB1-KBETR + ITAB1-KWERT   .
                 modify  ITAB1 transporting TOTAL.
LOOP AT ITAB6.
          ITAB1-SUB_PACKNO = ITAB6-SUB_PACKNO.
*           modify  ITAB1.
ENDLOOP.
LOOP AT ITAB7.
        ITAB1-BELNR = ITAB7-BELNR.
        ITAB1-GJAHR = ITAB7-GJAHR.
  ENDLOOP.
LOOP AT ITAB8.
          ITAB1-SUB_PACKNO = ITAB8-SUB_PACKNO.
          ITAB1-SRVPOS  = ITAB8-SRVPOS.
          ITAB1-EXTROW = ITAB8-EXTROW.
          ITAB1-KTEXT1 = ITAB8-KTEXT1.
          modify  ITAB1.
ENDLOOP.
* SELECT ESLL~PACKNO ESLL~SUB_PACKNO ESLL~SRVPOS ESLL~KTEXT1
*          FROM ESLL
*          INTO CORRESPONDING FIELDS OF TABLE ITAB6
*          WHERE ESLL~PACKNO = ITAB1-PACKNO.
** delete  adjacent  duplicates  from itab1 comparing EBELN .
modify  ITAB1.
endloop.
sort Itab1 by EBELN Ascending.
        SELECT KONV~KBETR FROM KONV
        INTO ITAB1-KBETR
        WHERE KONV~KSCHL =  'NAVS' OR KONV~KSCHL = 'NAVM'.
        ENDSELECT.
        ITAB1-KBETR = ITAB5-KBETR.
*ENDLOOP.
*ENDLOOP.
*ENDLOOP.
ENDFORM.
Reward all helpfull answers
Regards
Pavan

Similar Messages

  • Report with date range where the daily customer receipt profit centre wise

    Hi Experts,
    Could you please suggest me is there any developed  standard report or t-cod eis available  with which i can get date range where the daily customer receipt profit centre wise can be obtained............
    Thanks in Advance........
    Santosh Gupta...

    Hi:
              For this purpose you can develop Z report. There is no such standard report for it. Copy FBL5N to make a Z copy of it and use the table FAGLFLEXA for each document posted in BSEG/BKPF. You can also make use of BTE 1650.
    Regards

  • Generate a report with date range and year as POV with Hyp Planning ?

    Hi everybody,
    I am starting with hyp planning and i need your help please.
    I have to create some forms. In those forms, the final user is supposed to be able to display data in the forms between 2 dates and for a specific year.
    My first problem : I don't know how you can display data in a form between 2 dates and for one specific year. I just have one dimension YEAR and one PERIOD, so if i selected them as a PAGE, the final user will just be able to choose the month and the year for his form ... and not displaying data between 2 dates.
    My second problem is with the dimensions YEAR, SCENARIO and VERSION. I don't want to put the dimensions VERSION and SCENARIO as PAGE (it easier for the final user to just choose a year than to choose a year, scenario, and version) but as POV with a relationship with the dimension YEAR (because if the user chooses YEAR = actual_year (2012) the VERSION and the SCENARIO won't be the same than if the user chooses YEAR= last_year). IF YEAR = next_year, VERSION=Propuesta, SCENARIO=Forecast
    IF YEAR = actual_year, VERSION=Propuesta, SCENARIO=Forecast AC
    IF YEAR = last_year, VERSION=Actual, SCENARIA=Real
    How can i do that?
    Thank you for your help
    Edited by: 932573 on May 7, 2012 3:44 PM
    Edited by: 932573 on May 7, 2012 4:27 PM

    I am not sure if you are using RAS or Enterprise SDK, but here are some code snippets to set range report parameters:
    For scheduling:
    // oReport is IReport object holding the crystal report.
    oReportParameter = oReport.getReportParameters().get(i);
    currentRangeValue = oReportParameter.getCurrentValues().addRangeValue();
    currentRangeValue.getFromValue().setValue(dateParameter);
    currentRangeValue.getToValue().setValue(dateParameter);
    For viewing:
    ParameterFieldRangeValue pfrv = new ParameterFieldRangeValue();
    pfrv.setBeginValue(dateTimeValue);
    pfrv.setEndValue(dateTimeValue1);
    pfrv.setLowerBoundType(RangeValueBoundType.inclusive);
    pfrv.setUpperBoundType(RangeValueBoundType.inclusive);
    pf.getCurrentValues().add(pfrv);
    f.add(pf);
    f is Fields object and pass that to viewer.

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

  • Sub:Stock report with sales unit of measurement - reg.,

    Hi guru's
    we have a requirement to have the stock report with sales unit of measure instead of base unit of measure can anybody guide me how to do this.
    thanks in advance
    tulja singh.

    From std. , I think your requirement can not satisfied.
    Make customized report.
    Take the help of ABAPER.

  • Stock Report with Batch Number

    Hi ,
    My Client requires stock report with Batch numbers .required report format is
    Item Code,BatchNumber,OpenQty,OpenVal,PurchaseQty,PurchaseVal,SalesQty,SalesVal,ClosQty,CloseVal
    I tried using query on wiki for stock report but that query is written in 2007 and Batch tables and OINM table is changes in 8.81.
    http://wiki.sdn.sap.com/wiki/display/B1/SAPB1SQLH-INItemInventoryOpeningandClosingStockper+warehouse
    can any one help with stock report- batches.
    Thanks,
    Preeti

    HI,
    use below query as basis and mofiy the fields required. it shows linking in batch and transaction tables:
    SELECT distinct T0.ItemCode,T0.ItemName ,T0.DocDate ,T0.DocType ,T0.DocNum,T0.LocCode ,t4.DistNumber as [BatchNumber], T1.Quantity ,T5.CalcPrice as [Price]  
    FROM  [OITL] T0 
              INNER  JOIN [ITL1] T1  ON  T1.[LogEntry] = T0.[LogEntry] 
              INNER JOIN  OBTN T4 on T1.MdAbsEntry=T4.AbsEntry
              INNER  JOIN [OITM] T2  ON  T2.[ItemCode] = T0.[ItemCode]   
              Inner JOin OINM T5 on T0.ItemCode =T5.ItemCode and T0.LocCode = T5.Warehouse  and T0.AppDocNum = T5.BASE_REF
    Thanks,
    Neetu

  • Check a number range with date range.

    i have table test which is having column
    Start Range
    End Range
    Start Date
    End date
    how can i check start range and end range does not exists b/w existing record also with date range of this record.
    end date can be blank also.

    990690 wrote:
    i have table test which is having column
    Start Range
    End Range
    Start Date
    End date
    how can i check start range and end range does not exists b/w existing record also with date range of this record.
    end date can be blank also.Your question makes absolutely no sense whatsoever. We could make guesses, but then we may be wrong in our guesses.
    Please provide sufficient details for people to be able to help you. Read the FAQ: {message:id=9360002}

  • MDX Filter with date range

    Hi,
    my requirement is to create a calculated member to calculate Total unique customers who has sales > 0 within the date range.
    Below mdx works normally with single date
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    [Date].[CalendarWeek].CurrentMember
    )=1))
    I'm looking for something like below with date range,
    DistinctCount(FILTER([Customer_Sales].[Outlet ID].[Outlet ID].members,
    ([Measures].[distribution],
    WTD([Date].[CalendarWeek].CurrentMember
    ))=1))
    Above MDX fails with the error: String of numeric expression expected, Tuple set expression was used.
    Appreciate your immediate response.
    Thanks in advance

    Hi Chandima,
    Thanks for the response.
    I tried your code, it works but the results are not correct.  As per manual calculations, there are 28 unique customers who has positive sales on Week to date (2014-11-03), but result shows only 19.
    For the first day of week (2014-11-01), there are 9 unique customers, which is correct. But for the following days it is not giving correct result.
    Further, performance of this approach is very poor
    Thanks,

  • Crystal Report 2008 - Save Report with Data

    I saved a Crystal report with data in Dev Environment on BOE Server (Infoview Folder) and this is transported to Quality Environment. In the quality environment, when I try to view this report, initial screen comes up with data of Development, instead of Quality environment.
    I am expecting that it will load the default data from Quality environment for the stored selection.
    Is there any settings to be done in the report settings, so that i can view the saved report in Quality Environment with Quality Env data instead of Dev Env Data?

    Thanks Don for the reply.
    In case, If we save the report with data in Dev, we need to update DB configuration to point to Quality Env using "Use Custom databse Logon Information".
    But when it gets transported to production (From Quality), it will show up Quality Envdata. So should i have to update the BOE in Q Environment, to point to Production and transport it?
    Is there any automated way that the system will point to right systems appropriately based on transport landscape?
    Does the functionality of "Save the report with data" used mainly for user friendliness for analysis in one environment and this functionality is not supported to move between environments?
    rgds
    Karthi

  • Batch wise stock report with qty and value as on date

    is there any report so that we can see the stock qty with value as on date,
    i have tried mb5b but it is showing only qty and batch combination not qty value and batch combination
    plz suggest me, it is very urgent.
    nitin

    MBEWH is the valuation history, this is only updated with the first movement after a period closure. And the period is a month.
    There is no table in SAP that holds the stock information on daily basis.
    You have to develope this yourself. Easiest method by copying a table like MBEW and MARD  daily to a Z-Table.
    A stock situation  at a certain date can be calculated with MB5B.
    Edited by: Jürgen L. on Aug 5, 2008 4:06 PM

  • Stock report with the field... last stock changed at certain date?

    Is there any standard report with the date of the last change of the stock value and quantity?
    Points granted
    BR
    Saso

    Hi people,
    I want to know why MBEWH have not any material stock information for period when doesn´t exist any inventory movement for some materials, for example I have a case in 12.2006 period the material A have stock quantity 100 and value 1000 and the next period 01.2007  no stock movements were done for this reason the MBEWH had to had the same values stock 100 and value 1000 in 01.2007 period, but in MBEWH is missing, there is not any information for material A in this period.
    Anybody knows about this problem?
    Thanks.
    Lili.

  • Stock report with grn no & date

    hello gurus,
    I need standard stock reports available in SAP with GRN no. and date.
    points assured*
    Anand

    Hi
    Use MB5B stock on posting date.By using this T code
    1.You see stock on a perticular date
    2.If you give selection date rangeL ex 01.07.2007 to 16.07.2007 then
       It will display Stock as on 01.07.2007
       Stock as on 16.07.2007
       and all the goods movement between 01.07.2007 to 16.07.2007.
    Use MMBE, after executing select Material movements from Environment tab in menu bar.It will also display all the material movements for that material.
    Regards
    Ramakrishna

  • Modification in MB5B prg...material stock between a date range

    Hi experts
    I have to modify mb5b tranx prg . presently we are using date as selection criteria..but now onwards user wants G/L account along with date as selection criteria. I created one selec-option for field HKONT type hkont-bseg. Now in select queries i need ur help ..Kindly tell me where i need to use this field in my select queries to fetch RELEVANT data.
    Regards
    Anu
    CODE:
    REPORT ZRM07MLBD NO STANDARD PAGE HEADING MESSAGE-ID M7 LINE-SIZE 280.
    ********my change*******
    tables : BSEG.
    TYPE-POOLS:  IMREP,                   " Typen Bestandsführungsreporting
                 SLIS.                    " Typen Listviewer
    INCLUDE ZRM07MLDD.
    DATA FLAG(1) TYPE C VALUE ' '.
    DATA BAL_QTY TYPE P DECIMALS 2.
    DATA BAL_AMT TYPE P DECIMALS 2.
    *include:  rm07mldd.     " reportspezifische Datendefinitionen
    "n571473
    define the selection screen here                          "n571473
    "n571473
    SELECTION-SCREEN BEGIN OF BLOCK DATABASE-SELECTION
              WITH FRAME TITLE TEXT-001.
    Text-001: Datenbankabgrenzungen
    SELECT-OPTIONS: MATNR FOR MARD-MATNR MEMORY ID MAT
                                         MATCHCODE OBJECT MAT1,
                    BUKRS FOR T001-BUKRS  MEMORY ID BUK,
                    WERKS FOR T001W-WERKS MEMORY ID WRK,
                    LGORT FOR T001L-LGORT,
                    CHARG FOR MCHB-CHARG,
                    BWTAR FOR MBEW-BWTAR,
                    BWART FOR MSEG-BWART.
    PARAMETERS SOBKZ LIKE MSEG-SOBKZ.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS: DATUM FOR MKPF-BUDAT NO-EXTENSION,
    **********my change**************
              HKONT FOR BSEG-HKONT.
    ********END CHANGE************
    SELECTION-SCREEN END OF BLOCK DATABASE-SELECTION.
    SELECTION-SCREEN BEGIN OF BLOCK BESTANDSART
    WITH FRAME TITLE TEXT-002.
    Text-002: Bestandsart
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS LGBST LIKE AM07M-LGBST RADIOBUTTON GROUP BART DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 4(50) TEXT-010 FOR FIELD LGBST.
    Text-010: Lagerort-/Chargenbestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS BWBST LIKE AM07M-BWBST RADIOBUTTON GROUP BART.
    SELECTION-SCREEN COMMENT 4(50) TEXT-011 FOR FIELD BWBST.
    Text-011: bewerteter Bestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS SBBST LIKE AM07M-SBBST RADIOBUTTON GROUP BART.
    SELECTION-SCREEN COMMENT 4(50) TEXT-012 FOR FIELD SBBST.
    Text-012: Sonderbestand
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK BESTANDSART.
    Commented By Rachit Material group Not Required
    improved definition of parameters for scope of list       "n599218
    *SELECTION-SCREEN BEGIN OF BLOCK MARA WITH FRAME TITLE TEXT-040.
    **selection-screen begin of line.
    *PARAMETERS P_MATKL LIKE MARA-MATKL.
    **selection-screen end of line.
    **SELECTION-SCREEN COMMENT 4(50) TEXT-030 for fieLD s_matkl.
    *SELECTION-SCREEN END OF BLOCK MARA.
    SELECTION-SCREEN BEGIN OF BLOCK LISTUMFANG
      WITH FRAME TITLE TEXT-003.  "Listumfang
    the following 3 parameters became obsolete do not use     "n599218
    anymor. They are still here to inform the user about      "n599218
    that he is using old variants or SUBMIT commands          "n599218
    PARAMETERS :                                                "n599218
      XONUL  LIKE AM07M-XONUL            NO-DISPLAY,            "n599218
      XVBST  LIKE AM07M-XVBST            NO-DISPLAY,            "n599218
      XNVBST LIKE AM07M-XNVBS            NO-DISPLAY.            "n599218
    7 new categories for the scope of list                    "n599218
                                                              "n599218
    cat. I docs I stock on   I    I stock on I Parameter      "n599218
         I      I start date I    I end date I                "n599218
    ---+--+--------++------+--------      "n599218
    1   I yes  I =  zero    I =  I =  zero  I pa_wdzer       "n599218
    2   I yes  I =  zero    I <> I <> zero  I pa_wdzew       "n599218
    3   I yes  I <> zero    I <> I =  zero  I pa_wdwiz       "n599218
    4   I yes  I <> zero    I <> I <> zero  I pa_wdwuw       "n599218
    5   I yes  I <> zero    I =  I <> zero  I pa_wdwew       "n599218
         I      I            I    I          I                "n599218
    6   I no   I =  zero    I =  I =  zero  I pa_ndzer       "n599218
    7   I no   I <> zero    I =  I <> zero  I pa_ndsto       "n599218
                                                              "n599218
    definition of the pushbutton : show or hide the following "n599218
    parameters for the scope of list                          "n599218
    SELECTION-SCREEN PUSHBUTTON /1(20) PB_LIU                   "n599218
                               USER-COMMAND LIU.                "n599218
                                                                "n599218
    text line : materials with movements                      "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN COMMENT 1(55) TEXT-072                     "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    with movements / start = zero  =  end = zero              "n599218
    1   I yes  I =  zero    I =  I =  zero  I pa_wdzer       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_WDZER    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      text-083 : no opening stock ; no closing stock          "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-083                     "n599218
                             FOR FIELD PA_WDZER                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    with movements / start = zero  =  end <> zero             "n599218
    2   I yes  I =  zero    I <> I <> zero  I pa_wdzew       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_WDZEW    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      text-084 : no opening stock ; with closing stock        "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-084                     "n599218
                             FOR FIELD PA_WDZEW                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    with movements / start stock <> 0 / end stock = 0         "n599218
    3   I yes  I <> zero    I <> I =  zero  I pa_wdwiz       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_WDWIZ    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      text-085 : with opening stock ; no closing stock        "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-085                     "n599218
                             FOR FIELD PA_WDWIZ                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    with movements / with start and end stocks / different    "n599218
    4   I yes  I <> zero    I <> I <> zero  I pa_wdwuw       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_WDWUW    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      with opening stock ; with closing stock ; changed       "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-086                     "n599218
                             FOR FIELD PA_WDWUW                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    with movements / with start and end stock / equal         "n599218
    5   I yes  I <> zero    I =  I <> zero  I pa_wdwew       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_WDWEW    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      with opening stock ; with closing stock ; non-changed   "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-087                     "n599218
                             FOR FIELD PA_WDWEW                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    text line : materials without movements                   "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN COMMENT 1(55) TEXT-073                     "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    materials without movements / stocks = zero               "n599218
    6   I no   I =  zero    I =  I =  zero  I pa_ndzer       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_NDZER    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      text-083 : no opening stock ; no closing stock          "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-083                     "n599218
                             FOR FIELD PA_NDZER                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    materials without movements / with start or end stock     "n599218
    7   I no   I <> zero    I =  I <> zero  I pa_ndsto       "n599218
    SELECTION-SCREEN BEGIN OF LINE.                             "n599218
    SELECTION-SCREEN POSITION 2.                                "n599218
    PARAMETERS : PA_NDSTO    LIKE AM07M-MB5B_XONUL              "n599218
                             MODIF ID LIU.                      "n599218
      with opening stock ; with closing stock ; non-changed   "n599218
    SELECTION-SCREEN COMMENT 5(70) TEXT-087                     "n599218
                             FOR FIELD PA_NDSTO                 "n599218
                             MODIF ID LIU.                      "n599218
    SELECTION-SCREEN END OF LINE.                               "n599218
                                                                "n599218
    SELECTION-SCREEN END OF BLOCK LISTUMFANG.
    SELECTION-SCREEN BEGIN OF BLOCK EINSTELLUNGEN
       WITH FRAME TITLE TEXT-068.  "Settings
    parameter for totals only - hierseq. list
    corresponding display variant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS XSUM          LIKE AM07M-XSUM.
    SELECTION-SCREEN COMMENT 4(60) TEXT-090 FOR FIELD XSUM.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(30) TEXT-091 FOR FIELD PA_SUVAR.
    *Commented by Rachit
    SELECTION-SCREEN POSITION 40.
    PARAMETERS: PA_SUVAR LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF LINE.
    parameter for totals only - flat list + corresponding display variant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS PA_SUMFL LIKE AM07M-XSUM.
    SELECTION-SCREEN COMMENT 4(60) TEXT-092 FOR FIELD PA_SUMFL.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(30) TEXT-091 FOR FIELD PA_SFLVA.
    SELECTION-SCREEN POSITION 40.
    PARAMETERS: PA_SFLVA LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 1.
    PARAMETERS XCHAR LIKE AM07M-XCHRG.
    SELECTION-SCREEN COMMENT 4(50) TEXT-015 FOR FIELD XCHAR.
    Text-015: nur chargenpflichtige Materialien
    Das Kennzeichen 'xchar' bestimmt die Art der Listausgabe entweder
    auf Material- oder Chargenebene.
    SELECTION-SCREEN END OF LINE.
    the function "No reversal movements" is only         "n571473
    available from relaese 4.5B and higher               "n571473
    ( TEXT-026 : No reversal movements )                 "n571473
    SELECTION-SCREEN BEGIN OF LINE.                             "n571473
    SELECTION-SCREEN POSITION 1.                                "n571473
    PARAMETERS NOSTO LIKE AM07M-NOSTO.                          "n571473
    SELECTION-SCREEN COMMENT 4(50) TEXT-026                     "n571473
                           FOR FIELD NOSTO.                     "n571473
    SELECTION-SCREEN END OF LINE.                               "n571473
    SELECTION-SCREEN END OF BLOCK EINSTELLUNGEN.
    *Rachit
    SELECTION-SCREEN BEGIN OF BLOCK LISTE WITH FRAME TITLE TEXT-040.
    PARAMETERS: P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK LISTE.
    HAUPTPROGRAMM *********************************
    F4-Hilfe für Reportvariante -
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM F4_FOR_VARIANT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_SFLVA.
      PERFORM                    VARIANT_VALUE_REQUEST_F4
                                 USING  PA_SFLVA  G_S_VARI_SUMFL.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_SUVAR.
      PERFORM                    VARIANT_VALUE_REQUEST_F4
                                 USING  PA_SUVAR G_S_VARI_SUMHQ.
    "n599218
    INITIALIZATION                                            "n599218
    "n599218
                                                                "n599218
    INITIALIZATION.
      CLEAR : G_S_VARI_SUMHQ, G_S_VARI_SUMFL.
      REPID = SY-REPID.
      VARIANT_SAVE = 'A'.
    preprae the working areas for the variants
      MOVE  : REPID              TO  G_S_VARI_SUMHQ-REPORT,
              'SUHQ'             TO  G_S_VARI_SUMHQ-HANDLE,
              REPID              TO  G_S_VARI_SUMFL-REPORT,
              'SUFL'             TO  G_S_VARI_SUMFL-HANDLE.
      MOVE-CORRESPONDING : G_S_VARI_SUMHQ  TO  G_S_VARI_SUMHQ_DEF,
                           G_S_VARI_SUMFL  TO  G_S_VARI_SUMFL_DEF.
      PERFORM  GET_THE_DEFAULT_VARIANT
                                 USING  PA_SFLVA
                                        G_S_VARI_SUMFL
                                        G_S_VARI_SUMFL_DEF.
      PERFORM  GET_THE_DEFAULT_VARIANT
                                 USING  PA_SUVAR
                                        G_S_VARI_SUMHQ
                                        G_S_VARI_SUMHQ_DEF.
      PERFORM INITIALISIERUNG.
    get the parameters from the last run                      "n547170
      PERFORM                    ESDUS_GET_PARAMETERS.          "n547170
    set flag when INITILIZATION is processed
      MOVE  'X'        TO  G_FLAG_INITIALIZATION.
    "n599218
    AT SELECTION-SCREEN                                       "n599218
    "n599218
    Prüfung der eingegebenen Selektionsparameter, -
    Berechtigungsprüfung -
    AT SELECTION-SCREEN.
    the following 3 parameters XONUL, XVBST, and XNVBST       "n599218
    became obsolete; send error when they should be filled.   "n599218
    This could be possible if the user works with old         "n599218
    selection variants or this report is launched by a        "n599218
    SUBMIT command                                            "n599218
      IF  XONUL  IS INITIAL  AND                                "n599218
          XVBST  IS INITIAL  AND                                "n599218
          XNVBST IS INITIAL.                                    "n599218
    ok, the old parameters are empty                         "n599218
      ELSE.                                                     "n599218
      text-088 : note 599218 : obsolete parameter used        "n599218
        MESSAGE E895             WITH  TEXT-088.                "n599218
      ENDIF.
    did the user hit the pushbutton "Category" ?              "n599218
      CASE     SSCRFIELDS-UCOMM.                                "n599218
        WHEN  'LIU '.                                           "n599218
        yes, the pushbutton "Category" was hit                "n599218
          IF  G_FLAG_STATUS_LIU  =  C_HIDE.                     "n599218
          show the 7 parameters on the selection srceen       "n599218
            MOVE  C_SHOW         TO  G_FLAG_STATUS_LIU.         "n599218
          ELSE.                                                 "n599218
          hide the 7 paramaters                               "n599218
            MOVE  C_HIDE         TO  G_FLAG_STATUS_LIU.         "n599218
          ENDIF.                                                "n599218
      ENDCASE.                                                  "n599218
                                                                "n599218
    go on only if the user wants to launch this report        "n599218
      CHECK : SY-UCOMM = 'ONLI'  OR                             "n599218
              SY-UCOMM = 'PRIN'  OR                             "n599218
              SY-UCOMM = 'SJOB'.                                "n599218
    only one sum function can be processed
      IF  XSUM     = 'X' AND
          PA_SUMFL = 'X'.
        SET CURSOR               FIELD 'XSUM'.
      select one sum list only
        MESSAGE  E895            WITH  TEXT-093.
      ENDIF.
      PERFORM EINGABEN_PRUEFEN.
      SET CURSOR                 FIELD 'PA_SFLVA'.
      PERFORM  VARIANT_CHECK_EXISTENCE
                                 USING     PA_SFLVA
                                           G_S_VARI_SUMFL
                                           G_S_VARI_SUMFL_DEF.
      SET CURSOR                 FIELD 'PA_SUVAR'.
      PERFORM  VARIANT_CHECK_EXISTENCE
                                 USING     PA_SUVAR
                                           G_S_VARI_SUMHQ
                                           G_S_VARI_SUMHQ_DEF.
    check whether FI summarization is active and other        "n547170
    restrictions could deliver wrong results                  "n547170
      PERFORM                    F0800_CHECK_RESTRICTIONS.      "n547170
    - the user wants to surpress the reversal movements :     "n497992
      process warning M7 392                                  "n497992
      IF NOT NOSTO IS INITIAL.                                  "n497992
      emerge warning ?                                        "n497992
        CALL FUNCTION            'ME_CHECK_T160M'               "n497992
            EXPORTING                                           "n497992
              I_ARBGB          = 'M7'                           "n497992
              I_MSGNR          = '392'                          "n497992
            EXCEPTIONS                                          "n497992
              NOTHING          = 0                              "n497992
              OTHERS           = 1.                             "n497992
                                                                "n497992
        IF SY-SUBRC <> 0.                                       "n497992
          SET CURSOR               FIELD  'NOSTO'.              "n497992
          to surpress the reversal movements could cause ...  "n497992
          MESSAGE                  W392.                        "n497992
        ENDIF.                                                  "n497992
      ENDIF.                                                    "n497992
    carry out special authotity check for the tax auditor     "n547170
      PERFORM                    TPC_CHECK_TAX_AUDITOR.         "n547170
    does the user wants a selection via company code or a plant ?
    fill range table g_ra_werks
      REFRESH : G_RA_BWKEY,  G_RA_WERKS, G_T_ORGAN.
      CLEAR   : G_RA_BWKEY,  G_RA_WERKS, G_T_ORGAN, G_S_ORGAN.
      REFRESH : G_0000_RA_BWKEY,  G_0000_RA_WERKS,  G_0000_RA_BUKRS.
      CLEAR   : G_0000_RA_BWKEY,  G_0000_RA_WERKS,  G_0000_RA_BUKRS.
      DESCRIBE TABLE  BUKRS      LINES  G_F_CNT_LINES_BUKRS.
      DESCRIBE TABLE  WERKS      LINES  G_F_CNT_LINES_WERKS.
      IF  G_F_CNT_LINES_BUKRS  > 0  OR
          G_F_CNT_LINES_WERKS  > 0.
      fill range tables for the CREATION OF TABLE G_T_ORGAN
        MOVE : WERKS[]           TO  G_0000_RA_WERKS[],
               BUKRS[]           TO  G_0000_RA_BUKRS[].
        PERFORM  F0000_CREATE_TABLE_G_T_ORGAN
                                 USING  C_ERROR.
      ENDIF.
    save the parameters of this run                           "n547170
      PERFORM                    ESDUS_SAVE_PARAMETERS.         "n547170
    "n599218
    AT SELECTION-SCREEN OUTPUT                                "n599218
    "n599218
                                                                "n599218
    AT SELECTION-SCREEN OUTPUT.                                 "n599218
                                                                "n599218
      IF  G_FLAG_INITIALIZATION IS INITIAL.                     "n599218
      the process time INITIALIZATION was not done, so        "n599218
      carry out the functions here                            "n599218
        MOVE  'X'                TO G_FLAG_INITIALIZATION.      "n599218
                                                                "n599218
        PERFORM                  INITIALISIERUNG.               "n599218
                                                                "n599218
      get the parameters from the last run                    "n599218
        PERFORM                  ESDUS_GET_PARAMETERS.          "n599218
      ENDIF.                                                    "n599218
                                                                "n599218
    how to handle the 7 paramaters for the scope of list ?    "n599218
      LOOP AT SCREEN.                                           "n599218
      modify the selection screen                             "n599218
        CASE    SCREEN-GROUP1.                                  "n599218
          WHEN  'LIU'.                                          "n599218
            IF  G_FLAG_STATUS_LIU  = C_SHOW.                    "n599218
              SCREEN-ACTIVE = '1'.         "show parameters     "n599218
            ELSE.                                               "n599218
              SCREEN-ACTIVE = '0'.         "Hide parameters     "n599218
            ENDIF.                                              "n599218
                                                                "n599218
            MODIFY SCREEN.                                      "n599218
        ENDCASE.                                                "n599218
      ENDLOOP.                                                  "n599218
                                                                "n599218
    adapt the icon on the pushbutton depending on the status  "n599218
      CASE    G_FLAG_STATUS_LIU.                                "n599218
        WHEN  C_HIDE.                                           "n599218
          MOVE  TEXT-081         TO  PB_LIU.  "@0EQ@ Scope ... "n599218
        WHEN  C_SHOW.                                           "n599218
          MOVE  TEXT-082         TO  PB_LIU.  "@0HQ@ Scope ... "n599218
        WHEN  OTHERS.                                           "n599218
      ENDCASE.                                                  "n599218
                                                                "n599218
    "n599218
    START-OF-SELECTION
    START-OF-SELECTION.
    *SET PF-STATUS 'TEST'.
    create the title line
    If no date is given at all, the range is set to the maximum
    extend (1.1.0000 - 31.12.9999).
    If only datum-low is set, it is interpreted as the day for
    which the analysis is wanted --> datum-high is filled up.
      IF DATUM-LOW IS INITIAL.
        DATUM-LOW = '00000101'.
        IF DATUM-HIGH IS INITIAL.
          DATUM-HIGH = '99991231'.
        ENDIF.
      ELSE.
        IF DATUM-HIGH IS INITIAL.
          DATUM-HIGH = DATUM-LOW.
        ENDIF.
      ENDIF.
      MOVE: DATUM-LOW(4)    TO JAHRLOW,
            DATUM-LOW+4(2)  TO MONATLOW,
            DATUM-LOW+6(2)  TO TAGLOW,
            DATUM-HIGH(4)   TO JAHRHIGH,
            DATUM-HIGH+4(2) TO MONATHIGH,
            DATUM-HIGH+6(2) TO TAGHIGH.
      SET TITLEBAR 'MAN'
      WITH TAGLOW MONATLOW JAHRLOW TAGHIGH MONATHIGH JAHRHIGH.
    create the headlines using the titelbar                   "n599218
      PERFORM                    CREATE_HEADLINE.               "n599218
    calculate the offsets for the list header
      PERFORM                    CALCULATE_OFFSETS.
    for the representation of tied empties                    "n547170
      PERFORM                    F0700_PREPARE_TIED_EMPTIES.    "n547170
    create table g_t_mseg_fields with the names of all
    wanted fields from MSEG and MKPF
      PERFORM                    F0300_GET_FIELDS.
    set a break-point : is IS-OIL active ?                    "n599218 A
                                                                "n599218 A
    check whether this is a IS-OIL system                     "n599218 A
      PERFORM                    CHECK_IS_OIL_SYSTEM.           "n599218 A
                                                                "n599218 A
      IF  G_FLAG_IS_OIL_ACTIVE = 'X'.           "IS-OIL ?       "n599218 A
      the 2 IS-OIL specific data fields will be inserted into "n599218 A
      working table G_T_MSEG_FIELDS. Then these fields will   "n599218 A
      transported from database table MSEG, too               "n599218 A
        APPEND  'MSEG~OIGLCALC'  TO  G_T_MSEG_FIELDS.           "n599218 A
        APPEND  'MSEG~OIGLSKU'   TO  G_T_MSEG_FIELDS.           "n599218 A
      ENDIF.                                                    "n599218 A
    create the ALV fieldcatalog for the main list always
      MOVE  'G_T_BELEGE'         TO  G_F_TABNAME.
      PERFORM                    F0400_CREATE_FIELDCAT.
    do not print the ALV-statistics and selection criteria
      CLEAR                      G_S_PRINT.
      G_S_PRINT-NO_PRINT_SELINFOS   = 'X'.
      G_S_PRINT-NO_PRINT_LISTINFOS = 'X'."
    create the range table for the storage location
      PERFORM                    F0600_CREATE_RANGE_LGORT.
    - show the current activity and the progress              "n599218
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'                 "n599218
        EXPORTING                                               "n599218
          TEXT = TEXT-063.       "Reading current stocks        "n599218
    get the stock tables
      PERFORM                    AKTUELLE_BESTAENDE.
      PERFORM TABELLEN_LESEN.
    - show the current activity and the progress              "n599218
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'                 "n599218
        EXPORTING                                               "n599218
          TEXT = TEXT-064.       "Reading MM documents          "n599218
      PERFORM                    F1000_SELECT_MSEG_MKPF.
      PERFORM                    BELEGSELEKTION.
    END-OF-SELECTION
    END-OF-SELECTION.
    results of all the autority checks
      PERFORM                    F9100_AUTH_PLANT_RESULT.
    - show the current activity and the progress              "n599218
      IF BWBST = 'X'.                                           "n599218
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'               "n599218
          EXPORTING                                             "n599218
            TEXT = TEXT-066.     "Calculating Stocks and Values "n599218
      ELSE.                                                     "n599218
        CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'               "n599218
          EXPORTING                                             "n599218
            TEXT = TEXT-067.     "Calculating Stocks            "n599218
      ENDIF.                                                    "n599218
      PERFORM SUMMEN_BILDEN.
      PERFORM BESTAENDE_BERECHNEN.
      PERFORM LISTUMFANG.
    - show the current activity and the progress              "n599218
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'                 "n599218
        EXPORTING                                               "n599218
          TEXT = TEXT-065.       "Preparing list output         "n599218
    stop if table bestand is empty
      LOOP AT BESTAND.
        SELECT SINGLE MATKL FROM MARA INTO CORRESPONDING FIELDS OF BESTAND
        WHERE
         MATNR = BESTAND-MATNR.
        MODIFY BESTAND INDEX SY-TABIX.
      ENDLOOP.
      DESCRIBE TABLE BESTAND     LINES G_F_CNT_LINES.
      IF  G_F_CNT_LINES IS INITIAL.
      Keinen Eintrag zu den Suchbegriffen gefunden/selektiert
        MESSAGE                  S083.
      perform                  anforderungsbild.
      ELSE.
      process log function if the use is a tax auditor        "n555246
      and the database selection was successful               "n555246
        IF  G_FLAG_TPCUSER = '1'.                               "n555246
          PERFORM                TPC_WRITE_LOG.                 "n555246
        ENDIF.                                                  "n555246
        PERFORM FELDGRUPPEN_AUFBAUEN.
      sort table with header data per material
        IF BWBST IS INITIAL.
          SORT BESTAND BY MATNR WERKS CHARG.
        ELSE.
          SORT BESTAND BY MATNR BWKEY.
        ENDIF.
      which function does the user want ?
        IF      XSUM = 'X'.
        hierseq. alv with sums
          PERFORM                CREATE_TABLE_TOTALS_HQ.
          PERFORM                CREATE_FIELDCAT_TOTALS_HQ.
          PERFORM                ALV_HIERSEQ_LIST_TOTALS.
        ENDIF.
        IF FLAG NE 'X'.
          IF PA_SUMFL = 'X'.
       elseif  pa_sumfl = 'X'.
        show the sums only in a flat ALV
            PERFORM                CREATE_TABLE_TOTALS_FLAT.
            PERFORM                CREATE_FIELDCAT_TOTALS_FLAT.
            PERFORM                ALV_FLAT_LIST_SUMS_ONLY.
          ELSE.
        display the full list using the APPEND ALV
         PERFORM                BESTAENDE_AUSGEBEN.
          ENDIF.
        ENDIF.
        FLAG = ' '.
      ENDIF.
      CLEAR: G_T_MSEG_LEAN, G_T_BSIM_LEAN, BESTAND.             "n443935
    *&   PF_STATUS_SET_TOTALS
    FORM PF_STATUS_SET_TOTALS                                   "#EC CALLED
                       USING     EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD'   EXCLUDING EXTAB.
    ENDFORM.                     "PF_STATUS_SET_TOTALS
       user_parameters_save
    FORM USER_PARAMETERS_SAVE.
      GET PARAMETER ID 'BUK'     FIELD  G_SAVE_PARAMS-BUKRS.
      GET PARAMETER ID 'WRK'     FIELD  G_SAVE_PARAMS-WERKS.
      GET PARAMETER ID 'MAT'     FIELD  G_SAVE_PARAMS-MATNR.
      GET PARAMETER ID 'CHA'     FIELD  G_SAVE_PARAMS-CHARG.
      GET PARAMETER ID 'BLN'     FIELD  G_SAVE_PARAMS-BELNR.
      GET PARAMETER ID 'BUK'     FIELD  G_SAVE_PARAMS-BUKRS.
      GET PARAMETER ID 'GJR'     FIELD  G_SAVE_PARAMS-GJAHR.
    ENDFORM.                     "user_parameters_save
       user_parameters_restore
    FORM USER_PARAMETERS_RESTORE.
      SET PARAMETER ID 'BUK'     FIELD  G_SAVE_PARAMS-BUKRS.
      SET PARAMETER ID 'WRK'     FIELD  G_SAVE_PARAMS-WERKS.
      SET PARAMETER ID 'MAT'     FIELD  G_SAVE_PARAMS-MATNR.
      SET PARAMETER ID 'CHA'     FIELD  G_SAVE_PARAMS-CHARG.
      GET PARAMETER ID 'BLN'     FIELD  G_SAVE_PARAMS-BELNR.
      GET PARAMETER ID 'BUK'     FIELD  G_SAVE_PARAMS-BUKRS.
      GET PARAMETER ID 'GJR'     FIELD  G_SAVE_PARAMS-GJAHR.
    ENDFORM.                     "user_parameters_restore
    *&   USER_COMMAND_TOTALS
    FORM USER_COMMAND_TOTALS                                    "#EC CALLED
                       USING     R_UCOMM     LIKE  SY-UCOMM
                                 RS_SELFIELD TYPE  SLIS_SELFIELD.
      CLEAR                      G_S_BESTAND_KEY.
      CASE R_UCOMM.
        WHEN '&GRPT'.
          SORT BESTAND BY BWKEY MATKL.
          FLAG = 'X'.
          PERFORM GRP_TOTAL(ZGRP_TOTAL) TABLES BESTAND.
          IF FLAG = 'X'.
            EXIT.
          ENDIF.
        WHEN '&STR'.
          IF BWBST = 'X'.
            IF FLAG = 'X'.
        clear: LGBST,BWBST ,SBBST.
          PERFORM GRP_TOTAL(ZGRP_TOTAL1) TABLES BESTAND.
              SUBMIT ZRM07MLBD2 WITH  LGBST = 'X'
                               WITH WERKS = '1000'
                               WITH BUKRS = '1001'
                               WITH XSUM = 'X'
                               WITH PA_WDZER =  PA_WDZER
                               WITH PA_WDZEW = PA_WDZEW
                               WITH PA_WDWIZ = PA_WDWIZ
                               WITH PA_WDWUW = PA_WDWUW
                               WITH PA_WDWEW = PA_WDWEW
                               WITH PA_NDZER = PA_NDZER
                               WITH PA_NDSTO = PA_NDSTO
                               WITH LGORT IN LGORT
                               WITH DATUM IN DATUM
                               WITH MATNR IN MATNR VIA SELECTION-SCREEN
                                                       AND RETURN.
              CLEAR:      LGBST.
            ELSE.
              MESSAGE E345(0) WITH 'First see the grp total'.
            ENDIF.
          ELSE.
            MESSAGE E345(0) WITH 'Stock type chosen was not valuated'.
          ENDIF.
    Quarter Ending----
        WHEN '&QTRE'.
          TYPES: BEGIN OF TY_MTART,
                  MATNR LIKE MARA-MATNR,
                  MTART LIKE MARA-MTART,
                 END OF TY_MTART.
          DATA: L_REC_QTY TYPE P DECIMALS 3,
                L_ISS_QTY TYPE P DECIMALS 3,
                L_REC_AMT TYPE P DECIMALS 3,
                L_ISS_AMT TYPE P DECIMALS 3,
                L_OTHERS_QTY TYPE P DECIMALS 3,
                L_SALE_QTY TYPE P DECIMALS 3,
                L_SALE_AMT TYPE P DECIMALS 3,
                L_OTHERS_AMT TYPE P DECIMALS 3.
          DATA: IT_MAKT TYPE STANDARD TABLE OF MAKT WITH HEADER LINE,
                IT_T023T TYPE STANDARD TABLE OF T023T WITH HEADER LINE,
                IT_T134 TYPE STANDARD TABLE OF T134T WITH HEADER LINE.
          DATA: IT_MTART TYPE STANDARD TABLE OF TY_MTART WITH HEADER LINE.

    Dear Experts,
    Thanks all for the reply.
    I have followed the OSS notes 194788
    Only enter the selection criteria which are required for the selection of the stock management unit for which the opening stock balance and closing stock should be determined.
    In MB5B I key in selection criteria which are :
    material number : xxxxxx
    company code : 1000
    plant : 1500
    batch : xxxxxx
    special stock indicator : orders on hand
    selection date : 01.08.2009 to current date
    stock type :special stock
    and the result comes out :
    there is initial balance of 3000 kg on 01.08.2009 - INCORRECT ( our team never enter this initial balance but still came out )
    therefore the stock of current date also WRONG
    if the total stock is adjusted using stock take , the accounting journal will be created, and reduce the financial asset with the same amount of 3000 kg (WRONG EFFECT)
    how to solve this issue without affecting the accounting journal ?
    Thanks
    Pauline

  • Cascading Pick List with date range as first,  second pick list is dynamic

    Specifically, how is this accomplished?
    It does not seem possible to make first pick list static. If allowed this would be perfect.
    The system seems to only allow the first parameter to be dynamic if the second parameter is dynamic. No range seems to be available for date when second parameter is  dynamic.

    Consider a 3rd-party tool as a solution (for a list of such tools, see http://www.kenhamady.com/bookmarks.html).
    There is at least one Crystal report viewer with its own special implementation of dynamic & cascading parameters.  It would allow you to use any type of parameter within the cascade.  However, you will need to create a separate rpt to implement each dynamic parameter.  So in your case, you will have one main report, using a dynamic parameter that's implemented as a separate rpt, which has a date range parameter. 
    Cheers,
    - ido

Maybe you are looking for

  • Error: Unable to display Flowtrace due to exception while initializing obj

    Hi All, we are unable to open Flow Trace for bpel processes in em console. we are using SOA11.1.1.5. this issue is intermittent and occurs only on heavy load. in the console we are getting error as: Exception occured while retrieving the Flowtrace XM

  • Fan Issues with DV6-7000 series (probably with DV7-7000 series too)

    So I've installed Arch on my brand new laptop, and I'm unable to change the fan speed. The fan does run, but on the lowest possible setting, which means the laptop gets very hot. I've followed the wiki here: https://wiki.archlinux.org/index.php/Fan_S

  • Compare lists

    I was wondering if anyone has any pointers to efficiently achieve the following: I have a long list of numbers (a few hundred) to which more numbers are added every month. I also have a short list of numbers (10-40 numbers) that changes. I simply nee

  • SNMP TRAP on EvENT

    Hi & Thanks for read it, I would like to design SNMP event, traps in order to be managed by SNMP Network management platform, like HP OpenView, or other. It's possible to generate a trap in pl/sql or via enterprise manager on procedure event? Anyone

  • Safari 3.1.2 timing out my downloads

    Im trying to download Adobe photoshop elements 6 free trial and Safari is timing out withing 30-60 seconds after starting the download. Hints, fixes?