Header Details of pending * open Sales Order.

HY All Experts.
PL Read Follwing Code. i wnt to Header data of pending and open SO.
i used vbuk-lfstk. for So status. it is right.
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.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.

Hello anjana,
   Actually your question is some confusing, but if u want to get eldest change as active sales order then logic is as follows:
1.  On base of OBJNR u have to get UDATE from JCDS table
2. then write logic as:
SORT i_jcds BY objnr stat chgnr DESCENDING.
      LOOP AT i_jcds INTO wa_jcds1.
        CLEAR lv_stat.
        lv_stat = wa_jcds1-stat.
        AT NEW objnr.
          AT NEW stat.
            CLEAR: wa_tab.
            wa_tab-objnr = wa_jcds1-objnr.
            wa_tab-stat = lv_stat.
          ENDAT.
        ENDAT.
        IF wa_jcds1-inact = 'X'.
          CLEAR lv_tabix.
          IF sy-tabix > 1.
            lv_tabix = sy-tabix - 1.
          ELSE.
            lv_tabix = 1.
          ENDIF.
          READ TABLE i_jcds INTO wa_jcds2 INDEX lv_tabix.
          IF sy-subrc = 0.
            wa_tab-chgnr = wa_jcds2-chgnr.
            wa_tab-udate = wa_jcds2-udate.
            wa_tab-utime = wa_jcds2-utime.
            APPEND wa_tab TO i_tab.
          ENDIF.
          CONTINUE.
        ELSE.
          wa_tab-chgnr = wa_jcds1-chgnr.
          wa_tab-udate = wa_jcds1-udate.
          wa_tab-utime = wa_jcds1-utime.
        ENDIF.
        AT END OF objnr .
          AT END OF stat.
            APPEND wa_tab TO i_tab.
          ENDAT.
        ENDAT.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM i_tab COMPARING objnr stat.
      SORT i_tab BY objnr stat udate utime.
      DELETE ADJACENT DUPLICATES FROM i_tab COMPARING objnr.
3. now in i_tab table u'll get eldest UDATE
Hope its work for u.
Thanks & Regards,
Sumit Joshi

