Sales Order Header wise status.

Hy expert,
i going to make Sales order Status Reports. It run successfully fetch data form header wise, but it display all so, that is already closed or completed.
i wnt to which Sales order it is pending or partially deliverd.
Please help me regarding this.
Report in ALV.
Please read this code for fetch Data. if u like change pl do.
Thnks
Bhavesh Panchal
baroda
FORM data_retrieval.
SELECT VBELN  NETWR KUNNR FROM VBAK INTO (ITAB-VBELN,ITAB-NETWR,ITAB-KUNNR) WHERE VBELN IN VBELN .
SELECT NAME1 FROM KNA1 INTO (ITAB-NAME1) WHERE KUNNR = ITAB-KUNNR .
SELECT BSTKD BSTDK FROM VBKD INTO (ITAB-BSTKD,ITAB-BSTDK) WHERE VBELN = ITAB-VBELN.
SELECT VSNMR_V FROM VBAK INTO (ITAB-VSNMR_V) WHERE VBELN = ITAB-VBELN.
*SELECT EDATU FROM VBEP INTO (ITAB-EDATU) WHERE VBELN = ITAB-VBELN.
SELECT LFSTK FROM VBUK INTO (ITAB-LFSTK) WHERE VBELN = ITAB-VBELN and lfstk not like 'C'.
APPEND ITAB.
ENDSELECT.

Hi,
Try this out.
SELECT vbeln auart spart audat netwr
      FROM vbak INTO TABLE it_vbak
       WHERE spart IN so_spart
       AND audat IN so_fkdat
       AND auart IN rg_auart
       AND vbeln IN so_vbeln.
SELECT vbeln posnr spart werks matnr arktx kwmeng kbmeng abgru pstyv netwr matkl
   INTO CORRESPONDING FIELDS OF TABLE it_vbap
    FROM vbap
       FOR ALL ENTRIES IN it_vbak
         WHERE vbeln = it_vbak-vbeln
          AND posnr LIKE '%'
          AND werks IN so_werks
          AND matkl IN so_matkl
          AND matnr IN so_matnr .
IF it_vbap IS NOT INITIAL.
"Get all delivery details
SELECT vbelv posnv vbeln posnn vbtyp_n vbtyp_v rfmng matnr          " vbfa_j for All Delivery details
         FROM vbfa INTO TABLE it_vbfa_j
          FOR ALL ENTRIES IN it_vbap
           WHERE  vbelv = it_vbap-vbeln AND
            posnv = it_vbap-posnr AND
            vbeln LIKE '%' AND
            posnn LIKE '%' AND
            vbtyp_n = 'J'.   
ENDIF.
LOOP AT it_vbap INTO wa_vbap WHERE abgru EQ space.  
"Get cumulative confirmed qty
wa_final-kbmeng = wa_vbap-kbmeng.
READ TABLE  it_vbfa_J INTO wa_vbfa_j WITH KEY vbelv = wa_vbpa-vbeln
                                            posnv = wa_vbfa-posnr.
                                          "      BINARY SEARCH.
    IF sy-subrc = 0.
       wa_final-delivery_qty_total = wa_vbfa-rfmng.
    ENDIF.
IF wa_final-delivery_qty_total NE wa_final-kbmeng .
       wa_final-pending_order = wa_final-kbmeng - wa_final-delivery_qty_total.    "(pending order = Order_qty - total delivery qty)
ENDIF.
CLEAR wa_final.
endloop.
Hope this will help.
Thanks,
Archana

