Available stock in Backorder report

Hi,
How can I have the available qty (In stock - Committed + Ordered) in the Backorder report for viewing purposes? In PLD, what is the field for this specific field?
Appreciate the PLD experts.
Thanks,
Harith

This PLD does not expose the OITW table from where the OnHand, and other quantites can be added.  Using the Alt in the table selection to manully add the OITW will not also help as linking fields does not work.
Thats why this will not be possible.
Suda

Similar Messages

  • Available stock serial numbers report

    Hi every One
    Im  having a requirement i just want a report  with serials number wise  instock items the format is
    Instock Available serial number
    Item Code
    Stock IN date
    Aging(0-90)
    90-180
    180-270
    270-360
    <360days
    total
    kindly do the need ful
    regards
    Rajeev

    Copy only the Bold Letters.
    Select t.ItemCode,t.IntrSerial,t.InDate,t.Quantity,
    isnull(case when t.Days <=30 then t.Quantity end,0)[0-30 Days] ,
    isnull(case when t.days <= 30 then t.Quantity end,0)[0-30 Days-Value] ,
    isnull(case when t.days between 31 and 60 then t.Quantity end,0) [30-60 Days],
    isnull(case when t.days between 61 and 90 then t.Quantity end,0) [60-90 Days],
    isnull(case when t.days between 91 and 180 then t.Quantity end,0) [90-180 Days],
    isnull(case when t.days between 181 and 360 then t.Quantity end,0) [180-360 Days],
    isnull(case when t.days >= 361 then t.Quantity end,0) [Above 360 Days]
    from
    select t0.ItemCode,IntrSerial,Indate, 1 as Quantity,datediff(dd,Indate,GETDATE())'Days' from osri t0
    where Status='0'
    as t
    Regards,

  • Available stock report with confirm order quantity

    Dear,
    Is there any report which gives -
    Available Stock - Sales order confirmed = Free stock.
    Regards,
    Syed Hussain.

    Hi,
    Yes, you have to develop a mass-MD04 like transaction. But please consider that several factors influence the available qty (planning startegy, procurement proposals, etc).
    The available changes with time as well - I mean you may get different available stock levels if you check MD04 for this day and for next Wednesday because there might be e.g. requirements between the two.
    remark:
    Stock - SO quantity = Available qty > As I mentioned this may be not true since this rule doesn't consider the whole planning situation.
    Regards,
    Csaba

  • Backorder Reports V.15 and V_RA

    Hi !
    Can someone explain to me how exactly these reports works. These reports show orders that are fully confirmed. I was hoping these reports will only show orders that the fully or partially unconfirmed (which is my client's definition of a Backorder)
    What is SAP's definition of a Backorder (in the context of these reports).
    I am not liking these reports and I am inclined to develop custom Backorder reports for my client... though I would like to avoid that if possible.
    Input from anyone experienced in these reports is greatly appreciated.
    Thanks,
    Anisha.

    Hi Anisha,
    See, basically back order means following:
    Your customer had placed an order for 100 qty, out of which you could confirm only 30 & deliver the same. At this point of time a sales order will deliver only confirmed qty that is 30 & rest will be on backorder (that qty deliverable after some days after availibility check & confirmation).
    Later when stocks arrive you can either run availibility check thru sales order or by using the reports you mentioned.
    These are not only reports, but also used as transaction. see when you run V_RA you can see material wise the backorder quantities, wherein you can manually change the confirmation.
    Other use of these transaction is that, suppose you have created two orders in sequence but the second one has to be delivered first. But due to availibility check you entire stock is in fiest sales order. Using these reports you can also release stock from first order & confirm it for second & deliver it.
    Customised reports is a good options but its always better to use standard SAP functionality.
    Hope this is very much helpful to you.
    Regards,
    Dhananjay

  • Tables used for a Stock-In-Hand Report ?

    Hi,
    I need to generate a stock in hand report. For this report I only need to consider Purchasing Inventory Stock and not the Sales Order Stock. What tables do I have to use?, if possible the query!
    Thanks,
    Kishan

    Hi Kishan,
    Try and use FM 'BAPI_MATERIAL_AVAILABILITY'. I have used this FM in the past for Stock on Hand reports. Only drawback is that it only runs for one material / plant at a time!
    You cold also use FM 'AVAILABILITY_CHECK':
    Structure to hold ATP Controller: Control Parameters
      DATA: BEGIN OF st_atpca.
              INCLUDE STRUCTURE atpca.
      DATA: END OF st_atpca.
    Table to hold ATP: Requirements to be Checked/Considered
      DATA: BEGIN OF tbl_atpcs OCCURS 0.
              INCLUDE STRUCTURE atpcs.
      DATA: END OF tbl_atpcs.
    Table to hold ATP Server: ATP data for display
      DATA: BEGIN OF tbl_atpds OCCURS 0.
              INCLUDE STRUCTURE atpds.
      DATA: END OF tbl_atpds.
    Table to hold ATP Server: Material Table
      DATA: BEGIN OF tbl_atpmat OCCURS 0.
              INCLUDE STRUCTURE atpmat.
      DATA: END OF tbl_atpmat.
    Populate ST_ATPCA
      CLEAR st_atpca.
      st_atpca-anwdg  = '8'.    "Calling App - Explaination
      st_atpca-azerg  = 'T'.    "ATP Display Result
      st_atpca-rdmod  = 'A'.    "Read Mode - Totals
      st_atpca-xenqmd = 'N'.    "Do not read Blocks
    Populate TBL_ATPCS
      CLEAR tbl_atpcs.
      REFRESH tbl_atpcs.
      tbl_atpcs-matnr  = p_matnr.  "Material
      tbl_atpcs-werks  = p_werks.  "Plant
      tbl_atpcs-prreg  = 'A'.      "Checking Rule for Avail Check
      tbl_atpcs-chmod  = 'EXP'.    "ATP: Check mode
      tbl_atpcs-delkz  = 'VC'.     "MRP element indicator
      tbl_atpcs-bdter  = sy-datum. "Requirements date for the component
      tbl_atpcs-xline  = '1'.
      tbl_atpcs-trtyp  = 'A'.      "Transaction type - Display
      tbl_atpcs-idxatp = '1'.
      tbl_atpcs-resmd  = 'X'.      "Mode for Results of Check - Proposal
      tbl_atpcs-chkflg = 'X'.
      APPEND tbl_atpcs.
      CALL FUNCTION 'AVAILABILITY_CHECK'
           TABLES
                p_atpcsx  = tbl_atpcs
                p_atpdsx  = tbl_atpds
                p_atpmatx = tbl_atpmat
           CHANGING
                p_atpca   = st_atpca
           EXCEPTIONS
                error     = 1
                OTHERS    = 2.
    Would recommend giving both these FM's a go and see if they have what you want.
    Cheers,
    Pat.
    PS. If you find these suggestions helpful, kindly award Reward Points appropriately.

  • Needs Help in Backorder Report!

    Good day to everyone.
    I would like to ask for help in checking the Backorder Report below. The user requirement is to include the plant field in the Report. Though I already included the plant field, the program encounters ABAP runtime upon execution. Please help me correct the errors that is being encountered.
    Thank you very much.
    Raffee
    REPORT zsdr_out_of_stock  LINE-SIZE  380
              LINE-COUNT 65 NO STANDARD PAGE HEADING.
    TABLES:  mara,
             zcust,
             vbrk,
             vbak,
             vbap.
    Start of Internal tables for Out of Stock
    DATA: BEGIN OF it_total_out_stock1 OCCURS 0,
            fkdat  LIKE vbrk-fkdat,         "Billing Date
            bukrs  LIKE vbrk-bukrs,         "Company
            knumv  LIKE vbrk-knumv,         "No of the document condition
            vbeln  LIKE vbrp-vbeln,         "Billing Doc
            posnr  LIKE vbrp-posnr,         "Item
            aubel  LIKE vbrp-aubel,         "Sales Order
            aupos  LIKE vbrp-aupos,         "Sales Item
            matnr  LIKE vbrp-matnr,         "Material No.
            fkimg  TYPE p DECIMALS 2,       "Billed Quantity
            auart  LIKE vbak-auart,
            kunnr  LIKE vbak-kunnr,
            vkbur  LIKE vbak-vkbur,           "Sales office
            vkorg  LIKE vbak-vkorg,           "Sales organization
            vkgrp  LIKE vbak-vkgrp,           "Sales group
            zcusno LIKE zcust-zcusno,
            zregion LIKE zcust-zregion,
          END OF it_total_out_stock1.
    DATA: BEGIN OF it_total_out_stock2 OCCURS 0,
            vbeln   LIKE vbak-vbeln,
            auart   LIKE vbak-auart,
            kunnr   LIKE vbak-kunnr,
            vkbur   LIKE vbak-vkbur,           "Sales office
            vkorg   LIKE vbak-vkorg,           "Sales organization
            vkgrp   LIKE vbak-vkgrp,           "Sales group
            zcusno  LIKE zcust-zcusno,
            zregion LIKE zcust-zregion,
          END OF it_total_out_stock2.
    DATA: BEGIN OF it_vbap OCCURS 0,
              vbeln  LIKE vbap-vbeln,
              posnr  LIKE vbap-posnr,
              werks  LIKE vbap-werks,
              matnr  LIKE vbap-matnr,
              netwr  LIKE vbap-netwr,
              kwmeng LIKE vbap-kwmeng,
              bukrs_vf LIKE vbak-bukrs_vf,
              knumv  LIKE vbak-knumv,
              kunnr  LIKE vbak-kunnr,
              vkbur   LIKE vbak-vkbur,           "Sales office
              vkorg   LIKE vbak-vkorg,           "Sales organization
              vkgrp   LIKE vbak-vkgrp,           "Sales group
          END OF it_vbap.
    DATA: BEGIN OF it_vbap_stock OCCURS 0,
              vbeln  LIKE vbap-vbeln,
              posnr  LIKE vbap-posnr,
              werks  LIKE vbap-werks,
              matnr  LIKE vbap-matnr,
              netwr  LIKE vbap-netwr,
              kwmeng TYPE p DECIMALS 2,
              bukrs_vf LIKE vbak-bukrs_vf,
              knumv   LIKE vbak-knumv,
              kunnr   LIKE vbak-kunnr,
              vkbur   LIKE vbak-vkbur,           "Sales office
              vkorg   LIKE vbak-vkorg,           "Sales organization
              vkgrp   LIKE vbak-vkgrp,           "Sales group
          END OF it_vbap_stock.
    DATA: BEGIN OF it_out_stock OCCURS 0,
              vbeln LIKE vbap-vbeln,
              posnr LIKE vbap-posnr,
              werks LIKE vbap-werks,
              matnr LIKE vbap-matnr,
              netwr LIKE vbap-netwr,
              knumv LIKE vbak-knumv,
              bukrs_vf LIKE vbak-bukrs_vf,
              kunnr   LIKE vbak-kunnr,
              vkbur   LIKE vbak-vkbur,           "Sales office
              vkorg   LIKE vbak-vkorg,           "Sales organization
              vkgrp   LIKE vbak-vkgrp,           "Sales group
              fkimg   TYPE p DECIMALS 2,         "Billed Quantity
              kwmeng LIKE vbap-kwmeng,
              counter TYPE i,
          END OF it_out_stock.
    DATA: BEGIN OF it_mara_totals_stock OCCURS 0,
            matnr LIKE mara-matnr,
            matkl LIKE mara-matkl,
            spart LIKE mara-spart,
          END OF it_mara_totals_stock.
    DATA: BEGIN OF it_tspat_totals_stock OCCURS 0,
            spart LIKE tspat-spart,
            vtext LIKE tspat-vtext,
          END OF it_tspat_totals_stock.
    DATA: BEGIN OF it_t023t_totals_stock OCCURS 0,
            matkl  LIKE t023t-matkl,
            wgbez  LIKE t023t-wgbez,
          END OF it_t023t_totals_stock.
    DATA: BEGIN OF it_konv_totals_stock OCCURS 0,
            knumv LIKE konv-knumv,
            kposn LIKE konv-kposn,
            kschl LIKE konv-kschl,
            kawrt LIKE konv-kawrt,
            kwert LIKE konv-kwert,
            kbetr LIKE konv-kbetr,
          END OF it_konv_totals_stock.
    DATA: BEGIN OF it_total_stock_final OCCURS 0,
            cnt1   TYPE i,
            cnt2   TYPE i,                  "DPM Category
            werks  LIKE vbap-werks,         "Plant
            spart  LIKE mara-spart,         "Division Description
            matkl  LIKE mara-matkl,         "Material Type
            vbeln  LIKE vbrk-vbeln,         "Billing Doc
            aubel  LIKE vbrp-aubel,         "Sales document
            aupos  LIKE vbrp-aupos,         "Sales document item
            vkbur  LIKE vbak-vkbur,         "Sales office
            vkorg  LIKE vbak-vkorg,         "Sales organization
            vkgrp  LIKE vbak-vkgrp,         "Sales group
            kunnr  LIKE vbak-kunnr,         "Customer
            matnr  LIKE vbrp-matnr,         "Material
            vtext  LIKE tspat-vtext,        "Material Group Desc
            kbetr1 LIKE konv-kbetr,
            kbetr2 LIKE konv-kbetr,
            kawrt  LIKE konv-kawrt,         "Condition Rate
            kwert1 LIKE konv-kwert,         "Volume Discount
            kwert2 LIKE konv-kwert,         "Promo Discount
            fkimg  TYPE p DECIMALS 2,       "Billed Quantity
            kwmeng LIKE vbap-kwmeng,
            counter TYPE i,
         END OF it_total_stock_final.
    Start of Internal tables for Held
    DATA: BEGIN OF it_total_held1 OCCURS 0,
            erdat     LIKE vbak-erdat,
            bukrs_vf  LIKE vbak-bukrs_vf,
            knumv     LIKE vbak-knumv,
            kunnr     LIKE vbak-kunnr,
            werks     LIKE vbap-werks,           "Plant
            vkbur     LIKE vbak-vkbur,           "Sales office
            vkorg     LIKE vbak-vkorg,           "Sales organization
            vkgrp     LIKE vbak-vkgrp,           "Sales group
            vbeln     LIKE vbap-vbeln,
            posnr     LIKE vbap-posnr,
            matnr     LIKE vbap-matnr,
            kwmeng    LIKE vbap-kwmeng,         "Order Quantity
            cmgst     LIKE vbuk-cmgst,
          END OF it_total_held1.
    DATA: BEGIN OF it_total_held2 OCCURS 0,
            zcusno    LIKE zcust-zcusno,
            zregion   LIKE zcust-zregion,
          END OF it_total_held2.
    DATA: BEGIN OF it_mara_totals_held OCCURS 0,
            matnr LIKE mara-matnr,
            matkl LIKE mara-matkl,
            spart LIKE mara-spart,
          END OF it_mara_totals_held.
    DATA: BEGIN OF it_tspat_totals_held OCCURS 0,
            spart LIKE tspat-spart,
            vtext LIKE tspat-vtext,
          END OF it_tspat_totals_held.
    DATA: BEGIN OF it_t023t_totals_held OCCURS 0,
            matkl  LIKE t023t-matkl,
            wgbez  LIKE t023t-wgbez,
          END OF it_t023t_totals_held.
    DATA: BEGIN OF it_konv_totals_held OCCURS 0,
            knumv LIKE konv-knumv,
            kposn LIKE konv-kposn,
            kschl LIKE konv-kschl,
            kawrt LIKE konv-kawrt,
            kwert LIKE konv-kwert,
          END OF it_konv_totals_held.
    DATA: BEGIN OF it_total_held_final OCCURS 0,
            cnt1   TYPE i,
            cnt2   TYPE i,                  "DPM Category
            werks  LIKE vbap-werks,         "Plant
            spart  LIKE mara-spart,         "Division Description
            matkl  LIKE mara-matkl,         "Material Type
            vbeln  LIKE vbrk-vbeln,         "Billing Doc
            aubel  LIKE vbrp-aubel,         "Sales document
            aupos  LIKE vbrp-aupos,         "Sales document item
            erdat  LIKE vbak-erdat,
            vkbur  LIKE vbak-vkbur,         "Sales office
            vkorg  LIKE vbak-vkorg,         "Sales organization
            vkgrp  LIKE vbak-vkgrp,         "Sales group
            kunnr  LIKE vbak-kunnr,         "Customer
            matnr  LIKE vbrp-matnr,         "Material
            vtext  LIKE tspat-vtext,        "Material Group Desc
            kwmeng LIKE vbap-kwmeng,        "Order Quantity
            kawrt  LIKE konv-kawrt,         "Condition Rate
            kwert1 LIKE konv-kwert,         "Volume Discount
            kwert2 LIKE konv-kwert,         "Promo Discount
         END OF it_total_held_final.
    End of Internal tables for Held
    DATA: l_quantity LIKE vbap-kwmeng.
    DATA: g_div(20),      "Division
          g_mat(20),      "Material Group
          g_maktx(40),
          g_name1(40),
          v_net_value TYPE p DECIMALS 2.
            CONSTANTS DECLARATION
    Constants are named data objects that you create statically using
    a declarative statement. They allow you to store data under a
    particular name within the memory area of a program.
    The value of a constant cannot be changed during the execution of
    the program.
    CONSTANTS: header01(10)    TYPE c VALUE 'Invoice #',
               header02(06)    TYPE c VALUE 'Item',
               header03(10)    TYPE c VALUE 'Sales Doc.',
               header04(03)    TYPE c VALUE 'Div',
               header05(20)    TYPE c VALUE 'Division Desc',
               header06(10)    TYPE c VALUE 'Customer #',
               header07(35)    TYPE c VALUE 'Customer Name',
               header08(18)    TYPE c VALUE 'Material No.',
               header09(40)    TYPE c VALUE 'Material Text',
               header10(09)    TYPE c VALUE 'MType',
               header11(20)    TYPE c VALUE 'Material Grp Desc',
               header12(20)    TYPE c VALUE 'Condition Rate',
               header13(20)    TYPE c VALUE 'Vol Discount',
               header14(20)    TYPE c VALUE 'Promo Discount',
               header15(12)    TYPE c VALUE 'Date Created',
               header16(12)    TYPE c VALUE 'Invoice Date',
               header17(20)    TYPE c VALUE 'Net Value',
               header18(12)    TYPE c VALUE 'Sales office',
               header19(10)    TYPE c VALUE 'Sales Org',
               header20(10)    TYPE c VALUE 'Sales Grp',
               header21(20)    TYPE c VALUE 'Quantity',
               header22(04)    TYPE c VALUE 'Plnt'.
    End of Internal tables for Out of Stock
    Start of selection screen criteria
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_zreg  FOR zcust-zregion,               "Region
                    s_matkl FOR mara-matkl,                  "Material Group
                    s_spart FOR mara-spart,                  "Division
                    s_vkorg FOR vbak-vkorg,                  "Sales Org
                    s_vkbur FOR vbak-vkbur,                  "Sales Office
                    s_class FOR zcust-zaclass.               "Account Class
    SELECT-OPTIONS: s_curr  FOR vbrk-fkdat OBLIGATORY.       "Date
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS p0 RADIOBUTTON GROUP radi.
    PARAMETERS p1 RADIOBUTTON GROUP radi.
    SELECTION-SCREEN END OF BLOCK b2.
    Start of Selection
    START-OF-SELECTION.
      IF p0 = 'X'.
    ****Get the Out of Stock
        PERFORM out_stock.
        PERFORM write_report.
      ELSEIF p1 = 'X'.
        PERFORM held_order.
        PERFORM write_report1.
      ENDIF.
    *&      Form  out_stock
          text
    -->  p1        text
    <--  p2        text
    FORM out_stock.
      DATA: l_cnt1 TYPE i,
            l_cnt2 TYPE i,
            l_spart LIKE mara-spart,
            l_matkl LIKE mara-matkl,
            l_text  LIKE tspat-vtext,
            l_amount TYPE p DECIMALS 2,
            l_aupos LIKE vbrp-aupos,
            l_aubel LIKE vbrp-aubel.
      SELECT vbrk~fkdat
             vbrk~bukrs
             vbrk~knumv
             vbrp~vbeln
             vbrp~posnr
             vbrp~aubel
             vbrp~aupos
             vbrp~matnr
             vbrp~fkimg
           vbap~werks
             vbak~auart
             vbak~kunnr
             vbak~vkbur           "Sales office
             vbak~vkorg           "Sales organization
             vbak~vkgrp           "Sales group
             zcust~zcusno
             zcust~zregion
             INTO TABLE it_total_out_stock1
             FROM vbrk
             INNER JOIN vbrp
             ON vbrkvbeln = vbrpvbeln
             INNER JOIN vbak
             ON vbrpaubel = vbakvbeln
             INNER JOIN zcust
             ON vbakkunnr = zcustzcusno
             WHERE vbrk~fkdat IN s_curr
               AND vbrp~matkl IN s_matkl
               AND vbrp~spart IN s_spart
               AND vbak~auart IN ('ZDOA', 'ZDTO', 'ZQOA', 'ZDTA', 'ZQTO')
               AND zcust~zregion IN s_zreg
               AND zcust~zaclass IN s_class
               AND vbak~vkorg IN s_vkorg
               AND vbak~vkbur IN s_vkbur
               AND vbak~bukrs_vf IN ('5116', '5106')
               AND vbak~vkbur <> '5100'.
      IF sy-subrc = 0.
        IF NOT it_total_out_stock1[] IS INITIAL.
    ***Check if the Order is Out of Stock compare to billing invoice
          SELECT vbap~vbeln
                 vbap~posnr
                 vbap~matnr
                 vbap~netwr
                 vbap~kwmeng
                 vbak~bukrs_vf
                 vbak~knumv
                 vbak~kunnr
                 vbap~werks
                 vbak~vkbur           "Sales office
                 vbak~vkorg           "Sales organization
                 vbak~vkgrp           "Sales group
                 INTO TABLE it_vbap
                 FROM vbap
                 INNER JOIN vbak
                 ON vbapvbeln = vbakvbeln
                 FOR ALL entries IN it_total_out_stock1
                 WHERE vbap~vbeln = it_total_out_stock1-aubel
                   AND vbap~posnr <> it_total_out_stock1-aupos
                   AND vbak~auart IN ('ZDOA', 'ZDTO', 'ZQOA',
                                  'ZDTA', 'ZQTO')
                   AND vbak~vkorg IN s_vkorg
                   AND vbak~vkbur IN s_vkbur
                   AND vbap~matkl IN s_matkl
                   AND vbap~spart IN s_spart.
    ***Check if the Order is Out of Stock by Quantity
          SELECT vbap~vbeln
                 vbap~posnr
                 vbap~matnr
                 vbap~netwr
                 vbap~kwmeng
                 vbak~bukrs_vf
                 vbak~knumv
                 vbak~kunnr
                 vbap~werks
                 vbak~vkbur           "Sales office
                 vbak~vkorg           "Sales organization
                 vbak~vkgrp           "Sales group
                 INTO TABLE it_vbap_stock
                 FROM vbap
                 INNER JOIN vbak
                 ON vbapvbeln = vbakvbeln
                  FOR ALL entries IN it_total_out_stock1
                   WHERE vbap~posnr = it_total_out_stock1-aupos
                     AND vbap~vbeln = it_total_out_stock1-aubel
                     AND vbap~kwmeng NE it_total_out_stock1-fkimg
                     AND vbak~auart IN ('ZDOA', 'ZDTO', 'ZQOA',
                                        'ZDTA', 'ZQTO')
                     AND vbak~vkorg IN s_vkorg
                     AND vbak~vkbur IN s_vkbur
                     AND vbap~matkl IN s_matkl
                     AND vbap~spart IN s_spart.
        ENDIF.
        IF NOT it_vbap[] IS INITIAL.
          SORT it_vbap BY vbeln posnr.
          SORT it_total_out_stock1 BY aubel aupos.
          LOOP AT it_vbap.
            READ TABLE it_total_out_stock1
              WITH KEY aubel = it_vbap-vbeln
                       aupos = it_vbap-posnr.
            IF sy-subrc NE 0.
              it_out_stock-vbeln    = it_vbap-vbeln.
              it_out_stock-posnr    = it_vbap-posnr.
              it_out_stock-matnr    = it_vbap-matnr.
              it_out_stock-netwr    = it_vbap-netwr.
              it_out_stock-knumv    = it_vbap-knumv.
              it_out_stock-bukrs_vf = it_vbap-bukrs_vf.
              it_out_stock-kunnr    = it_vbap-kunnr.
              it_out_stock-werks    = it_vbap-werks.
              it_out_stock-vkbur    = it_vbap-vkbur.  "Sales office
              it_out_stock-vkorg    = it_vbap-vkorg.  "Sales organization
              it_out_stock-vkgrp    = it_vbap-vkgrp.  "Sales group
              it_out_stock-kwmeng   = it_vbap-kwmeng.
              APPEND it_out_stock.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF NOT it_vbap_stock[] IS INITIAL.
          SORT it_vbap_stock BY vbeln posnr.
          SORT it_total_out_stock1 BY aubel aupos.
          LOOP AT it_vbap_stock.
            LOOP AT it_total_out_stock1 WHERE aubel = it_vbap_stock-vbeln
                                         AND  aupos = it_vbap_stock-posnr
                                         AND  fkimg NE it_vbap_stock-kwmeng.
              it_out_stock-vbeln    = it_vbap_stock-vbeln.
              it_out_stock-posnr    = it_vbap_stock-posnr.
              it_out_stock-matnr    = it_vbap_stock-matnr.
              it_out_stock-netwr    = it_vbap_stock-netwr.
              it_out_stock-knumv    = it_vbap_stock-knumv.
              it_out_stock-bukrs_vf = it_vbap_stock-bukrs_vf.
              it_out_stock-kunnr    = it_vbap_stock-kunnr.
              it_out_stock-werks    = it_vbap_stock-werks.
              it_out_stock-vkbur    = it_vbap_stock-vkbur.  "Sales office
              it_out_stock-vkorg    = it_vbap_stock-vkorg.  "Sales org
              it_out_stock-vkgrp    = it_vbap_stock-vkgrp.  "Sales group
    ****Begin Insert by Ron
              it_out_stock-kwmeng   = it_vbap_stock-kwmeng.
              it_out_stock-fkimg    = it_total_out_stock1-fkimg.
              it_out_stock-counter  = 1.
    ****End Insert
              APPEND it_out_stock.
            ENDLOOP.
          ENDLOOP.
        ENDIF.
      ENDIF.      "it_total_out_stock1
      IF NOT it_out_stock[] IS INITIAL.
    ***get the value of material and material group
        SELECT matnr
               matkl
               spart
               INTO TABLE it_mara_totals_stock
               FROM mara
               FOR ALL ENTRIES IN it_out_stock
               WHERE matnr = it_out_stock-matnr.
      ENDIF.
    ***Get the Value of Division Description
      IF NOT it_mara_totals_stock[] IS INITIAL.
        SELECT spart
               vtext
               INTO TABLE it_tspat_totals_stock
               FROM tspat
               FOR ALL ENTRIES IN it_mara_totals_stock
               WHERE spart = it_mara_totals_stock-spart AND
                     spras = sy-langu.
      ENDIF.
    ***Get the Material Group Description
      IF NOT it_mara_totals_stock[] IS INITIAL.
        SELECT matkl
               wgbez
               INTO TABLE it_t023t_totals_stock
               FROM t023t
               FOR ALL ENTRIES IN it_mara_totals_stock
                WHERE matkl = it_mara_totals_stock-matkl AND
                      spras = sy-langu.
      ENDIF.
    ***Get the Value of Condition Type
      IF NOT it_out_stock[] IS INITIAL.
        SELECT knumv
               kposn
               kschl
               kawrt
               kwert
               kbetr
               INTO TABLE it_konv_totals_stock
               FROM konv
               FOR ALL ENTRIES IN it_out_stock
                WHERE knumv = it_out_stock-knumv
                  AND kposn = it_out_stock-posnr
                  AND kschl IN ('ZQPR', 'ZQD3', 'ZQP3',
                                'ZDPR', 'ZDD3', 'ZDP3').
      ENDIF.
      SORT it_out_stock          BY vbeln posnr.
      SORT it_mara_totals_stock  BY matnr.
      SORT it_tspat_totals_stock BY spart.
      SORT it_t023t_totals_stock BY matkl.
      SORT it_konv_totals_stock  BY knumv kposn.
      LOOP AT it_out_stock.
        CLEAR: it_total_stock_final-kawrt,  it_total_stock_final-kwert1,
               it_total_stock_final-kwert2, it_total_stock_final-vtext,
               it_total_stock_final-matkl,  it_total_stock_final-spart,
               it_total_stock_final-aubel,  it_total_stock_final-aupos,
               it_total_stock_final-cnt1,   it_total_stock_final-cnt2.
    ***Begin Insert by RONCR
        CLEAR: it_total_stock_final-kwmeng, it_total_stock_final-fkimg,
               it_total_stock_final-counter.
    ***End Insert by RONCR
        CLEAR: it_mara_totals_stock, it_tspat_totals_stock,
               it_t023t_totals_stock, it_konv_totals_stock,
               l_cnt1, l_cnt2.
    **Counter for Total Orders Column
        l_cnt1 = 4.
        READ TABLE it_mara_totals_stock
            WITH KEY matnr = it_out_stock-matnr.
        IF sy-subrc EQ 0.
          it_total_stock_final-matnr = it_mara_totals_stock-matnr.
          it_total_stock_final-matkl = it_mara_totals_stock-matkl.
          it_total_stock_final-spart = it_mara_totals_stock-spart.
    ***DPM
          IF it_total_stock_final-matkl EQ 'DPM' OR
             it_total_stock_final-matkl EQ 'SSN'.
            READ TABLE it_tspat_totals_stock
             WITH KEY spart = it_mara_totals_stock-spart.
            IF sy-subrc EQ 0.
              it_total_stock_final-vtext  = it_tspat_totals_stock-vtext.
            ENDIF.
    ***Non Dole
          ELSE.
            READ TABLE it_t023t_totals_stock
             WITH KEY matkl = it_mara_totals_stock-matkl.
            IF sy-subrc EQ 0.
              it_total_stock_final-vtext  = it_t023t_totals_stock-wgbez.
            ENDIF.
          ENDIF.
        ENDIF.
        IF it_total_stock_final-matkl = 'DPM' OR
           it_total_stock_final-matkl = 'SSN'.
          l_cnt2 = 1.
        ELSE.
          l_cnt2 = 2.
        ENDIF.
    ***Condition Value for Comapny Code 5116
        IF it_out_stock-bukrs_vf EQ '5116'.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZQPR'.
          IF sy-subrc EQ 0.
            it_total_stock_final-kawrt = it_konv_totals_stock-kawrt.
          ENDIF.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZQD3'.
          IF sy-subrc EQ 0.
            it_konv_totals_stock-kwert = it_konv_totals_stock-kwert * -1.
            it_total_stock_final-kwert1 = it_konv_totals_stock-kwert.
            it_total_stock_final-kbetr1 = it_konv_totals_stock-kbetr.
            it_total_stock_final-kbetr1 = it_total_stock_final-kbetr1 * -1.
          ENDIF.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZQP3'.
          IF sy-subrc EQ 0.
            it_konv_totals_stock-kwert = it_konv_totals_stock-kwert * -1.
            it_total_stock_final-kwert2 = it_konv_totals_stock-kwert.
            it_total_stock_final-kbetr2 = it_konv_totals_stock-kbetr.
            it_total_stock_final-kbetr2 = it_total_stock_final-kbetr2 * -1.
          ENDIF.
        ENDIF.
    ***Condition Value for Company Code 5106
        IF it_out_stock-bukrs_vf EQ '5106'.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZDPR'.      "Base price
          IF sy-subrc EQ 0.
            it_total_stock_final-kawrt = it_konv_totals_stock-kawrt.
          ENDIF.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZDD3'.      "Volume Discount
          IF sy-subrc EQ 0.
            it_konv_totals_stock-kwert = it_konv_totals_stock-kwert * -1.
            it_total_stock_final-kwert1 = it_konv_totals_stock-kwert.
            it_total_stock_final-kbetr1 = it_konv_totals_stock-kbetr.
            it_total_stock_final-kbetr2 = it_total_stock_final-kbetr2 * -1.
          ENDIF.
          READ TABLE it_konv_totals_stock
            WITH KEY knumv = it_out_stock-knumv
                     kposn = it_out_stock-posnr
                     kschl = 'ZDP3'.      "Promo Discount
          IF sy-subrc EQ 0.
            it_konv_totals_stock-kwert = it_konv_totals_stock-kwert * -1.
            it_total_stock_final-kwert2 = it_konv_totals_stock-kwert.
            it_total_stock_final-kbetr2 = it_konv_totals_stock-kbetr.
            it_total_stock_final-kbetr2 = it_total_stock_final-kbetr2 * -1.
          ENDIF.
        ENDIF.
        it_total_stock_final-cnt1  = l_cnt1.
        it_total_stock_final-cnt2  = l_cnt2.
        it_total_stock_final-aubel = it_out_stock-vbeln.
        it_total_stock_final-aupos = it_out_stock-posnr.
        it_total_stock_final-kunnr = it_out_stock-kunnr.
        it_total_stock_final-werks = it_out_stock-werks.
        it_total_stock_final-vkbur = it_out_stock-vkbur.  "Sales office
        it_total_stock_final-vkorg = it_out_stock-vkorg.  "Sales org
        it_total_stock_final-vkgrp = it_out_stock-vkgrp.  "Sales group
    ***Begin Insert by RONCR
        it_total_stock_final-kwmeng = it_out_stock-kwmeng.
        it_total_stock_final-fkimg = it_out_stock-fkimg.
        it_total_stock_final-counter = it_out_stock-counter.
    **End of Insert by RONCR
        APPEND it_total_stock_final.
      ENDLOOP.
    ENDFORM.                    " out_stock
    *&      Form  write_report
          text
    -->  p1        text
    <--  p2        text
    FORM write_report.
      ULINE (360).
      FORMAT COLOR 1.
      WRITE: / sy-vline, header01,
            12 sy-vline, header02,
            19 sy-vline, header03,
            30 sy-vline, header04,
            35 sy-vline, header05,
            55 sy-vline, header18,
            75 sy-vline, header19,
            87 sy-vline, header20,
           100 sy-vline, header06,
           112 sy-vline, header07,
           150 sy-vline, header08,
           170 sy-vline, header09,
           215 sy-vline, header10,
           225 sy-vline, header11,
           247 sy-vline, header21,
           271 sy-vline, header12,
           293 sy-vline, header13,
           315 sy-vline, header14,
           337 sy-vline, header17,
           360 sy-vline, header22,
           363 sy-vline.
      ULINE (360).
      FORMAT COLOR 2.
      SORT it_total_stock_final BY cnt2 cnt1 spart aubel aupos.
      LOOP AT  it_total_stock_final.
        CLEAR: g_div, g_mat, g_maktx, g_name1, v_net_value.
        SELECT SINGLE vtext INTO g_div
           FROM tspat
           WHERE spart = it_total_stock_final-spart
             AND spras = sy-langu.
        SELECT SINGLE wgbez INTO g_mat
           FROM t023t
           WHERE matkl = it_total_stock_final-matkl
             AND spras = sy-langu.
        SELECT SINGLE maktx INTO g_maktx
           FROM makt
             WHERE matnr = it_total_stock_final-matnr
               AND spras = sy-langu.
        SELECT SINGLE name1  INTO g_name1
           FROM kna1
              WHERE kunnr = it_total_stock_final-kunnr.
        IF it_total_stock_final-counter = 1.
          CLEAR: l_quantity.
          l_quantity = it_total_stock_final-kwmeng -
                       it_total_stock_final-fkimg.
          it_total_stock_final-kawrt = it_total_stock_final-kawrt /
                      it_total_stock_final-kwmeng.
          it_total_stock_final-kawrt = it_total_stock_final-kawrt *
                       l_quantity.
          it_total_stock_final-kbetr1 = it_total_stock_final-kbetr1 /
                                         1000.
          it_total_stock_final-kbetr2 = it_total_stock_final-kbetr2 /
                                         1000.
          it_total_stock_final-kwert1 = it_total_stock_final-kawrt *
                                        it_total_stock_final-kbetr1.
          it_total_stock_final-kwert2 = it_total_stock_final-kawrt *
                                        it_total_stock_final-kbetr2.
              clear:  it_total_stock_final-kawrt,
                      it_total_stock_final-kbetr1,
                      it_total_stock_final-kbetr2,
                      it_total_stock_final-kwert1,
                      it_total_stock_final-kwert2.
        ENDIF.
        v_net_value = it_total_stock_final-kawrt -
                      it_total_stock_final-kwert1 -
                      it_total_stock_final-kwert2.
        WRITE: / sy-vline, it_total_stock_final-vbeln,
              12 sy-vline, it_total_stock_final-aupos,
              19 sy-vline, it_total_stock_final-aubel,
              30 sy-vline, it_total_stock_final-spart,
              35 sy-vline, g_div,
              55 sy-vline, it_total_stock_final-vkbur,
              75 sy-vline, it_total_stock_final-vkorg,
              87 sy-vline, it_total_stock_final-vkgrp,
             100 sy-vline, it_total_stock_final-kunnr,
             112 sy-vline, g_name1,
             150 sy-vline, it_total_stock_final-matnr,
             170 sy-vline, g_maktx,
             215 sy-vline, it_total_stock_final-matkl,
             225 sy-vline, it_total_stock_final-vtext.
        IF it_total_stock_final-counter = 1.
          WRITE:  247 sy-vline, l_quantity,
                  271 sy-vline, it_total_stock_final-kawrt,
                  293 sy-vline, it_total_stock_final-kwert1,
                  315 sy-vline, it_total_stock_final-kwert2,
                  337 sy-vline, v_net_value,
                  360 sy-vline, it_total_stock_final-werks,
                  363 sy-vline.
        ELSE.
          WRITE:  247 sy-vline, it_total_stock_final-kwmeng,
                  271 sy-vline, it_total_stock_final-kawrt,
                  293 sy-vline, it_total_stock_final-kwert1,
                  315 sy-vline, it_total_stock_final-kwert2,
                  337 sy-vline, v_net_value,
                  360 sy-vline, it_total_stock_final-werks,
                  363 sy-vline.
        ENDIF.
      ENDLOOP.
      ULINE (360).
    ENDFORM.                    " write_report
    *&      Form  held_order
          text
    -->  p1        text
    <--  p2        text
    FORM held_order.
      DATA: l_cnt1 TYPE i,
            l_cnt2 TYPE i,
            l_spart LIKE mara-spart,
            l_matkl LIKE mara-matkl,
            l_text  LIKE tspat-vtext,
            l_amount TYPE p DECIMALS 2,
            l_aupos LIKE vbrp-aupos,
            l_aubel LIKE vbrp-aubel.
      SELECT vbak~erdat
             vbak~bukrs_vf
             vbak~knumv
             vbak~kunnr
             vbap~werks
             vbak~vkbur                          "Sales office
             vbak~vkorg                          "Sales organization
             vbak~vkgrp                          "Sales group
             vbap~vbeln
             vbap~posnr
             vbap~matnr
             vbap~kwmeng                         "Order Quantity
             vbuk~cmgst
             INTO TABLE it_total_held1
             FROM vbak
             INNER JOIN vbap
             ON vbakvbeln = vbapvbeln
             INNER JOIN vbuk
             ON vbapvbeln = vbukvbeln
             WHERE vbak~erdat IN s_curr
               AND vbak~vkorg IN s_vkorg
               AND vbak~vkbur IN s_vkbur
               AND vbap~matkl IN s_matkl
               AND vbak~bukrs_vf IN ('5116', '5106')
               AND vbak~vkbur NE '5100'
               AND vbak~auart IN ('ZDOA', 'ZDTO', 'ZQOA', 'ZDTA', 'ZQTO')
               AND vbak~kkber = '5116'
               AND vbuk~cmgst = 'B'
               AND vbap~spart IN s_spart.
      IF sy-subrc = 0.
        SELECT zcusno
               zregion
               INTO TABLE it_total_held2
               FROM zcust
               FOR ALL ENTRIES IN it_total_held1
                WHERE zcusno = it_total_held1-kunnr
                  AND zcust~zregion IN s_zreg
                  AND zcust~zaclass IN s_class.
        IF sy-subrc EQ 0.
    ***get the value of material and material group
          SELECT matnr
                 matkl
                 spart
                 INTO TABLE it_mara_totals_held
                 FROM mara
                 FOR ALL ENTRIES IN it_total_held1
                 WHERE matnr = it_total_held1-matnr.
    ***Get the Value of Division Description
          IF NOT it_mara_totals_held[] IS INITIAL.
            SELECT spart
                   vtext
                   INTO TABLE it_tspat_totals_held
                   FROM tspat
                   FOR ALL ENTRIES IN it_mara_totals_held
                   WHERE spart = it_mara_totals_held-spart AND
                         spras = sy-langu.
          ENDIF.
    ***Get the Material Group Description
          IF NOT it_mara_totals_held[] IS INITIAL.
            SELECT matkl
                   wgbez
                   INTO TABLE it_t023t_totals_held
                   FROM t023t
                   FOR ALL ENTRIES IN it_mara_totals_held
                    WHERE matkl = it_mara_totals_held-matkl AND
                          spras = sy-langu.
          ENDIF.
    ***Get the Value of Condition Type
          IF NOT it_total_held1[] IS INITIAL.
            SELECT knumv
                   kposn
                   kschl
                   kawrt
                   kwert
                   INTO TABLE it_konv_totals_held
                   FROM konv
                   FOR ALL ENTRIES IN it_total_held1
                    WHERE knumv = it_total_held1-knumv
                      AND kposn = it_total_held1-posnr
                      AND kschl IN ('ZQPR', 'ZQD3', 'ZQP3',
                                    'ZDPR', 'ZDD3', 'ZDP3').
          ENDIF.
        ENDIF.
      ENDIF.
      SORT it_total_held1       BY vbeln posnr.
      SORT it_total_held2       BY zcusno zregion.
      SORT it_mara_totals_held  BY matnr.
      SORT it_tspat_totals_held BY spart.
      SORT it_t023t_totals_held BY matkl.
      SORT it_konv_totals_held  BY knumv kposn.
      LOOP AT it_total_held1.
        CLEAR: it_total_held_final-kawrt,  it_total_held_final-kwert1,
               it_total_held_final-kwert2, it_total_held_final-vtext,
               it_total_held_final-matkl,  it_total_held_final-spart,
               it_total_held_final-aubel,  it_total_held_final-aupos,
               it_total_held_final-cnt1,   it_total_held_final-cnt2.
        CLEAR: it_mara_totals_held, it_tspat_totals_held,
               it_t023t_totals_held, it_konv_totals_held,
               l_cnt1, l_cnt2.
        READ TABLE it_total_held2
            WITH KEY zcusno = it_total_held1-kunnr.
        IF sy-subrc = 0.
    **Counter for Total Orders Column
          l_cnt1 = 3.
          READ TABLE it_mara_totals_held
              WITH KEY matnr = it_total_held1-matnr.
          IF sy-subrc EQ 0.
            it_total_held_final-matnr = it_mara_totals_held-matnr.
            it_total_held_final-matkl = it_mara_totals_held-matkl.
            it_total_held_final-spart = it_mara_totals_held-spart.
    ***Dole
            IF it_total_held_final-matkl EQ 'DPM' OR
               it_total_held_final-matkl EQ 'SSN'.
              READ TABLE it_tspat_totals_held
               WITH KEY spart = it_mara_totals_held-spart.
              IF sy-subrc EQ 0.
                it_total_held_final-vtext  = it_tspat_totals_held-vtext.
              ENDIF.
    ***Non Dole
            ELSE.
              READ TABLE it_t023t_totals_held
               WITH KEY matkl = it_mara_totals_held-matkl.
              IF sy-subrc EQ 0.
                it_total_held_final-vtext  = it_t023t_totals_held-wgbez.
              ENDIF.
            ENDIF.
          ENDIF.
          IF it_total_held_final-matkl = 'DPM' OR
             it_total_held_final-matkl = 'SSN'.
            l_cnt2 = 1.
          ELSE.
            l_cnt2 = 2.
          ENDIF.
    ***Condition Value for Comapny Code 5116
          IF it_total_held1-bukrs_vf EQ '5116'.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZQPR'.
            IF sy-subrc EQ 0.
              it_total_held_final-kawrt = it_konv_totals_held-kawrt.
            ENDIF.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZQD3'.
            IF sy-subrc EQ 0.
              it_konv_totals_held-kwert = it_konv_totals_held-kwert * -1.
              it_total_held_final-kwert1 = it_konv_totals_held-kwert.
            ENDIF.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZQP3'.
            IF sy-subrc EQ 0.
              it_konv_totals_held-kwert = it_konv_totals_held-kwert * -1.
              it_total_held_final-kwert2 = it_konv_totals_held-kwert.
            ENDIF.
          ENDIF.
    ***Condition Value for Comapny Code 5106
          IF it_total_held1-bukrs_vf EQ '5106'.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZDPR'.      "Base price
            IF sy-subrc EQ 0.
              it_total_held_final-kawrt = it_konv_totals_held-kawrt.
            ENDIF.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZDD3'.      "Volume Discount
            IF sy-subrc EQ 0.
              it_konv_totals_held-kwert = it_konv_totals_held-kwert * -1.
              it_total_held_final-kwert1 = it_konv_totals_held-kwert.
            ENDIF.
            READ TABLE it_konv_totals_held
              WITH KEY knumv = it_total_held1-knumv
                       kposn = it_total_held1-posnr
                       kschl = 'ZDP3'.      "Promo Discount
            IF sy-subrc EQ 0.
              it_konv_totals_held-kwert = it_konv_totals_held-kwert * -1.
              it_total_held_final-kwert2 = it_konv_totals_held-kwert.
            ENDIF.
          ENDIF.
          it_total_held_final-cnt1   = l_cnt1.
          it_total_held_final-cnt2   = l_cnt2.
          it_total_held_final-aubel  = it_total_held1-vbeln.
          it_total_held_final-aupos  = it_total_held1-posnr.
          it_total_held_final-kunnr  = it_total_held1-kunnr.
          it_total_held_final-erdat  = it_total_held1-erdat.
          it_total_held_final-werks  = it_total_held1-werks.
          it_total_held_final-vkbur  = it_total_held1-vkbur.  "Sales office
          it_total_held_final-vkorg  = it_total_held1-vkorg.  "Sales Org
          it_total_held_final-vkgrp  = it_total_held1-vkgrp.  "Sales group
          it_total_held_final-kwmeng = it_total_held1-kwmeng. "Order qty
          APPEND it_total_held_final.
        ENDIF.     "it_total_held2
      ENDLOOP.
    ENDFORM.                    " held_order
    *&      Form  write_report1
          text
    -->  p1        text
    <--  p2        text
    FORM write_report1.
      ULINE (360).
      FORMAT COLOR 1.
      WRITE: / sy-vline, header01,
               12 sy-vline, header02,
               19 sy-vline, header03,
               30 sy-vline, header15,
               45 sy-vline, header04,
               50 sy-vline, header05,
               75 sy-vline, header18,
               90 sy-vline, header19,
              103 sy-vline, header20,
              115 sy-vline, header06,
              127 sy-vline, header07,
              167 sy-vline, header08,
              184 sy-vline, header09,
              227 sy-vline, header10,
              237 sy-vline, header11,
              260 sy-vline, header21,
              282 sy-vline, header12,
              306 sy-vline, header13,
              330 sy-vline, header14,
              354 sy-vline, header17,
              376 sy-vline, header22,
              380 sy-vline.
          ULINE (376).
          FORMAT COLOR 2.
          SORT it_total_held_final BY cnt2 cnt1 spart aubel aupos.
          LOOP AT  it_total_held_final.
            CLEAR: g_div, g_mat, g_maktx, g_name1, v_net_value.
            SELECT SINGLE vtext INTO g_div
               FROM tspat
               WHERE spart = it_total_held_final-spart
                 AND spras = s

    Hi,
    790072 wrote:
    Hi Gurus,
    Need your help in writing an sql to search records which has length of 4000 bytes from an varchar2(4000) column and inserting the same records to another table by truncating the record to 3500 bytes .Something like this:
    INSERT INTO new_table (txt_column)
    SELECT  SUBSTRB (txt_column, 1, 3500)
    FROM    old_table;SUBSTR returns a string with a specified number of characters , SUBSTR<b>B</b> has a specified number of bytes .

  • Backorder report, not possible to print Cardname

    Hello,
    in the PLD template for the backorder report it is not possible to inlcude the Cardname, there is no system variable available.
    Does anyone have a workaround for this?
    Thank you in advance.
    Best regards,
    Anton Wieser.

    Hi,
    Were you able to figure out solution for this.
    I tried this out by processing a backorder goods delivery. The system is still taking the delivery PLD. So, I am getting the Cardname (Customer Name).
    Try out using Advanced print layout. Probably that will help in finding out a solution.
    Assign points if useful.
    Thanks,
    Srikanth

  • SAP MM-IM & WM stock in one report

    Hello Everybody,
    We are operating SAP MM & WM in two different server and our client requirement is to see the MM-IM stock & WM stock in one report.Pls let me know how it is possible.
    Thanks,
    AC

    Hi
    Can you explain with more details?
    Both servers are SAP or third part Warehouse?
    If it is SAP you can not implement WM without IM.
    you have standard report available to compare IM&WM and also you can switch between IM&WM stocks
    [http://help.sap.com/saphelp_470/helpdata/en/c6/f83c484afa11d182b90000e829fbfe/content.htm]
    Karthik

  • Adding field to Stock in Warehouse Report

    Hi Experts,
    My customer would like to add the field "Description in Foreign" language to the Stock in Warehouse report.
    When I look at the existing fields on the report, they are not of the Source Type "Database" but Free Text !  Does this mean the report cannot be amended?
    I have tried to add the field regardless, but the table OITM is not available from the Database dropdown list.  I find this odd as it is a Stock in Warehouse report.
    Please help.
    Greig

    hi greig,
    Have u entered item description in foreign language in item master ?
    You can add UDF to standard reports like Stock in warehouse report ?
    Reports are linked with PLD dynamically,U can't link datbase field in PLD template,Report is linked internally with free text.
    Better develop query based report(ie. Query Print Layout designer).
    Jeyakanthan

  • FM to check available stock

    Hi experts,
    You Know some FM that checks the available stock of some material in somer Storage Location ?
    Thanks in advance.
    Alexandre Nogueira

    Have you checked into this BAPI yet?
    report zrich_0003.
    data:  iwmdvsx type table of bapiwmdvs with header line,
           iwmdvex type table of bapiwmdve with header line.
    parameters: p_matnr type mara-matnr,
                p_werks type marc-werks,
                p_meins type mara-meins.
    call function 'BAPI_MATERIAL_AVAILABILITY'
      exporting
        plant            = p_werks
        material         = p_matnr
        unit             = p_meins
    *   CHECK_RULE       =
    *   STGE_LOC         =
    *   BATCH            =
    *   CUSTOMER         =
    *   DOC_NUMBER       =
    *   ITM_NUMBER       =
    *   WBS_ELEM         =
    *   STOCK_IND        =
    * IMPORTING
    *   ENDLEADTME       =
    *   AV_QTY_PLT       =
    *   DIALOGFLAG       =
    *   RETURN           =
      tables
        wmdvsx           = iwmdvsx
        wmdvex           = iwmdvex.
    check sy-subrc = 0.
    Oops, looks like I'm a tad late.    Oh well.
    Regards,
    RIch Heilman

  • Backorder report and order types

    Experts,
    We have a standard backorder report in ECC called as t-code v.15
    I want to know, if this is only for standard order types or it is for every sales order created in ECC.
    Thanks
    Shankar.

    Hi,
    Backorder processing is only available for materials with individual requirements. If any of the orders mentioned by you carry material number (with individual requirement), then it applies to those orders also.
    Regards,

  • Checking Stock (Available Stock)

    Hi,
    I have a requiremnt to develop a report to show Available Stock of the material.
    While displaying the stock it should check the quantity of the open orders and duduct that from the stock.
    i.e Available Stock = stock - quantity of open orders
    As I know we can see all open orders using transaction VA05
    or we can find all open orders in VBUK/VBUP with status = A
    from where we can calculate the quatity of open orders.
    but I have gone through one program in which the developer used table VBBE and field OMENG for quantity of open orders,
    here I have noticed that I have taken some orders where we get using transaction VA05 but those orders not exist in table VBBE so I am bit confused in this, please let me know if any one have clear idea on this...
    Thanks in Advance
    Venkatesh

    Hi
    Try Tcode CO09 to view the ATP quantities. The ATP quantities are the Available To Promise - which are not assigned to any sales orders or customers and are free for sale.
    Thanks,
    Ravi

  • ME2O - Need available stocks at our warehouse

    Hi all,
    In ME2O transaction, system displays the available stock at subcontracting vendor but does not show the availability of components at our warehouse.
    From ME2O, we can select the respective material and by using Stock overview icon, we will be able to know the current stock status.
    We need a report which should display the availability of the stock with respect to subcontracting order. So that they will issue goods accordingly.
    Please let me know whether any standard report available.
    by
    Prabhu

    There is no standard SAP Report apart from ME2O.You have to go for customised report.

  • Stock value and report

    Hi,
    how determing <b>stock value with reports</b>?
    Best regards

    Hi,
    There are quite a few standard reports which will give you the stock value report, you can try
    MC.1 to MC.9 (gives you various stock value analysis reports), MMBE, MB5W etc.
    Alternatively you can extract this data from MARD table.
    If you are looking for a specific report, please let us know the same & we can be more precise in the output.
    Hope i was able help you on this issue.
    Regards,
    Vivek

  • Stock Transfer Order Report

    Hi,
         How to develop a Stock Transfer Order report. I also want to track the cost of transfer from one plant to another. Plz help.

    Hi,
    First fetch the data from LTAK header table.   Based on this table you can
    get the line items from LTAP table.  You can have the list of all open TO's in this table.  Based on the Plant (Werks) you can fetch the data from EKPO for STO report.
    Reward if useful.....

Maybe you are looking for