Re:Query for Stock Statement for a particular item..!!!!

Dear SAP Experts,
I need a stock statement query  for a particular item which contains:
1.ItemCode
2.Item Description
3.Item Price
4.Opening
5.Receipts
6.Issues
7.Closing
8. Value
The selection criteria are:
1.Warehouse code
2.Item Name
3.Posting Date
Plz give me a good solution for this issue.
With Regards,
Revathy

Check this
Declare @FromDate Datetime
Declare @ToDate Datetime
set @FromDate =
    (Select min(S0.Docdate) from OINM S0 where S0.Docdate >='[%0]')
set @ToDate =
    (Select max(S1.Docdate) from OINM S1 where S1.Docdate <='[%1]')
select * from
    SELECT T0.itemcode,
    min(T0.Dscription) as 'Item Description',
    min(B1.ItmsGrpNam) as 'Item Group', W1.Whscode, C1.Location,
    (isnull((
        Select sum(isnull(inqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode
        and O1.Warehouse=W1.Whscode
        and O1.docdate<@FromDate ),0)-
    isnull((
        Select sum(isnull(outqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode
        and O1.Warehouse=W1.Whscode
        and O1.docdate<@FromDate),0)
    ) as [Opening Stock],
    isnull((
        Select sum(isnull(inqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode
        and O1.Warehouse=W1.Whscode
        and O1.docdate>=@FromDate
        and O1.docdate<=@ToDate and O1.inqty>0
        and O1.transtype in (20,18)),0
    ) as [Purchase Quantity],
    isnull((
        Select sum(isnull(outqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
        and O1.docdate>=@FromDate and O1.docdate<=@ToDate
        and O1.outqty>0 and O1.transtype in (21,19)),0
    ) as [Purchase Return Quantity],
   isnull((
        Select sum(isnull(outqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
        and O1.docdate>=@FromDate and O1.docdate<=@ToDate and O1.outqty>0
        and O1.transtype in (13,15)),0
    ) as [sale Quatity],
    (isnull
        Select sum(isnull(inqty,0))
        from OINM O1
        where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
        and O1.docdate<=@ToDate),0
        isnull((
            Select sum(isnull(outqty,0))
            from OINM O1
            where O1.itemcode=T1.itemcode and O1.Warehouse=W1.Whscode
            and O1.docdate<=@ToDate),0)
    ) as [Closing Stock]
    FROM OINM T0
    INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
    INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod
    INNER JOIN OWHS W1 ON T2.WhsCode = W1.WhsCode
    INNER JOIN OLCT C1 ON W1.Location=C1.Code
    Group by T1.itemcode, T0.Itemcode, W1.WhsCode, C1.Location
) a
where (a.[Opening Stock]
        +a.[Purchase Quantity]
        + a.[Purchase Return Quantity]
        +a.[sale Quatity]+a.[Closing Stock]
       ) !=0
Regards,
Bala

Similar Messages

  • Query for Stock Statement

    Hi Members,
    My customer needs an report "Stock Statement" with selection criteria as Date, ItemGroupwise and warehouse wise with following columns namely.
    Itemcode
    ItemName
    Opening Stock Qty
    Receipt Qty
    Issue Qty.
    Price.
    Kindly help me in this regard,
    Thanks in advance,
    Venkatesh.R

    Hi!
    Check these threads
    Re: Item Stock Report (2nd page)
    Item Stock Report

  • Report for stock statement

    hi guy's,
       i am doing report for the stock statement .... my issue is in MB5B if i reverse some document it shows as it move's to issue QTY and my receipt is same but my closing stock is correct ...is there any std report avalible ....
    thank's in advance

    Use this code :
    TABLES : MSEG,MKPF,MARA,MAKT,BEWART,MSLB,BSIM.
    TYPE-POOLS : SLIS.
    DATA : IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
           IT_LIST_HEADER TYPE SLIS_T_LISTHEADER,
           IT_EVENTS TYPE SLIS_T_EVENT,
           GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
           WA_SORT TYPE SLIS_SORTINFO_ALV,
           IT_SORT TYPE SLIS_T_SORTINFO_ALV,
           REPID LIKE SY-REPID,
           FRM_DATE(10),TO_DATE(10),
           DISPTEXT(255),DISPTEXT2(255).
    TYPES : BEGIN OF ST_OPBAL,
             MATNR LIKE MSEG-MATNR,
             MAKTX LIKE MAKT-MAKTX,
             BATCH LIKE MSEG-CHARG,
             BWART LIKE MSEG-BWART,
             MENGE LIKE MSEG-MENGE,
             ZEILE LIKE MSEG-ZEILE,
             WERKS LIKE MSEG-WERKS,
             SOBKZ LIKE MSEG-SOBKZ,
             BUDAT LIKE MKPF-BUDAT,
             SHKZG LIKE MSEG-SHKZG,
             DMBTR LIKE MSEG-DMBTR,
             MBLNR LIKE MSEG-MBLNR,
             LGORT LIKE MSEG-LGORT,
           END OF ST_OPBAL.
    DATA : OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE,
           TMP_OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF BAL_NOREF OCCURS 0,
              MATNR LIKE MARA-MATNR,
              SHKZG LIKE MSEG-SHKZG,
              DMBTR LIKE MSEG-DMBTR,
           END OF BAL_NOREF.
    DATA : BEGIN OF OPBAL2 OCCURS 0,
             SNO(3)      TYPE N,
             MATNR       LIKE MSEG-MATNR,
             MAKTX       LIKE MAKT-MAKTX,
             OP_BAL      LIKE MSEG-MENGE,
             OP_STKVAL   LIKE MSEG-DMBTR,   "NEW
             REC         LIKE MSEG-MENGE,
             T_OPBAL_REC LIKE MSEG-MENGE,
             REC_STKVAL  LIKE MSEG-DMBTR,   "NEW
             ISS         LIKE MSEG-MENGE,
             ISS_STKVAL  LIKE MSEG-DMBTR,   "NEW
             SALES       LIKE MSEG-MENGE,
             T_ISS       LIKE MSEG-MENGE,
             CL_BAL      LIKE MSEG-MENGE,
             BATCH       LIKE MSEG-CHARG,
             SUBCON      LIKE MSEG-MENGE,
             CL_STKVAL   LIKE MSEG-DMBTR,
           END OF OPBAL2.
    DATA  SERNO(4) TYPE C.
    DATA OPTOT  TYPE P DECIMALS 3.
    DATA RECTOT TYPE P DECIMALS 3.
    DATA ISSTOT TYPE P DECIMALS 3.
    DATA TOTALL TYPE P DECIMALS 3.
    DATA FLG        TYPE N.
    DATA FLAG       TYPE N.
    DATA STOCKVAL        TYPE MSEG-DMBTR.
    DATA REC_STOCKVAL    TYPE MSEG-DMBTR.
    DATA ISS_STOCKVAL    TYPE MSEG-DMBTR.
    DATA CL_STKVAL       TYPE MSEG-DMBTR.
    SELECTION-SCREEN BEGIN OF BLOCK X WITH FRAME.
         SELECT-OPTIONS: P_MATNR FOR MSEG-MATNR,
                         P_MGRP  FOR MARA-MATKL,
                         P_DATE FOR MKPF-BUDAT,
         P_PLANT FOR MSEG-WERKS DEFAULT  'NB01' OBLIGATORY NO INTERVALS
                                                    NO-EXTENSION .
         SELECT-OPTIONS: P_STLOC FOR MSEG-LGORT NO INTERVALS NO-EXTENSION.
    SELECTION-SCREEN END OF BLOCK X.
    INITIALIZATION.
       REPID = SY-REPID.
       PERFORM FILL_FLDCAT USING IT_FLDCAT.
       PERFORM FILL_EVENTS USING IT_EVENTS.
       PERFORM FILL_LAYOUT USING GS_LAYOUT.
    START-OF-SELECTION.
      CONCATENATE P_DATE-LOW6(2) '.' P_DATE-LOW4(2) '.' P_DATE-LOW+0(4)
      INTO FRM_DATE.
      CONCATENATE P_DATE-HIGH6(2) '.' P_DATE-HIGH4(2) '.' P_DATE-HIGH+0(4)
      INTO TO_DATE.
      CONCATENATE TEXT-003 FRM_DATE' TO : ' TO_DATE INTO DISPTEXT.
      CONCATENATE TEXT-004 P_PLANT-LOW ' Storage Location : ' P_STLOC-LOW
      INTO DISPTEXT2.
      PERFORM FILL_HEADER USING IT_LIST_HEADER.
      SELECT  A~MATNR
              F~MAKTX
              A~CHARG
              A~BWART
              A~MENGE
              A~ZEILE
              A~WERKS
              A~SOBKZ
              D~BUDAT
              A~SHKZG
              A~DMBTR
              A~MBLNR
              A~LGORT
              INTO TABLE OPBAL
       FROM MKPF AS D JOIN MSEG AS A
               ON DMBLNR = AMBLNR  AND
                  DMJAHR = AMJAHR
            JOIN MARA AS E
               ON EMATNR = AMATNR
            JOIN MAKT AS F
               ON FMATNR = AMATNR
       WHERE   A~MATNR IN P_MATNR
         AND   A~WERKS IN P_PLANT
         AND   A~KZBEW IN (' ','B')
         AND   E~MATKL IN P_MGRP
         AND   A~BWART NOT IN ('541','542','321','322','121')
         AND   A~KZVBR NOT IN ('A')
         AND   D~BUDAT LE P_DATE-HIGH.
    LOOP AT OPBAL WHERE BWART EQ '544' AND LGORT EQ ''.
       TMP_OPBAL = OPBAL.
       APPEND TMP_OPBAL.
    ENDLOOP.
    DELETE OPBAL WHERE ( BWART EQ '309' AND DMBTR EQ 0  ).
    DELETE OPBAL WHERE ( BWART NE '543' AND LGORT EQ '' ).
    LOOP AT TMP_OPBAL.
       OPBAL = TMP_OPBAL.
       APPEND OPBAL.
    ENDLOOP.
    STOCKVAL = 0.
    SORT OPBAL BY MATNR BATCH BUDAT.
    LOOP AT OPBAL.
      SELECT SINGLE LBLAB INTO MSLB-LBLAB FROM MSLB
                            WHERE MATNR = OPBAL-MATNR.
      IF OPBAL-BUDAT LT P_DATE-LOW.
         IF OPBAL-SHKZG = 'H'.
            OPTOT = OPTOT - OPBAL-MENGE.
         ELSEIF OPBAL-SHKZG = 'S'.
            OPTOT = OPTOT + OPBAL-MENGE.
         ENDIF.
    For the duration   II part  *****************
      ELSEIF OPBAL-BUDAT IN P_DATE.
         IF OPBAL-SHKZG = 'H'.
            ISSTOT      = ISSTOT + OPBAL-MENGE.
         ELSEIF OPBAL-SHKZG = 'S'.
            RECTOT = RECTOT + OPBAL-MENGE.
         ENDIF.
      ENDIF.
    AT END OF BATCH. " modified for chek
       READ TABLE OPBAL INDEX SY-TABIX.
       CLEAR BAL_NOREF. REFRESH BAL_NOREF.
       SELECT MATNR SHKZG SUM( DMBTR )
         INTO TABLE BAL_NOREF
         FROM BSIM
        WHERE BUDAT LT P_DATE-LOW  AND
              MATNR EQ OPBAL-MATNR AND
              BWTAR EQ OPBAL-BATCH AND
              BWKEY IN P_PLANT     AND
              BLART IN ('RE','WE','WA','PR')
        GROUP BY MATNR SHKZG.
       LOOP AT BAL_NOREF.
          IF BAL_NOREF-SHKZG = 'H'.
             STOCKVAL = STOCKVAL - BAL_NOREF-DMBTR.
          ELSE.
             STOCKVAL = STOCKVAL + BAL_NOREF-DMBTR.
          ENDIF.
       ENDLOOP.
       CLEAR BAL_NOREF. REFRESH BAL_NOREF.
       SELECT MATNR SHKZG SUM( DMBTR )
         INTO TABLE BAL_NOREF
         FROM BSIM
        WHERE BUDAT IN P_DATE AND
              MATNR EQ OPBAL-MATNR AND
              BWTAR EQ OPBAL-BATCH AND
              BWKEY IN P_PLANT     AND
              BLART IN ('RE','WE','WA','PR')
        GROUP BY MATNR SHKZG.
       LOOP AT BAL_NOREF.
          IF BAL_NOREF-SHKZG = 'H'.
             ISS_STOCKVAL = ISS_STOCKVAL + BAL_NOREF-DMBTR.
          ELSE.
             REC_STOCKVAL = REC_STOCKVAL + BAL_NOREF-DMBTR.
          ENDIF.
       ENDLOOP.
       " MSLB-LBLAB (STOCK WITH SUBCONTRACTOR).
       CL_STKVAL       = STOCKVAL + REC_STOCKVAL - ISS_STOCKVAL.
       TOTALL =  OPTOT + RECTOT - ISSTOT.
       IF OPTOT = '0'   AND RECTOT = '0'  AND ISSTOT = '0'.
          FLG = 1.
       ENDIF.
       IF FLG = 1.
          CLEAR FLG.
       ELSE.
          SERNO = SERNO + 1.
          OPBAL2-SNO         = SERNO.
          OPBAL2-MATNR       = OPBAL-MATNR.
          OPBAL2-MAKTX       = OPBAL-MAKTX.
          OPBAL2-OP_BAL      = OPTOT.
          OPBAL2-REC         = RECTOT.
          OPBAL2-T_OPBAL_REC = OPTOT + RECTOT.
          OPBAL2-ISS         = ISSTOT.
          OPBAL2-T_ISS       = ISSTOT.
          OPBAL2-CL_BAL      = TOTALL.
          OPBAL2-BATCH       = OPBAL-BATCH.
          OPBAL2-SUBCON      = MSLB-LBLAB.
          OPBAL2-OP_STKVAL   = STOCKVAL.
          OPBAL2-ISS_STKVAL  = ISS_STOCKVAL.
          OPBAL2-REC_STKVAL  = REC_STOCKVAL.
          OPBAL2-CL_STKVAL   = CL_STKVAL.
          APPEND OPBAL2.
       ENDIF.
      OPTOT = 0.
      RECTOT = 0.
      ISSTOT = 0.
      STOCKVAL = 0.
      ISS_STOCKVAL = 0.
      REC_STOCKVAL = 0.
      CL_STKVAL    = 0.
    ENDAT.
    ENDLOOP.
      WA_SORT-SPOS = 1.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-UP = 'X'.
    WA_SORT-SUBTOT = 'X'.
    APPEND WA_SORT TO IT_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = REPID
          IT_FIELDCAT        = IT_FLDCAT
          IT_EVENTS          = IT_EVENTS
          IS_LAYOUT          = GS_LAYOUT
          IT_SORT            = IT_SORT
        TABLES
          T_OUTTAB           = OPBAL2.
    FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
       PERFORM FILL_PARAM_FLDCAT USING  1 'SNo'          'SNO'       ' ' 'X'
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  2 'Material No.' 'MATNR'     ' ' 'X'
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  3 'Description'  'MAKTX'     ' ' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  4 'Op.Bal'      'OP_BAL'     'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  5 'Op.Stock Val' 'OP_STKVAL' 'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  6 'Receipts'     'REC'       'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  7 'Total'     'T_OPBAL_REC'  'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  8 'Rect.Val.' 'REC_STKVAL'   'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING  9 'Issues'    'ISS'          'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 10 'Iss. Val.' 'ISS_STKVAL'   'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 11 'Cl. Bal.'     'CL_BAL'    'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 12 'Cl.Stock Val' 'CL_STKVAL' 'X' ' '
       'OPBAL2' P_FLDCAT.
       PERFORM FILL_PARAM_FLDCAT USING 13 'BATCH '       'BATCH'     ' ' ' '
       'OPBAL2' P_FLDCAT.
    ENDFORM.
    FORM FILL_PARAM_FLDCAT USING VALUE(P_COL) VALUE(P_TEXT) VALUE(P_FLDNAME)
                           VALUE(P_DOSUM) VALUE(P_NOZERO) VALUE(P_TABNAME)
                           PP_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
       DATA : WA_FLDCAT TYPE SLIS_FIELDCAT_ALV.
       CLEAR WA_FLDCAT.
         WA_FLDCAT-COL_POS   = P_COL.
         WA_FLDCAT-SELTEXT_M = P_TEXT.
         WA_FLDCAT-FIELDNAME = P_FLDNAME.
         WA_FLDCAT-TABNAME   = P_TABNAME.
         WA_FLDCAT-DO_SUM    = P_DOSUM.
         WA_FLDCAT-NO_ZERO   = P_NOZERO.
       APPEND WA_FLDCAT TO PP_FLDCAT.
    ENDFORM.
    FORM FILL_HEADER USING P_IT_LIST_HEADER TYPE SLIS_T_LISTHEADER.
      DATA: LS_LINE TYPE SLIS_LISTHEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = TEXT-002.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = DISPTEXT.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
      CLEAR LS_LINE.
      LS_LINE-TYP = 'S'.
      LS_LINE-INFO = DISPTEXT2.
      APPEND LS_LINE TO P_IT_LIST_HEADER.
    ENDFORM.
    FORM FILL_EVENTS USING P_IT_EVENTS TYPE SLIS_T_EVENT.
       DATA LS_EVENT TYPE SLIS_ALV_EVENT.
       MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
       MOVE 'TOP_OF_PAGE' TO LS_EVENT-NAME.
       APPEND LS_EVENT TO P_IT_EVENTS.
    ENDFORM.
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
         IT_LIST_COMMENTARY       = IT_LIST_HEADER.
    ENDFORM.
    FORM FILL_LAYOUT USING P_GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
       P_GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
       P_GS_LAYOUT-ZEBRA             = 'X'.
       P_GS_LAYOUT-FLEXIBLE_KEY      = 'X'.
    ENDFORM.
    FOR TESTING PURPOSE.
    *SORT OPBAL BY BUDAT.
    *CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM = REPID
         IT_FIELDCAT        = IT_FLDCAT
         IT_EVENTS          = IT_EVENTS
       TABLES
         T_OUTTAB           = OPBAL.
    *FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
      PERFORM FILL_PARAM_FLDCAT USING  1 'MBLNR'        'MBLNR'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  2 'CREDIT/DEBIT' 'SHKZG'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  3 'MOV.TYP.'     'BWART'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  4 'ST.LOC.'     'LGORT'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  5 'STOCK VAL'    'DMBTR'
      'OPBAL' P_FLDCAT.
      PERFORM FILL_PARAM_FLDCAT USING  6 'POS.DATE'     'BUDAT'
      'OPBAL' P_FLDCAT.
    *ENDFORM.

  • User Exit for Stock Placement for Next Empty Bin Strategy

    Hi Techi's
    I have got one requirment for stock placement in Warehouse Managment as below:
    If client uses the standared strategy for putting stock in Storage Bin as "Addition to Stock" Then the self life of the coming material is being replaced by the existing material's seft life.
    And if they use the "Next Empty Bin" strategy then the obove issue is not coming but system always searches for the full empty bin only thus wastage of the existing bin's which already has some space.
    Now what my client wants is that to use the "Next Empty Bin Strategy" so that self life is not being overwritten but along with system should not search the complete empty bin for placing the stock rather it should search the bin's which already has some space then later move to the empty bin's.
    In summary its a mixture of "Addition to Stock and Next Empty Bin" Strategy.
    Please suggest me the Exit for this if available or tell me the code if already has implemented it. Friends its going very hot.
    Please please help me.
    Thanks in Advance.
    -=Maddu=-

    Hi All,
    Please help me for this. I am heavyily stuck on this.

  • Always stay in "wait for sync" state for iCloud document

    From yesterday, I can not sync any document via iCloud document service. The documents are in "wait for sync" state forever, both on Mac OS X and iOS. This problem appeared in the Preview app, the TextEdit app, and all three iWork applications. I've tested 2 mac with 2 different network. Same problem.
    However, the iCal, Note and Reminder are still working.
    Is there anyone who can figure out what the problem is?

    https://discussions.apple.com/thread/5325841

  • Write a query / pl/sql statement for desired results

    Here is the table data:
    FSSETY FSUSER FSOBNM FSA FSCHNG FSDLT FSIOK FSICPY FSATN1
    1 DSTEIN P0030A N N N Y N Y
    1 FINAB001 P0030A Y Y Y Y Y Y
    1 FINAB001 P01012 Y Y Y Y Y Y
    1 DSTEIN P01012 Y Y Y Y Y Y
    1 DSTEIN P01013 Y Y Y Y Y Y
    1 FINAB001 P01013 Y Y Y Y Y Y
    1 FINAB001 P0111 Y Y Y Y Y Y
    1 DSTEIN P0111 Y Y Y Y Y Y
    1 DSTEIN P01111 Y Y Y Y Y Y
    1 FINAB001 P01111 Y Y Y Y Y Y
    1 FINAB001 P0115 Y Y Y Y Y Y
    1 DSTEIN P0115 Y Y Y Y Y Y
    1 DSTEIN P01BDWRD Y Y Y Y Y Y
    1 FINAB001 P01BDWRD Y Y Y Y Y Y
    1 FINAB001 P0411 Y Y Y Y Y Y
    1 DSTEIN P0411 N N N Y N Y
    What I need in results is:
    For each FSOBNM, return the rows with different FSUSER values and non-matching values in fsa OR fschng OR fsdlt OR fsicpy.
    So, the desired output of the query should return the first two rows and the last two rows, as they meet this criteria.
    I need help in the statement that would return the desired results.
    Thanks!
    Edited by: skyfox on 17-May-2012 5:54 PM
    Edited by: skyfox on 17-May-2012 5:54 PM

    Hi Skyfox,
    Below is the query you might be looking into
    SQL>
    SQL> WITH test AS(
      2  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0030A' FSOBNM, 'N' FSA, 'N' FSCHNG, 'N' FSDLT, 'Y' FSIOK, 'N' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      3  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0030A' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      4  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01012' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      5  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01012' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      6  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01013' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      7  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01013' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      8  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
      9  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    10  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    11  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01111' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    12  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0115' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    13  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0115' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    14  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P01BDWRD' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    15  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P01BDWRD' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    16  SELECT 1 FSSETY, 'FINAB001' FSUSER, 'P0411' FSOBNM, 'Y' FSA, 'Y' FSCHNG, 'Y' FSDLT, 'Y' FSIOK, 'Y' FSICPY, 'Y' FSATN1 FROM DUAL  UNION ALL
    17  SELECT 1 FSSETY, 'DSTEIN' FSUSER, 'P0411' FSOBNM, 'N' FSA, 'N' FSCHNG, 'N' FSDLT, 'Y' FSIOK, 'N' FSICPY, 'Y' FSATN1 FROM DUAL)
    18  SELECT *
    19    FROM test a
    20   WHERE EXISTS (SELECT 1 FROM test
    21                  WHERE fsobnm = a.fsobnm
    22                    AND fsuser != a.fsuser
    23                    AND (fsa != a.fsa OR fschng != a.fschng OR fsdlt != a.fsdlt OR fsicpy != a.fsicpy))
    24  /
        FSSETY FSUSER   FSOBNM   FSA FSCHNG FSDLT FSIOK FSICPY FSATN1
             1 DSTEIN   P0030A   N   N      N     Y     N      Y
             1 FINAB001 P0030A   Y   Y      Y     Y     Y      Y
             1 FINAB001 P0411    Y   Y      Y     Y     Y      Y
             1 DSTEIN   P0411    N   N      N     Y     N      Y
    SQL>

  • Is photoshop great for stocking pictures for MAC users?

    hi all, i am a mac user getting tired of iphoto. thinkin about replacing with photoshop or aperture. what do you think? how is photoshop to stock pictures?
    thanks

    >i am a mac user getting tired of iphoto. thinkin about replacing with photoshop or aperture. what do you think? how is photoshop to stock pictures?
    By all means, if your Mac hardware is strong enough give Aperture a trial. It absolutely rocks for the new killer-app category of DSLR image capture management. Lightroom is another choice, but IMO most appropriate only for folks with non-MacIntel hardware. Both are far superior to Photoshop for image capture management, especially for anyone who has not already gone through Photoshop's very heavy learning curve.
    I find that Aperture indeed 100% replaces iPhoto; however some iPhoto-experienced folks do keep iPhoto partially involved in their Aperture workflow.
    If you are not currently a Photoshop user I recommend the combination of Aperture for the all-important image capture management and RAW conversion, plus (inexpensive) Adobe Photoshop Elements v6 for those few times when heavier image editing, adding text, etc. is desired. For full professional graphics art work Adobe's very expensive Creative Suite series becomes appropriate, but your post did not seem to lead there.
    Step one with Aperture is to have at least 3-4 GB RAM on a MacIntel box. After adequate RAM is on board do the Aperture trial, and I strongly recommend that every digital photog with adequate computer hardware first spend $33 and work through the tutorial CD
    i Apple Pro Training Series: Aperture 2 (Apple Pro Training Series) by Ben Long, Richard Harrington, and Orlando Luna (Paperback - May 8, 2008), Amazon.com.
    Note that the value is in the tutorial, not in using the book as a manual. The time spent learning modern digital image capture workflow via the tutorial is invaluable,
    i nothing
    like the old days of Cumulus, Portfolio and iView Media Pro.
    IMO a cursory examination of Aperture usually turns out to be mostly a waste of time, or leads to bad workflow habits or folks simply do not get it. Carefully working the tutorial is by far the best way to learn this new killer app category.
    Good luck!

  • Stock Transfer for Excisable Materials Using Movement Type 301

    Hi,
    We are having a Plant 1002 as excisable Materials.
    During GR we following the process like GR (Part -I), Capture Invoice, Post Invoice.
    Can we transfer the Material from Plant 1002 to other Plant, say 1001, using Movement Type 301?
    Or we need to follow some other router for Stock Transfer for the Excisable Materials?
    I was told by the ex-consultant that we would be using Mov Type 301 for all Stock Transfers, but I have a doubt, please guide.*
    Regards,

    Hi PK,
    Here in Brazil we work with excisable material and when we have to transfer it plant to plant, we have to use IVA that performs tax posts on accounting document. Also, we have to create Nota Fiscal (BrazillianLegal Document).
    I think you have to talk to your legal/accounting area in order to make sure which procedure you will have to use.
    If you need tax posting on accounting document, then you will not be able to use 301 movement type.
    We use MM/SD Plant to Plant transfer (movement type 861 / 862)
    Depending on your Legal/accounting area feed back, you could use this scenario or just MM plant to plant transfer (movement type 303/305).
    If they are ok with no tax postings on accounting document, then 301 movement type should be used.
    Try to make a test, show then how it works, then you could get ok from then
    I hope it helps you.
    Best Regards,
    Natan

  • Stock determination for sales order stock

    Hi all,
    for our SAP retail solution - we have requirements for moving Consignment stock to Sales order stock for home delivery . Then Sales order stock needs to be withdrawn for inter company 643 movement . The stock determination is maintained as K first & then F with relevent settings in SPRO & article master, for consignment article -when sales order stock exist & delivery is created for intercompany PO with sales order on account assignment to transfer stock from Store to DC, SAP error message is not allowing to post Goods issue.
    What settings do we need to maintain for this to happen to withdraw from Sales order stock for consignment article ? Any help or information is highly appreciable.
    Thanks
    Krish

    This is the error message :-
    After calling stock determination, a quantity of                                               1.000 EA remains open
    Message no. WRF_CONS013
    Diagnosis
    During consignment processing in SAP Retail, the system called stock determination in order to decide which stock category should be used to take material 000000001000009740. However, the stock determination routine did not find enough stock in the relevant stock categories (as defined in the strategy). A quantity of                                               1.000 EA remains open.
    Please note that stock determination ignores the Negative Stocks Allowed setting.
    Procedure
    Check your stocks and settings for stock determination for material 000000001000009740 in plant 3001. Post stock transfers if necessary

  • Stock Statement

    Hi,
    As our customer requirement we need a report "Stock Statement" for given period (From date - To date) with the following columns
    Item
    Opening Stock Qty
    Opening stock Value
    Receipt Qty
    Receipt Value
    Issue (Consumption) Qty.
    Issue (Consumption) Value
    Closing stock qty
    Closing stock value.
    Expecting your valuable solutions and it would be rewarded fully.
    Thanks & Regards,
    Venkatesan G.

    Hi,
    I had this problem last week (to know the initial stock for a given item and a past date). The only way which I found to solve it ,was to recalculate the initial stock.
    To do it, I used two tables (OINM and OITW). Here is an excerpt of my query, which does only what you asked for:
    DECLARE @ItemCode varchar(15)
    DECLARE @StartDate smalldatetime
    SELECT @ItemCode = $[$38.1.0], @StartDate = $[$12.1.Date]
    -- Before inserting the misc. operations, we have first to recalculate the initial stock
    -- We have to do the following:
    -- - Add or deduce, from the actual stock, all the movements which are stored in the OINM table
    SELECT W0.ItemCode, @StartDate, W0.WhsCode, W0.OnHand - ISNULL (SUM (I0.InQty - I0.OutQty), 0), 0
    FROM OITW W0 LEFT OUTER JOIN OINM I0 ON W0.ItemCode = I0.ItemCode AND W0.WhsCode = I0.Warehouse
    WHERE I0.DocDuedate >= @StartDate
    GROUP BY W0.ItemCode, W0.WhsCode, W0.OnHand
    HAVING W0.ItemCode = @ItemCode AND W0.OnHand - ISNULL (SUM (I0.InQty - I0.OutQty), 0) >= 0
    UNION
    SELECT W0.ItemCode, @StartDate, W0.WhsCode, 0, -(W0.OnHand - ISNULL (SUM (I0.InQty - I0.OutQty), 0))
    FROM OITW W0 LEFT OUTER JOIN OINM I0 ON W0.ItemCode = I0.ItemCode AND W0.WhsCode = I0.Warehouse
    WHERE I0.DocDuedate >= @StartDate
    GROUP BY W0.ItemCode, W0.WhsCode, W0.OnHand
    HAVING W0.ItemCode = @ItemCode AND W0.OnHand - ISNULL (SUM (I0.InQty - I0.OutQty), 0) < 0
    Just don't forget to give correct values to the two variables, since in my case they were taken from the Invoice window.
    In my case, I was in need of this to show the evolution of an item's stock during time.
    Regards,
    Eric

  • Fwding agent in Shipping Data fr Stock Transfer of Purchasing Document Item

    Hi,
    I want to know how to configure the Forwarding agent in Shipping Data For Stock Transfer of Purchasing Document Item (ME21N).
    I have used the Forwarding agent as Partner function in Header level but it does not appears in VL10D where we create deliveries from open Purchase orders.
    Regards,
    Abhilash

    Hi,
    Just follow the steps:-
    1) You should check the shipping point assignment under SPRO-> Logistics Execution-> Shipping->Basic Shipping Functions->Shipping points & Goods receiving point determination-> Assign shipping points.
    OR.....
    You may directly check from table also....>
    Put T-code SE16-Table TVSTZ
    Put your plant and shipping point and check the correct assignments.
    2 ) Go to table T001W and check the assignment of customer to plant.And also check the sales area in this table for both Supplying & Receiving plant.
    3) Check wether the customer is in the required sales area or not.
    If still u face problem kindly reply me.
    Regards,
    Savita

  • Query  for  Closing Stock goes beyond a particular value.

    Hi,
    The query for the following requirement:
    The Closing Stock goes beyond a particular value. The Closing Value of items crosses the pre-defined value.

    Hi,
    Yes it is related to the user selected date and stock level. Not answered Closing the thread.
    Edited by: Neela M B on Aug 28, 2010 3:08 PM

  • Query regarding the fields details in particular form for all the users in

    Dear All,
                  I have one query regarding the fields details in particular form for all the users in company.
    Let take an exapmle if i had created Purchase Order having fields in content tab as 1.Item No. 2.Quantity 3.Unit Proce   4.Total   5. Location.
    While Login in User manager i set these fields only for Purchase order , but when i login from other user and open the similar purchase order the defaults fields are also seen including  above 4 fieds .
    Now my question is how to set the User choice fiels for the particular form that are common to all users.
    Means whenever i login in any user and opens the same document the same fields should be seen....Thanksssss.........

    You have to login with each and every user and do the Form Settings of every forms, so that all the forms look same for all the users.
    This is a manual job and you have do do it with every user login.
    Alternately, you can try out this link that explains
    [How to Copy One Screen Layout to Another User|http://www.sbonotes.com/2008/03/how-to-copy-one-screen-layout-to.html]

  • Query for stocks on hand

    I would like to know if it is possible to create a query that would display the stocks of all items on a specific date and will display the item cost or the purchase price of each item in stock. Let say for example, today is January 14, 2010. I would like to check how many stocks in my inventory last January 8, 2010. Does anybody knows how to create this?
    Thank you.

    Hi Don Elicor,
    Check the below thread, you will be get some idea or Solution.
    Inventory Report by Query
    Query for Inventory Activity for whse & dates
    Item Stock Report
    Item Stock Report
    Regards,
    Madhan.

  • How to query a item stock quantity for a given date

    Hi there,
    I need to query the stock quantity of an item for a given date. For example, i want to know how many pieces of A i have on stock at the 20th of march 2009.
    I know there is a report, but i need the value for a subquery.
    Regards Steffen

    Sorry Gordon,
    Your query is not wrong, far from me to insult your work. It does indeed make full sense if the business process allows the item description to change.
    If not, we can avoid a "inner join"  = smaller, cleaner and (theoritically) faster query
    Here is your code with the little review:
    SELECT T0.ItemCode, T0.Dscription, sum(T0.InQty - T0.OutQty) as 'On Hand'
    FROM DBO.OINM T0
    WHERE T0.DocDate <= '[%0]' and T0.ItemCode = '[%1]'
    GROUP BY T0.ItemCode, T0.Dscription
    Cheers
    tested on 2007 SP00 PL46

Maybe you are looking for