Similar Messages

  • What's the name of FM for getting Sales Order Header / Item Status info

    Hello All:
    Do you know what's the name of Function Module for getting Sales Order Header / Item Status Overview ? Any sample code will be very much appreciated.
    Basically, I am trying to create a Webpage where user can enter the Sales Order document number and will return the Sales Order: Status Overview.
    Thanks,
    Dipankar Biswas

    Thanks everybody ! Appreciate for your prompt response. I was also looking for some sample code, and I did find some on. And here is one. I still have to try the code, but here is for all your reference:
    *& Report ZBAPI_SALESORDER_GETSTATUS *
    *& Read and Display the Sales Order Items and Status of the Order *
    REPORT zbapi_salesorder_getstatus NO STANDARD PAGE HEADING LINE-SIZE 200 LINE-COUNT 33(3).
    TABLES: vbap. "Sales Document Item Data.
    DATA: wa_bapireturn TYPE bapireturn,
    wa_bapisdstat TYPE bapisdstat,
    it_bapisdstat LIKE STANDARD TABLE OF wa_bapisdstat.
    TYPES: BEGIN OF ty_mat_name,
    matnr TYPE makt-matnr,
    maktx TYPE makt-maktx,
    END OF ty_mat_name.
    DATA: wa_mat_name TYPE ty_mat_name,
    it_mat_name LIKE TABLE OF wa_mat_name WITH KEY matnr .
    PARAMETERS: p_vbeln LIKE vbap-vbeln DEFAULT 5573.
    START-OF-SELECTION.
    SELECT matnr maktx FROM makt INTO TABLE it_mat_name.
    CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
    EXPORTING
    salesdocument = p_vbeln
    IMPORTING
    return = wa_bapireturn
    TABLES
    statusinfo = it_bapisdstat.
    IF wa_bapireturn IS INITIAL. " Successful Execution.
    WRITE: / 'Document No: ' COLOR 1, 20 'PO Number : ', 40 'Status' , 50 'Delv.Stat',60 'Item No', 80 'Material', 90 'Material Description', 130 'Net Price' COLOR 2.
    ULINE.
    LOOP AT it_bapisdstat INTO wa_bapisdstat.
    WRITE: / wa_bapisdstat-doc_number. " Sales Document Number.
    READ TABLE it_mat_name INTO wa_mat_name WITH KEY matnr = wa_bapisdstat-material.
    WRITE: /20 wa_bapisdstat-purch_no, " Customer Purchase Order Number
    40 wa_bapisdstat-prc_stat_h, " Processing Status
    50 wa_bapisdstat-dlv_stat_h, " Delivery Status
    60 wa_bapisdstat-itm_number, " Item Number
    80 wa_bapisdstat-material, " Material
    90 wa_mat_name-maktx, " Material Description
    130(10) wa_bapisdstat-net_price. " Net Price
    CLEAR wa_bapisdstat.
    ENDLOOP.
    REFRESH it_bapisdstat[].
    ELSE.
    WRITE: wa_bapireturn-message.
    ENDIF.

  • Sales order Header Credit status showing as Approved

    Hi all,
    My User created a Sales order with 200 tones with around 5700 USD but while saving it did not block sales order for credit but the customer was over their credit limit.in FD32 it already exceed 152 % Further orders have blocked with other customer is was blocking
    i check in FD32 it showing Cred.limited used 152%
    and the sales order header status showing as - Approved
    when the sales order status shows as approved
    can any one guide me what could be problem
    Thanks
    Rajesh

    Hi
    CHeck with the order, see who has changed it
    salesorder- goto - environment- click changes and check it for that.
    Check on - how it is released
    who has changed
    take the log and time
    if all the congi
    config
    fine...then check the change log
    or go to table CDHDR
    Revert if you have further queries.

  • How the sales order header status update?

    Hello,
    In the sales order header "STATUS" tab is there, under this status tab we can find OBJECT status if we click that object status it shows the Object number,Object category,status profile and status with status no. on which bases this status will update in the sales order header?
    my case is Status "10-xxxx" set automatically for some orders.
    Could you plz let me know on which bases, the status will be updated in the sales order?
    Regards|KS

    Hi
    SAPu2019S GENERAL STATUS MANAGEMENT FUNCTIONALITY
    General Status Management replaced order status management functionality in recent SAP releases (4.6C).  This discussion will address general status management, as this is how SAP allows user statuses for controlling objects in this and future releases.
    General Status Management applies to internal orders, project definitions, WBS elements, production orders and many other objects in SAP.  For the purposes of this discussion we will concentrate on status management for internal orders and WBS elements.  A list of all objects relevant for status management will be made available upon request.
    A status is an indicator that fulfills two functions.  First, it informs you that a particular status has been reached.  For example, an internal order has been created and released; a settlement rule has been entered; a particular business transaction has been executed, etc.  Second, it influences the business transactions you can perform for a particular status.  A status can allow a business transaction; allow a business transaction but issue a warning message; or prohibit a business transaction altogether.  If a warning message is issued it is up to the user whether the business transaction is carried out or not.
    Statuses can be used to control and communicate.  Statuses can be used in reporting (show me a report of all internal orders with a status of TECO, or technically complete).  Statuses can be used as selection criteria (select all internal orders with a status of CLSD, or closed).  Statuses can communicate the state of an object (ready for archiving, not ready for settlement execution).
    There are SAP standard delivered statuses that apply to all object types.  These are known as SYSTEM STATUSES.  CRTD, REL, SETC, TECO are examples of SAP standard system statuses.  SAP standard system statuses cannot be removed from use.  You cannot override the SAP system status with a user status.  You cannot change the behavior of an SAP system status.
    User statuses (or user defined statuses) exist in addition to SAP standard statuses.  User statuses are intended to augment or refine SAP standard statuses, not replace them.  There is no limitation to the number of user statuses that can be created.  Both system and user statuses influence business transactions in the same way.
    An object can have multiple statuses active at the same time.  A plant maintenance order can have released, preliminarily costed, work order printed and confirmed statuses all at the same time.  For SAP display purposes only one status can be displayed on the status line in master data screens, but it is possible to see all active statuses for an object at one time by drilling down into the master data screens.
    A STATUS PROFILE, or user status profile, contains individual user statuses and the business transaction rules defined for those statuses.  There is no limit to the number of user status profiles that can be maintained in SAP.  A user status profile is assigned to an order type or a project profile in configuration.  This user status profile is then defaulted into all objects that reference that order type or project profile.  A users status profile can be overwritten (or deleted) in an individual object (via native master data screens), but only if a user status has yet to be activated for that particular object.  Once a user status has been activated for that object the user status profile cannot be changed.
    HOW STATUS MANAGEMENT WORKS
    When an object (internal order, WBS element, production order) is created SAP assigns the system status CRTD.  MIT automatically releases the order, so the system status REL is also activated.  If there is a user status profile defined in the order type (or project profile) this is carried over into the internal order (or WBS element).  If not, only the SAP system statuses will apply to this object.
    When a user executes a business transaction for this object, SAP checks the user status to see if that business transaction can be executed without any additional influence from a user status, can be executed but with a warning message being issued, or cannot be executed at all.  SAP also checks whether the business transaction sets or deletes any other user statuses within the user status profile.
    A user status may also be maintained directly in the object master data.  Accessing the master data screens allows a user to manually maintain user statuses.  If necessary, an authorization code can be assigned to a user status to ensure that no unauthorized persons can change the status of an object.  Once changed, the new user status is fully active and acts no differently than if a business transaction set the user status.
    Status management and business transaction control only work with standard SAP transactions.  Z transactions will not show up on the business transaction list for an object.  The business transaction table is configurable, but SAP strongly recommends not changing that table.  SAP directly updates that table via support packs and it is often impacted during upgrades.
    Authorization codes / keys are available in user statuses.  The authorization code is checked only when user statuses are being set manually, from within the objectu2019s master data screens.  This ensures the user has the proper authorization to set that status for that particular object.  However, it is important to understand that SAP sets a user status in reaction to a business transaction it does not perform an authorization check.

  • Sales order header status

    Dear Gm,
    I want see sales order header status for "n" number (Mass) of sales order,From the Sales order header status i want the details abt ("Incomplete header data"/Partially rejected),Please guide me how to get the same,
    now i am taking From VA03 ,But it consume more time
    Regards
    Arun kumar K

    incomplete doc - header data
    Use Table VBUV - Sales Document: Incompletion Log
    Where, Table-Field VBUV-TBNAM maintain Tables as VBAK
    Partially rejected
    Header level
    VBUK-ABSTK as B - Partially processed
    Item Level
    VBUP-ABSTA as B - Partially processed
    Regards
    JP

  • How to cancel the sales order - header and line status are in Entered Stage

    Dears,
    I have some sales order to be cancelled in which the header and line status are in *"Entered"*. I am not able to cancel these sales order.
    Also note that these orders are for maintenance service.Once i book these orders the lines will change to closed status.
    So it is not possible to book and cancel the lines.
    Kindly me to resolve this.

    926530 wrote:
    Boss,
    If i do Action-->cancel on header, it just makes the qty to zero.But the header and line status still showing as entered.It will not cancel the order.
    The problem for me is that these lines are coming in my monthly reports. This is what your question says...be more specific as what is your issue..which in turn is your problem
    How to cancel the sales order - header and line status are in Entered Stage
    Coming to your Action-->cancel...as far as i know ...the header status will change to canceled..
    unless until you have some processing constraints in place...which is stopping you...
    HTH
    Mahendra

  • User Status update on Sales Order Header

    Hi all,
    I need to update the "User Status" on sales order header when a sales order is saved. As user status reside in JEST, what available user exits are there to change/insert new user statuses? I don't believe the common exits like MV45AFZZ would do.
    To clarify, to get to these user statuses, you go to the header of the sales order, select on the 'Status' tab, then click on the "Object Status" pushbutton.
    Any help would be greatly appreciated in the form of points!
    Thank you.
    Liam

    Hi Liam,
    In the Program MV45AFZZ in the FORM userexit_save_document
    you use the following fn module to change the user status
    'STATUS_CHANGE_EXTERN'
    Example
    IF t180-trtyp = 'H'.  "Only creation time
      READ TABLE xvbap WITH KEY matnr = c_matnr.
      IF sy-subrc = 0.  "If above material exist then change status
        LOOP AT xvbap WHERE cuobj NE space
                       AND  matnr =  c_matnr.
          l_objnr = xvbap-objnr.
          CALL FUNCTION 'STATUS_CHANGE_EXTERN'
            EXPORTING
              objnr               = l_objnr
              user_status         = 'E0013'  "Send ej IDOC
              set_chgkz           = 'X'
            EXCEPTIONS
              object_not_found    = 1
              status_inconsistent = 2
              status_not_allowed  = 3
              OTHERS              = 4.
        ENDLOOP.
      ENDIF.
      sy-subrc = 0.  "Restore the previous condition
    ENDIF.
    Reward if helpful *********

  • Function Module to update the sales order header status

    Hi,
      I am looking for a function module to update the Sales order header status.
      Pls. let me know if anybody has used any FM to update the SO status.
    Thanks,

    By mentioning status do you mean Object status or Document status??
    For Object status you may use FM: STATUS_MAINTAIN
    For document status it changes according to flow.
    Regards
    Eswar

  • Sales tab in Sales order header

    Hello Gurus
    When i create a sales order and delivery number for my warehouse. the the 'Delivery status' field of Sales tab in the sales order header data is automatically getting updated 'Fully delivered' .If i create a sales order with out saving the entry and if i go to 'Delivery status' field to check for the delivery status it says 'Not delivered'
    Can you please let me know how this field is getting updated .Is there a config where i can control this .
    Thanks

    Hi,
    Once you create a delivery for the respective line item for same qty  the delivery status will be change to fully delivered.
    But when you create a sales order in VA01 and before saving you see the status its " Not delivered" because the line item deliver has not been donr ( delivery document not created). Its an standard SAP behavior.
    Also check the copy control in VTFA  in update document flow field at item category level
    Hope this will help you to resolve your query!!
    Regards,
    Krishna O
    Edited by: Krishna O on May 28, 2010 7:16 AM

  • *Credit Control Data reome form sale order header data*

    Hi
    have any option for remove credit data from sale order header (VBAK-KKBER)?
    Thanks
    L.C

    Hi Lalith,
    Its not possible to delete KKBER Data from Sales Order.
    because it carries out from customer master XD01 and FD32
    if you want remove, if the sales order is open status delete the same and delete it from customer master and again raise the sales order and check the same,
    Thanks and Best Regards,
    Muralidharan S

  • VA01 Sales order - Header-- Accounting tab need to add a field

    Dear All,
    The requirement is,
    1. I need to add a field in Sales order.
    Path for the same is as follows:
    VA01> Goto> Header--> Accounting tab
    2. The field will be a date field that needs to calculate date on.
    a)create a new field. ex - zchdt (chq due date)
    b)when customers enters value in Assignment,
    i.e vbak-zuonr
    after that trigger logic is
    3.vabk-kunnr = knvv-kunnr
    a)sy-date + knvv-kvgr2 (exclude sundays)
    example - 14 sept + 30 days = 14th october
    should populate value - 14th october i.e. field (zchdt)
    4. This activity needs to be triggered before the sales order is saved.
    kindly know whether this is possible or not.
    if possible how & which exit & also with example code.
    if you could give me your contact(cell no).
    Regards,
    Nagendra D.S.
    Mobile - +91 9819899082

    Hi All,
    VA01 Sales order - Header--> Accounting tab need to add a field. field name - zchdt(cheque due date)
    when customer enters value in Assignment i.e zuonr & after that trigger logic is
       1.     vbak-kunnr = knvv-kunnr
       2.     sysdat + knvv-kvgr2 (exclude sundays)
    example - 16 sept + 30days = 16 oct
    in field zchdt value 16 oct as to populate
    Pls help me in the code.
    Regards
    Nagendra

  • How to update the sales order header & item data in TM system

    Hi Experts,
    Greetings!
    I need your help,I have a one requirement sales order data came from ECC these sales order data need to update in TM Sales order header table as well as item table also these fields are additional fields.
    Can anyone please guide me I am very new in TLM .
    Thanks in advance.
    Thanks&Regards,
    Siva.

    Hi Siva
      "/SCMTMS/TRQ~ROOT" is for sales order header and "/SCMTMS/TRQ~ITEM" is for details.
      I assume you need to
    enhance the structures for these nodes to hold your add. fields;
    and do the same for the input parameter of service TransportationRequestRequest_In (which is used to create OTR) from PI side;
    Pass the add. fields during service call (impelment in ERP system);
    Map the fields from service paremeter to node attribute (implement in TM system, BAdI   /SCMTMS/TRQ_SE_TPNRQ_REQ~CHANGE_MODIFICATION create modification table for the input parameter).
    I cannot find source code for all of that; hope it helps.
    Sensen

  • How to update TEXT in Sales order header

    Hello ,
    I have requirement in which I am creating SO via IDOC calling BAPI_SALESORDER_CREATEFROMDAT2.
    Question: Can any one help me in finding a solution to update the TEXT in sales order header which is confogured IN TEXT CONTROL in SD.
    I have tried various option using CREATE_TEXT but it is only updating STXH table , the text is not coming in the sales order.
    If someone knows about this , <removed by moderator>.
    Edited by: Thomas Zloch on Nov 15, 2010 4:20 PM - please do assign priorities > normal

    Sounds like a text determination config issue - have you assigned the text in VOTXN?  Have you run the text determination analysis from VA02 in the document?

  • Update Sale Order Header Text through Enhancement

    Hi Experts,
             I Have a requirement to update the sale order Header Text , when the sale order is opened in VA02 and saved.
    Here in I tried using edit_text, it updates sale order header text  directly in DB during run time even before the save action is completed.
    But I need to just fill the header text and that has to be saved during the save action only.
    I tried coding the same in the user exit (userexit_save_document) but this user exit gets triggered only when there is some changes made to the document when opened in VA02 & Saved.
    Is there any  user exist to pass sale Order Header text and save when save button is clicked irrespective of the document been changed or not.
    Thanks in advance
    Sathish

    Hi Brad Bohn,
        My actual requirement is to trigger an Idoc when the user goes to VA02 transaction and clicks save.
    IDoc gets triggered only when there is some changes to that document, that is through NAST table entry based on the output configurations in NACE transaction.
    Now that the user wants to trigger an IDoc even if there is no change (ie. to reprocess the IDoc) when he just opens a sale order in VA02 and click save.
    It is not possible to trigger an IDoc through configurations when there is no actual change in VA02 and saved.
    So it has to be forcefully sent by making some additions to the Order through coding, so I choose that Text box to fill some additional data and save .
    Kindly Let me Know any thing could be done for this scenario.
    Thanks in advance
    Sathish

  • Changing screen sequence in sales order header

    Hi Folks
    we have a requirement to change the sequence of the screens which appear in sales order header and we need to add an additional custom screen.
    Request you all to suggest how we can achieve this functionality.

    Hi,
    REquest you to take the help of ABAPer and do the modification in standard Program
    But instead of creating a new custom tab you can use additional data B tab to cater  your requirement. Its given blank in standard so that we can modify as per our requirement .So the same will be reflected in all screen no. 4013
    REgards,
    Krishna O

