Block stock calculation from mseg table for any given date.

I am calculating stock from mseg table for any given date. Not just month end stock or current stock. It could be back date also. It is tallying also with MB5B stock report of that date. Now I have to bifurcate that stock into unrestricted stock, quality stock and block stock.
I have checked INSMK and ZUSTD field in mseg table, but could not concluded. Should I check movement type wise? Block/ Quality stock could be transferred into unrestricted stock also. That also I have to take care.
Can anyone clearly explain how the stock type posting takes place in mseg table when goods receipt as block / quality stock and when the same goods transferred in unrestricted stock, what are the reference indication.

DATA : LIST_TAB TYPE TABLE OF ABAPLIST.
DATA: BEGIN OF VLIST OCCURS 0,
      FIELD1(5)  TYPE C,
      FIELD2(19) TYPE C,
      FIELD3(16) TYPE C,
      FIELD4(17) TYPE C,
      FIELD5(25) TYPE C,
      FIELD6(24) TYPE C,
      FIELD7(25) TYPE C,
      FIELD8(25) TYPE C,
      END OF VLIST.
TYPES : BEGIN OF ITAB,
       MATNR(18) TYPE C,
       WERKS(5) TYPE C,
       END_MENGE(20) TYPE C,
       END OF ITAB.
DATA : ITAB TYPE STANDARD TABLE OF ITAB WITH HEADER LINE,
        WA_TAB TYPE ITAB.
----submit command to run mb5b in the background and -
----push the data into an internal table -
" Calling MB5B for displaying the Closing Stock
SUBMIT RM07MLBD USING SELECTION-SCREEN  '1000'
                WITH DATUM BETWEEN S_DATE-LOW AND S_DATE-HIGH
                WITH MATNR IN S_MATNR WITH WERKS IN S_WERKS
                WITH BWART-LOW = '601' EXPORTING LIST TO  MEMORY
                AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
  TABLES
    LISTOBJECT = LIST_TAB
  EXCEPTIONS
    NOT_FOUND  = 1
    OTHERS     = 2.
CALL FUNCTION 'LIST_TO_ASCI'
  EXPORTING
    LIST_INDEX         = -1
  TABLES
    LISTASCI           = VLIST
    LISTOBJECT         = LIST_TAB
  EXCEPTIONS
    EMPTY_LIST         = 1
    LIST_INDEX_INVALID = 2
    OTHERS             = 3.
LOOP AT VLIST WHERE FIELD1 CS '|'.
CHECK SY-TABIX GE 4.
MOVE :  VLIST-FIELD1+1(4) TO ITAB-WERKS,
        VLIST-FIELD2+1(18) TO ITAB-MATNR,
        VLIST-FIELD8 TO ITAB-END_MENGE.
APPEND ITAB.
ENDLOOP.
This is the program to call MB5B and the standard program and use the following settings for the closing stock opening stock and block stock