Similar Messages

  • Billing plan (Downpayment) for saved and open sales orders at header level?

    Hi gurus,
    I have configured billing plan in my SD environment at Item Level.
    I want to change it to header level.
    Questions:
    1- When I make the changes to update the system to have billing plan at header level for future sales orders, is that possible for me to change all my saved orders and open orders with the new settings so that I can also have those saved and open orders with a billing plan at item level?
    2- If that scenario is not possible, could we for example copy the data of a previously saved or open sales order into a new sales order with the new customizing (Billing plan at Header level?)
    Thanks for your input
    Kind regards
    Chris

    Hi
    I am afraid you cannot do that converstion for the existing orders. BP at header level are enabled at teh document type level, while BP at item level is done at item category. So both are independent. Mostly it is advisabel to use BP at item level only.
    If you are already using item level BP, and want to mvoe to header BP, then only future transactions can be executed with BP at header level. Existing item level BPlans will remain so in the system.

  • Table required for details of Open sales order

    Hi experts,
    My user wants following reports and it is to be based on SD module:
    Customer Name  Open Sales order(qty.)    Delivered ( qty.)   Balance Open Sales Order(Qty.)
    Please advise from which table i can make said report.
    Regards,
    Samaar

    Hi,
    Check the table VBAP by filtering conditions.
    Thanks
    Prasada

  • Report for open sales order

    Dear all,
    I need to create a open sales order report. Could you please tell me from which table i can get open sales order. Its standard report is VA05 and also I checked in table VBBE. but all record which i get from VA05 are not visible in VBBE table. It means VBBE doesnt carry all pending open records.
    Please guide me from which table i can get it or what is the sriteria to get it?
    Thankyou very much in advance
    Punnet Sharma

    hi,
    my logic goes like this:
    Note: Open cursor is used since we are dealing with huge amnt of data:
    * Select orders based on their Delivery status
      SELECT  vbeln
      FROM vbuk INTO TABLE git_vbuk
          WHERE lfstk = 'A' OR lfstk = 'B' .
    * Filter selected orders
    * Selection using open cursor
      DATA: lwa_op_sal_ord1 TYPE gt_comtab.
      IF sy-subrc = 0.
        OPEN CURSOR c1 FOR
          SELECT vbap~matnr
          FROM vbap INNER JOIN vbak
          ON vbap~vbeln EQ vbak~vbeln
          FOR ALL entries IN git_vbuk
          WHERE vbap~vbeln = git_vbuk-vbeln AND
                vbak~vbtyp = 'C'.
        DO.
          CLEAR lwa_op_sal_ord1.
          FETCH NEXT CURSOR c1 INTO CORRESPONDING FIELDS OF lwa_op_sal_ord1.
          IF sy-subrc = 0.
            APPEND lwa_op_sal_ord1 TO li_op_sal_ord1.
          ELSE.
            CLOSE CURSOR c1.
            EXIT.
          ENDIF.
        ENDDO.
      ENDIF.
    here filter orders based on 'A' and 'B' from VBUK...
    then frm header table VBAK get order for vbtyp ='C'.
    now li_op_sal_ord1 will have open sales orders..
    Moreover as per ur query y do u need the item data frm VBAP as u are only concerned abt VBELN.
    If u need item u hv 2 run another select.
    regards,
    ags

  • Open sales orders using SD_SELECT_SALES_DOCUMENTS - no POSNR

    Hi all,
    I'm trying to use SD_SELECT_SALES_DOCUMENTS to select open sales documents but have noticed that it does not seem to contain line item details, seems like it only shows open sales orders at header level. I was wondering if there was something similar for line item details?
    Regards,
    Mark.

    Marcin, thanks for the suggestion - unfortunately in import parameters didn't give me the function I needed.
    Instead i've found BAPI_SALESORDER_GETSTATUS  to be quite suitable.
    Regards,
    Mark

  • Closing of open sales order( Reward)

    example- i have open sales order of 100 qty and 50 qty have been delivered and 50 qty is left .is there any option to close that sales order without delivery so that nobody can see it again?plz suggest me?best answer ll be rewared.

    Hi tripathy
    in this case you have to  define reason fo rejection path :  spro -sd- sales -sales documents header -sales document item define reason for rejection.
    you should be more specific about rejection reason.
    after delivering 50 quantity for remaining 50 quantity organisation has rejected or customer has rejected.
    now goto VA02 give all the details and material give remaining 50 quantity select reason for rejection.
    i hope you have understood.
    if your doubts is clear don't forget to reward.
    thanks
    surya
    Edited by: ramakrishna suryanarayanarao on May 27, 2008 7:07 AM

  • Reg Open sales order item and the quantity

    Hi experts:
    I am getting open sales order item based on inner join of tables(vbak, vbap, vbep). Not using vbbe table in inner join as it doesnt carry all pending open records.
    can any one say how open sales order items  and their quantity can be retrieved?
    I searched forum and saw usage of vbuk and vbup tables, but it does not accomplish our scenario.
    Thanks in advance,
    Sashti.

    Hi,
    1) fetch the header information from VBAK table.
    2) Based on VBAK table fetch all the line items from VBAP table.
    3) Now fetch from VBFA table.
    *-Fetch from VBFA to get the delivered qty
      SELECT vbelv               " Preceding sales and distribution document
             posnv               " Preceding item of an SD document
             rfmng               " Referenced quantity in base UOM
        FROM vbfa
        INTO TABLE lt_vbfa
         WHERE vbelv   = gv_vbeln
           and vbtyp_n = 'J'.
    4) By comparing VBFA-POSNR just filter the records from the VBAP internal table. Remained lines are open lines of the sales order.
    Regards,
    ~Satya

  • Tables related for open sales orders

    Hi all,
    I need to fetch the list of open sales orders
    based on the range of customers.  I have seen va05
    but in that only single customer
    is allowed. I want for range of customers based on that list of open
    sales orders.
    can any tell me for this requirement is any std tcode available if not
    what tables  I have to use to fetch data.
    any suggestion will be rewarded.

    Hi ,
      can you check these tables in sales
    Name Description Uses
    LIKP Shipped Lines header
    LIPS Shipped Lines detail
    VBAK Order header Every order (unless archiving)
    VBAP Table fields Every line item (unless archiving)
    <b>VBBE</b> Open sales order line items Great file, but be careful. Contents don't reflect orders that do not affect purchasing (go figure).
    VBEP Schedule line item
    VBFA Document flow Let's you move from order to shipping document to invoice.
    VBUK Order status
    VBUP Line item detail status
    VBFK Invoicing header
    VBFP Invoicing detail
    <b>Reward pts if found usefull :)</b>
    regards
    Sathish

  • Mass Update of Product hierarchy in all CRM Open Sales Orders

    Hi Folks,
    I have a requirement in my project wherein I have to update product hierarchy details with new values in all Items of CRM Open sales orders.
    If suppose I have a text file which has the details of Open Orders & new product hierarchy which i have to update, then would it be recommended if I use BDC for this task. Can I Call Transaction CRMD_ORDER?
    If someone has already gone through such requirement, Can you please suggest me how to proceed with this requirement. Using BDC or any other way which I can proceed with?
    Thanks in advance !!!
    Regards,
    Nitish.

    You are correct in indicating that Exchange rate type field  is not seen in Header data of sales order. I checked screen layouts for various screens for sales order data and this field is not suppressed. The only reason could be that this field is not used in sales order screens
    If you are interested, you could also check in the following way
    1.  Go to SE11, enter database table as VBAK
    2. Once inside data dictionary table, click where used list button, select programs and screens and execute
    3. click continue (don't select background)
    4. now you would have list of programs and screens, this table is used
    5.  now start another session and go to transaction SE51
    6. indicate program name as SAPMV45A and screen numbers as listed in step 4. you can check all screen numbers to see whether Exchange rate type field is listed in sales order layout.
    7. Of particular interest would be screen number 4311 as this contains  Financial accounting data & 4303 Billing data
    8. you can check screen layout for screen 4311 & 4303. you would see Exchange rate type field is not indicated.
    9. in case you could find this field in any screen, you could ask your ABAP consultant to add this field in the layout screen.
    Hope this answers your question

  • Reg : open sale order

    hai to all
    i my senario i should download the open sale order existing in the present production server into a flat fle
    can anyone tell me where this ship- to party is getting stored while creating the sale order. please let me know the table name.
    regards
    vijay

    Hi Vijay,
    To find out Open Sales Order. You shoud get them from VBUK-GBSTK <> 'C'. Store them in internal table.
    To get Ship-to-party, you can get it from VBPA (partner table).
    VBPA-VBELN = sales order number
    VBPA-POSNR = '000000'
    VBPA-PARVW = 'WE' or 'SH'
    You will get details for Ship to Party.
    regards,
    ram

  • Open Sales orders through IDOC

    Hi
    We are trying to send the list of open sales orders of a customer in an IDOC to the customer. For example, if the customer has got 15 sales order to be delivered to him , he needs the details of all these 15 orders in an single IDOC
    Is there any IDOC message type available for this in SAP R/3 4.7 version  or is there a standard solution of sending these details through IDOC
    Regards
    Anandh

    Hi
    We are trying to send the list of open sales orders of a customer in an IDOC to the customer. For example, if the customer has got 15 sales order to be delivered to him , he needs the details of all these 15 orders in an single IDOC
    Is there any IDOC message type available for this in SAP R/3 4.7 version  or is there a standard solution of sending these details through IDOC
    Regards
    Anandh

  • Close of Open Sales Orders

    Dear Experts,
    I have a similar requirement i.e. A good Volume of Open Sales Orders which are to be Closed. The Status of these Sales Orders being Partially Delivered, Not Delivered and Being Processed. Can I have a best solution to close them via an SAP transaction or with an ABAP Program. Kindly give us a detailed Solution to proceed.
    Regards
    Hari

    Hi,
    As i understood, you want the STATUS of the orders to be COMPLETE.
    For this you have to do some settings in the ITEM CATEGORY in VOV7
    Goto the Transaction code VOV7 and select the ITEM CATEGORIES for all those documents and maintain the  *COMPLETION RULE as A.*
    Now check creating the new documents after executng the full cycle.
    thanks,
    santosh

  • Deletion of open sales orders

    Dear all,
    we want to delete open sales orders .I searched forum unable to do .Please guide me.
    Regards,
    Suresh

    hi
    You can  delete the sales order using transaction VA02, but there should not be any subsequent document is created against it. Please let me know the error message you are still getting unable to delete so.
    Deletion /cancellation can only happen even if the subsequent documents are NOT created. After cancelling the invoice and deleting the delivery document, we can set the reason for rejection at the Sales Order Header Level.
    Steps:
    1. Cancel the invoice through T code VF11
    2. Reverse the Goods Issue using VL09, turn the pick quantity u2018zerou2019 in the delivery document
    3. Delete the delivery document using VL02n.
    4. Finally set the reason for rejection at the Sales Order Header Level. (So Bala, just check the SO you want to delete ever had any subsequent document? )
    Note: An Invoice cannot be deleted but canceled. It can only be canceled with (VF11) only if the relevant accounting document is not generated. Generation of accounting document means the value is posted into accounts and G/L accounts are hit.
    SAP FI department needs to reverse the accounting doc on a real-time scenario. Only after the accounting doc is reversed invoice can be canceled. Tax documents generated through the Invoice (Tax is maintained on a separate account) also need to be reversed but this is a part of FI so an SD consultant just needs to request the FICO guy to do the reversal
    transaction MASS or VA05 you should be able to set the reason for rejection

  • LSMW  - Open Sales Orders

    Hello  Friends
    I want to find if anybody can guide me on how to get all open sales order tables , i want to create a format and create a flat file for uplodading the file , for this what do i need and how do i do it.
    Also for creating LSWM can i use the existing one which i can just Assign the New file to the existing one .
    Regards.

    Dear Mehmood,
    I want to find if anybody can guide me on how to get all open sales order tables
    You want to extract all the open sales orders- which you can get from Table:VBUP key in overall document status in selection screen ( You can use VBUK also- but if there are certain sales orders in which some of the items are completed or few of them open, using VBUK - you will not get exact records)
    Secondly, you can get the data by using Query also- in SQVI
    design a query with VBAK / VBAP & VBUP
    so that from VBAK you can give time period & sales area details
    from VBAP - you can enter plant relevant details to filter certain records & item category as well
    where as VBUP- filter wth the status.
    once downloaded store in flat file.
    Now Create LSMW object by using batch input recording method. after mapping the relevant fields,
    prepare the flat file in such a - it suits to the upload file / recording file. then you can upload the already downloaded n stored open sales orders in flat file.
    Hope this is what you are looking for.
    Regards,
    ReazuddinMD

  • Reg:open sales orders

    Can any body give me the logic to list the oper sales orders.
    Thanks,
    srik

    Hi,
    *& Report  ZOPEN_SALESORDER
    report zopen_salesorder message-id arc no standard page heading.
    tables :kna1,vbak.
    select-options : so_vkorg for vbak-vkorg ,
    so_vtweg for vbak-vtweg ,
    so_spart for vbak-spart,
    so_kunnr for kna1-kunnr.
    data : keybalance like bapi3007_3 occurs 0 with header line.
    data : begin of sales_open occurs 0 ,
    vbeln like vbak-vbeln,
    auart like vbak-auart,
    kunnr like kna1-kunnr,
    bstnk like vbak-bstnk,
    lfstk like vbuk-lfstk,
    fkstk like vbuk-fkstk,
    gbstk like vbuk-gbstk,
    end of sales_open.
    data : begin of itm_sales occurs 0,
    vbeln like vbap-vbeln,
    posnr like vbap-posnr,
    matnr like vbap-matnr,
    lfsta like vbup-lfsta,
    lfgsa like vbup-lfgsa,
    fksta like vbup-fksta,
    fksaa like vbup-fksaa,
    gbsta like vbup-gbsta,
    end of itm_sales.
    data : l_kunnr like kna1-kunnr,
    l_vkorg like vbak-vkorg,
    l_vtweg like vbak-vtweg,
    l_spart like vbak-spart.
    data: v_statusl(20) type c,
    v_statusb(20) type c,
    v_statusf(20) type c,
    v_statusg(20) type c,
    v_status(20) type c,
    v_field(1) type c.
    **Selection Screen Validations.
    at selection-screen.
    perform validations.
    *& Form Validations
    text
    --> p1 text
    <-- p2 text
    form validations.
    **Customer
    if not so_kunnr[] is initial.
    select single kunnr into l_kunnr
    from kna1
    where kunnr in so_kunnr.
    if sy-subrc ne 0.
    message e002 with text-005.
    endif.
    endif.
    **Sales Organization
    if not so_vkorg[] is initial.
    select single vkorg into l_vkorg
    from tvko
    where vkorg in so_vkorg.
    if sy-subrc ne 0.
    message e003 with text-006.
    endif.
    endif.
    **Distribution Channel
    if not so_vtweg[] is initial.
    select single vtweg into l_vtweg
    from tvkov
    where vkorg in so_vkorg
    and vtweg in so_vtweg.
    if sy-subrc ne 0.
    message e004 with text-007.
    endif.
    endif.
    **Division
    if not so_spart[] is initial.
    select single spart into l_spart
    from tvta
    where vkorg in so_vkorg
    and vtweg in so_vtweg
    and spart in so_spart.
    if sy-subrc ne 0.
    message e005 with text-008.
    endif.
    endif.
    endform. " Validations
    top-of-page.
    perform sales_top_of_page.
    start-of-selection.
    perform sales_sel.
    *& Form sales_sel
    text
    --> p1 text
    <-- p2 text
    form sales_sel.
    data: date type sy-datum.
    date = sy-datum - 3000.
    select vbeln auart kunnr bstnk
    lfstk fkstk gbstk
    into table sales_open
    from vbakuk
    where vkorg in so_vkorg
    and vtweg in so_vtweg
    and spart in so_spart
    and kunnr in so_kunnr
    "and gbstk ne 'C'.
      and gbstk in ('A','B')
      and erdat >= date.
    loop at sales_open.
    call function 'BAPI_AR_ACC_GETKEYDATEBALANCE'
          exporting
            companycode = '1919'
            customer    = sales_open-kunnr
            keydate     = sy-datum
          tables
            keybalance  = keybalance.
        read table keybalance index sy-tabix.
    write:/4 sy-vline,
    5 sales_open-vbeln  color 2 intensified on,
    16 sy-vline,
    17 sales_open-auart color 2 intensified on,
    27 sy-vline,
    28 sales_open-kunnr color 2 intensified on,
    40 sy-vline,
    41 sales_open-bstnk color 2 intensified on,
    55 sy-vline,
    56 sales_open-lfstk,
    76 sy-vline,
    77 sales_open-fkstk,
    96 sy-vline,
    97 sales_open-gbstk ,
    117 sy-vline,
    118 keybalance-lc_bal,
    142 sy-vline.
    "hide sales_open-vbeln .
    endloop.
    write :/4 sy-uline(160).
    endform. " sales_sel
    *& Form sales_top_of_page
    text
    --> p1 text
    <-- p2 text
    form sales_top_of_page.
    write:/4 sy-uline(160),
    50 'OPEN SALES ORDERS' color 7 intensified on .
    write: /4 sy-vline,
    5 'SalesOrder' color 1 ,
    16 sy-vline,
    17 'OrderType' color 1,
    27 sy-vline,
    28 'Customer' color 1,
    40 sy-vline,
    41 'PoNumber' color 1,
    55 sy-vline,
    56 'Delivery Status' color 1,
    76 sy-vline,
    77 'Billing Status' color 1,
    96 sy-vline,
    97 'Processing Status' color 1,
    117 sy-vline,
    130 'Balance' color 1,
    142 sy-vline.
    write:/4 sy-uline(160).
    endform. " sales_top_of_page
    "at line-selection.
    "select a~vbeln
    "a~posnr
    "a~matnr
    "* a~kwmeng
    "b~lfsta
    "b~lfgsa
    "b~fksta
    "b~fksaa
    "b~gbsta
    "into table itm_sales
    "from vbap as a join vbup as b
    "on avbeln eq bvbeln
    "and aposnr eq bposnr
    "and b~gbsta ne 'C'
    "where a~vbeln eq sales_open-vbeln.
    "if not sales_open is initial.
    "loop at itm_sales.
    "write:/5 itm_sales-vbeln,
    "itm_sales-posnr,
    "itm_sales-matnr,
    "itm_sales-lfsta,
    "itm_sales-lfgsa,
    "itm_sales-fksta,
    "itm_sales-fksaa,
    "itm_sales-gbsta.
    "endloop.
    "endif.
    thanks
    Ravi

Maybe you are looking for

  • N97 Photo Gallery Bug

    Hey all. I've found yet another issue with the N97's software, and I'm looking to see if anybody else has had this come up with theirs as well, if anybody has their N97 anymore.  It seems that for some stupid reason, whether it be from constantly con

  • First PKGBUILD

    Hello, I'm trying to create an AUR package for a vim plugin. I've read the wiki and mostly just tried to copy from a working PKGBUILD in the AUR. Basically, the only thing my package needs to do is copy the .vim file to $HOME/.vim/ftplugin/tex on ins

  • I do not get a readable or editable PDF file that has been converted to Microsoft Word.

    In the past I have been able to convert PDF files to MicroSoft Word, and Edit and Save the Documents. Now, the converted files are unreadable and uneditable. How do I correct this problem?

  • Converting flowing layout xdp to background artwork pdf using java

    I design a Form in LiveCycle designer and save it as XDP. Very nice, since I can see the "fixed content" as content of "draw: elements and my dynamic fields. This pdf is going to be served up through the web, and needs no editing. All the form displa

  • Request UEFI / GOP Vbios: R9 270 Gaming 2G

    Hello, could you please provide me vbios with UEFI / GOP support for my graphics card? (S/N: 602-V305-01SB1311027298) and this is my current vbios bit.ly/19E6xmm thanks