Maybe you are looking for

  • Can i use my AE as a network with no internet??

    So basically i would like to be able to have films on my iphone & wen i travel i can take my iphone, Express & Apple tv2. so then i can watch films over airplay on a tv round a friends or on holiday! can this be done? i have tryed setting it up but i

  • Which is better Abap or Netweaver

    Hello friends I am dotnet developer with 2+ yrs experiance ,i developed web and windows applications using c# , now i want to move towards SAP ,as a developer i have to choose technical module but my dout is in that technical which is best as per my

  • Installing .suit fonts?

    received a .suit font from client. can't install with Linotype FEX or Fontbook. font is from a reliable source and has been resubmitted so i don't think it's corrupt. anybody have any suggestions?

  • Passing EDI filename for 850 from B2B Gateway to BPEL

    Hi, Is there any way to pass the EDI filename for 850 from B2B Gateway to BPEL via AQ? we want to store the inbound filename in the database along with the PO. we are using 10g. Thanks, Naveen

  • SAP Retail Store - Store Order - Assortment List

    G'day, In the SAP Retail Store (SRS) when selecting the "Store Order" "Assortment List" option I've got a request to add columns to the assortment list ( I've done this via Badi IF_EX_WSAO_DISP_EXPAND ). The challenge now is to make fields within the