Similar Messages

  • How to find the Day on a Week for any given Date

    Hi..... I need your help to find out the Day on a Week for any given Date .
    Say if the Date is 31/12/2009 , what would be the Day on a Week for this Date.
    Are there any fucntions available to determine the same?
    Please let me know....Thanks in Advance
    Regards
    Smita

    Hi ,
    You can using the following peice of code to get the Day of a Week for the given date :
    Calendar now = Calendar.getInstance();   
    System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1)  
         + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR));
    //create an array of days  
    //Day_OF_WEEK starts from 1 while array index starts from 0        
    String[] strDays = new String[]{"Sunday",  "Monday", "Tuesday", "Wednesday",  "Thusday",   "Friday",  "Saturday" };   
    String day_of_week = strDays[now.get(Calendar.DAY_OF_WEEK) - 1];     
    System.out.println("Current day is : " + strDays[now.get(Calendar.DAY_OF_WEEK) - 1]  );
    Edited by: Ritushree Saha on Jun 4, 2009 1:09 PM

  • Get week number for any given date

    How to get a week number in Java?

    / ====================================================
    Method: Get the desired Date format for the date
    Developed By: Sandip Waghole [29-Jan-2010]
    ==================================================== /
    public String getWeekNo(String strDate)
    // input Date Format : M/dd/yyyy
    int weekNo=0,i=0;
    String strWeekNo=null;
    int noOfDaysInTheYear=365;
    int WEEK_STARTS_ON = 1; // Define the day on which week starts Sunday/Monday 1:Sunday 2:Monday
    int firstDayNoInFirstWeekOfPresentYear=0; // Inititalize teh day on which week is starting in present year
    int firstDayOfPresentYear=0; // Inititlize the 1st day of the present year whether Sunday/Monday/.....
    int[] monthDaysArray = {31,28,31,30,31,30,31,31,30,31,30,31}; // Define array of the days as per months
    int todaysDayNoInPresentYear=0;
    int daysLateByFirstWeekStartedAfterYearStarted=0;
    int intTemp=0;
    //strDate="08/24/2000"; // For test purpose
    StringTokenizer strDateTok = new StringTokenizer(strDate, "/ ");
    int month = Integer.parseInt(strDateTok.nextToken());
    int day= Integer.parseInt(strDateTok.nextToken());
    int year = Integer.parseInt(strDateTok.nextToken());
    GregorianCalendar cal = new GregorianCalendar();
    // Check if present year is leap year
    boolean boolIsLeapYear = cal.isLeapYear(year);
    // If it is boolean year then add 1 to total days in the year & add one more day to february
    if(boolIsLeapYear)
    noOfDaysInTheYear=noOfDaysInTheYear+1;
    monthDaysArray[1]=monthDaysArray[1]1;
    // Find the 1st day of this year
    Calendar calObj = new GregorianCalendar(year, Calendar.JANUARY, 1);
    firstDayOfPresentYear = calObj.get(Calendar.DAY_OF_WEEK);
    int intRemoveNoOfDaysFromWeek=0;
    // # Find the day no of prsent day
    for(i=0;i<month;i+) // get no of days till present year
    intTemp = intTemp monthDaysArray;
    todaysDayNoInPresentYear = intTemp - (monthDaysArray[month-1]-day);
    if(firstDayOfPresentYear==6 || firstDayOfPresentYear==7) // If first Day is Friday or Saturday then it is week
    // Identify the the day no on which 1st week of present year is starting
    firstDayNoInFirstWeekOfPresentYear = 7 - firstDayOfPresentYear WEEK_STARTS_ON 1;
    // Find delay in the 1st week start after r=the year start
    daysLateByFirstWeekStartedAfterYearStarted = firstDayNoInFirstWeekOfPresentYear - 1;
    // Now week is starting from Sunday
    weekNo = (Integer)((todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted)/7);
    // Find the day no of today
    intTemp = (todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted) % 7;
    if(intTemp > 0)
    weekNo=weekNo+1;
    else
    weekNo=weekNo;
    else
    // 1st week is starting on 1st Of January
    firstDayNoInFirstWeekOfPresentYear=firstDayOfPresentYear;
    // Remove no. of days from the 1st week as week is starting from odd Sunday/Monday/Tuesday/Wednesday/Thursday
    intRemoveNoOfDaysFromWeek = 7-firstDayOfPresentYear 1; // 1 added as include start day also
    // So one week will be added in no. of weeks
    weekNo = (Integer)((todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek)/7);
    // Find the day no of today
    intTemp = (todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek) % 7;
    weekNo = weekNo +1; // As 1st weeks days are reduced from the todays day no in the year
    if(intTemp > 0)
    weekNo=weekNo+1;
    else
    weekNo=weekNo;
    // Remove the no. of days from the week 1
    strWeekNo=Integer.toString(weekNo);
    return strWeekNo;
    // Any issues please mail on [email protected]

  • 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

  • Performance tuning for extraction of data from MSEG table

    Hello experts,
    I m trying to extract data via select query from MSEG table based on non-primary keys, which affects my performance.
    Below is my select query  :
    SELECT SINGLE menge
    FROM mseg
    INTO w_rejqty
    WHERE ebeln = it_mseg-ebeln AND
          ebelp = it_mseg-ebelp AND
          bwart = '122'.   
    Kindly suggest some alternative way for it apart from creating secondary index on table MSEG which would be my last option because already four secondary index are created in my present situation and also is it advisable to create fifth secondary index for my problem?? Would it affect my database performance?
    Thanks in advance
    Raj

    Hi Raj,
    is that possible to use this query below ? You might ask to Functional whether is possible or not.
    SELECT SINGLE belnr gjahr buzei INTO w_ekbe FROM ekbe
        WHERE ebeln = it_mseg-ebeln
        AND     ebelp = it_mseg-ebelp
    SELECT SINGLE menge FROM mseg INTO w_rejqty
       WHERE mblnr EQ w_ekbe-belnr
       AND   mjahr EQ w_ekbe-gjahr
       AND   zeile EQ w_ekbe-buzei
    Best Regards
    Fernand

  • Can we get the raw materials for a classified Material from MSEG table?

    Hi All,
    Can we get the raw materials for a classified Material from MSEG table using Order number?
    If yes How we can find it out for Past month only? As well how we can get the std price for this raw material.
    Please help me out,
    Thanks,
    Ravi

    Field STPRS (Standard price) From Table MBEW.
    Kanagaraja L

  • FM to read data from MSEG table

    Hi all,
    can any one provide me the Function Module to fetch data from MSEG table by giving inputs
    1) materail doc number (MBLNR)
    2) MJAHR Doc year.
    or is there any other method to fetch data with high performance.

    itabh is mkpf header table.
    if not itabh is initial.
    SELECT fielname(s)
    INTO TABLE ITAB FROM MSEG
    FOR ALL ENTRIES IN ITABH
    WHERE MBLNR EQ ITABH-MBLNR
    AND MJAHR EQ ITABH-MJAHR
    AND WERKS EQ PR_WERKS
    AND LGORT IN PR_LGORT
    AND BWART IN ('261','262')
    and AUFNR IN S_AUFNR
    endif.
    Avoid using select * try to mention the field name which are required.
    try to use all key fields.
    and before writing FOR ALL ENTRIES make sure the table ITABH is not empty.

  • I have an iMac 3.06 24" late 2008 model. On the superdrive slot, one of the rubber protective strips is damaged. When I eject a disc, it blocks the disc from fully releasing. Any help in fixing this?

    I have an iMac 3.06 24" late 2008 model. On the superdrive slot, one of the rubber protective strips is damaged. When I eject a disc, it blocks the disc from fully releasing. Any help in fixing this?

    Ok, maybe it isn't rubber but it felt like it. Maybe it is felt or something similar. But you can see in the photos what the problem is. I am just afraid that the piece is going to get jammed into the super drive and really screw it up. Thanks for investigating.

  • Where did this backup window come from on my desktop.  I have always used time machine to backup to an external disc and within the last 2 weeks, this backup window keeps appearing.  Where did it come from?  Thanks for any help

    where did this backup window come from on my desktop. It specifies personal data & settings and tells me when the next backup is scheduled [which I never set up].   I have always used time machine to backup to an external disc and within the last 2 weeks, this backup window keeps appearing.  Where did it come from?  Thanks for any help

    To check your S.M.A.R.T status open disk utility and click on your drive and then click on the info icon.

  • Table for Valid to date in BOM item

    Hi Exeprts,
    Can any one help me on this in which db table Valid to date:DATUB is Updates with reference to Change Number.
    Best Regards,
    Venkata Siva.
    Edited by: venkata siva reddy on Apr 27, 2011 9:28 PM

    Hi
    The Valid-to date will always be set to 31.12.9999. Instead you can get the valid-to date using the below logic.
    -> Get all the BOM from T415A table for the material number into T_T415A
    -->LOOP AT t_t415a.
        ON CHANGE OF t_t415a-matnr OR t_t415a-werks OR t_t415a-stlal.
          IF sy-tabix NE 1.
            MOVE : v_matnr TO t_dates-matnr,
                   v_werks TO t_dates-werks,
                   v_stlan TO t_dates-stlan,
                   v_datuv TO t_dates-datuv,
                   v_stlal  TO t_dates-stlal.
            IF v_matnr NE t_t415a-matnr.
              t_dates-datub = c_99991231.
            ELSE.
              t_dates-datub = t_t415a-datuv - 1.
            ENDIF.
            APPEND t_dates.
            CLEAR :
            v_matnr,
            v_werks,
            v_stlan,
            v_datuv,
            v_stlal.
          ENDIF.
        ENDON.
        v_matnr = t_t415a-matnr.
        v_werks = t_t415a-werks.
        v_stlan = t_t415a-stlan.
        v_datuv = t_t415a-datuv.
        v_stlal = t_t415a-stlal.
      ENDLOOP.
    Regards
    Dhurga

  • Status of Stock on any given date/Complex

    Hi Experts,
    I want to display the status of stock(Like MMBE) on any given date. Actually i am trying to capture the MSEG data and categorize based on the movement types/stock status/special stock indicator and trying to calculate the status of stock in each category.
    I find it complex when i handle the case like following...as there is no clue direclty available in the MSEG for the stock status.
    1. Mov .643 - Stock 100 kg is posted as Stock in TransferC.C
    2. Mov. 101 - GR Stock 50Kg  posted in Restricted stock category
    Now when i display the stock status as per my logic it shows that Stock in Transit is 100kg and Restricted Stock is 50Kg
    Actually it has to be 50Kg in each category.
    How to acheive the above ?
    Could You please share your experience and suggestions to overcome the above situation.
    Regards
    Prasath

    Hi,
    Try with folowing t.codes
    MB52,
    MC.9,
    MCRE,
    WSL7,
    MB5B,
    MB5T
    Regards,
    Biju K

  • How to get start date of the period for a given date from cube

    I have a situation where i need to find the start day of the period for a given date. is there a way to know that. i want to use that in my report. i enter the date from my report(i have date parameter), depends on the date, i want to display the start day
    of the period. how can i write expression for that in my report?
    ram

    Hi ramprasad74,
    According to your description, you are using Analysis Services as a data source for the report, the cube has hierarchy: Fyear, FQuarter, FPeriod, fweek, Fdate. You want to add a date parameter to the report, after you changed value of the parameter, the
    report will return the first day of FPeriod.
    To achieve your goal, we need to add a parameter to the report, then use the parameter in mdx query. For detail information, please refer to the following steps:
    In the Report Data pane, right-click on a dataset created from a SQL Server Analysis Services data source type, and then click Query. The MDX query designer opens in Design mode.
    On the toolbar, click Design to toggle to Query mode.
    On the MDX query designer toolbar, click Query Parameters symbol. The Query Parameters dialog box opens.
    In the Parameter column, click <Enter Parameter>, and then type the name of a parameter.
    In the Dimension column, choose a value from the drop-down list.
    In the Hierarchy column, choose a value from the drop-down list.
    In the Default column, from the drop-down list, select a single value.
    Click OK. 
    In query designer dialog box, type the mdx query like below:
    with member [Measures].[FirstChild]
    as
    [Date].[Fiscal].currentmember.parent.firstchild.name
    select {[Measures].[FirstChild]} on 0,
    [Date].[Fiscal].[Date].members on 1
    from
    ( SELECT ( STRTOSET(@ParameterName, CONSTRAINED) ) on 0
    from
    [Cube]
    Here are relevant threads you can reference:
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/c7146ac3-40ea-4d53-b321-c707aebbd405/how-to-pass-date-parameter-to-mdx-query
    https://social.msdn.microsoft.com/forums/sqlserver/en-US/fd12a865-bc90-4a65-af42-ce38a8cfa29b/pass-date-time-parameter-to-mdx-query-ssrs
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.

  • How to retrieve data from plsql table in BI publisher Data template

    Hi All,
    I have created a data template for XML publisher report. In data template i m getting data from plsql table. for that i have created one package with pipelined function. I am able to run that sql from sql developer .But if i run the concurrent program then i got error like "java.sql.SQLSyntaxErrorException: ORA-00904: "XXXXX": invalid identifier".
    I have used the same parameters in Data template and concurrent program....
    please clarify me what needs to be done....
    thanks in advance....
    Regards,
    Doss

    Hi Alex ,
    i am using pipelined function and get the data from cursor and load it into plsql table (nested table). and i use the below in my data template to fetch the data:
    <sqlStatement name="Q1">
    <![CDATA[select * from  table(PO_SPEND_RPT_PKG.generate_report(P_ORG_ID,P_SOB_ID,P_ORG_NAME,P_PERIOD_NAME,P_CLOSE_STATUS,P_E_PCARD_NEED,P_REPORT_TYPE))]]>
    </sqlStatement>
    if i run the above in sql developer i can get the result....from apps if i run i got the error "java.sql.SQLSyntaxErrorException: ORA-00904: "P_ORG_ID": invalid identifier"
    Edited by: kalidoss on Sep 14, 2012 4:32 AM

  • Total of the number of stock lines held in storage at any given time

    Hi Experts,
      Is there a transaction we could use that will quickly give us a total of the number of stock lines held in storage at any given time? can anyone please advise
      Many Thanks

    Solved.
    SE16 and table LQUA or LAGP. LAGP is more logical but takes longer to generate the result.
    Regards
    Simon

  • How to find from which table we got the data

    Hi friends ,
    How can we find from which table we r getting data in the datasource.
    I am getting data from crm system.based on that we created cubes and dsos.
    we have only one datasource.now i need to know from which table we pull the data?
    can any one give the procedure
    Thanks in advance........
    sridath

    Hi,
    Datasource / tables in the source system
    Go to RSA2 (DS Repository) in your source system and display your source system.
    If Extraction Method is 'V' - you are lucky and you see table name where data is taken from.
    If it is F* - function module is used, and you have to go thru its code to see all the tables it uses and logic how data is
    processed.
    Ext. Meth   Short text                                                                               
    V                 Transparent Table or DB View                
    D                  Fixed Domain Value                          
    F1                Function Module (Complete Interface)        
    F2                Function Module (Simple Interface)          
    Q                 Extraction Using ABAP Query                 
    A                 DataSource Append                           
    OR
    Since you have the extract structure and the extractor, you must have some transaction like the Extractor Checker RSA3. If so
    then execute ST05, switch on the trace and execute the extractor checker. Once the extractor checker presents the results
    switch off trace. The clcik on Display trace and you will see all the tables that were hit by the extractor checker to
    retrieve data and present it to you.
    Hope this helps.
    Thanks,
    JituK

Maybe you are looking for

  • Error in Code Different Ways

    Hi All, I tried in my ways but iam unable to resolve it. Pls help me... I have code like this... but the total number of records fetched is shown as 0. even though i have records in my database. I write the code in am as follows public void dosome( i

  • Viewing folders in iPhoto 08

    Ever since I got iPhoto 08 I have been uncomfortable because I'm unable to view individual folders (year/month/day). I don't like the closed architecture of the program either for filing or for backup. I am sure there are folders. Does anyone know ho

  • Scroll down programmatically the vertical scrollbar in hierarchical trees

    I manually select nodes in the tree. When the node is expanded the leaf nodes doesn4t appear on the screen. Then I have to scroll down the vertical scrollbar to see it. Is it possible to scroll the tree so that the selected node appears on the screen

  • Getting a error when Muse Website is viewed in browser:MuseJSAssert: Error calling selector function

    Every time I open any  .html  file in a browser I recieve this error message; MuseJSAssert: Error calling selector function: TypeError: Object does'nt support property or method 'museMenu'

  • Coherence incubator for lower versions of coherence

    Hi,      I saw that oracle has released the new version of coherence incubator for monitoring. https://blogs.oracle.com/OracleCoherence/entry/coherence_jvisualvm_plugin_released_in    We are using coherence version 3.7.1.11. Can we use the incubator