Function module for document flow

Hi,
I am developing a report on sales.
i need to display the delivery and billing status of the sale order in the report.
Is there any function module to get both the delivery and billing status for the input parameter sale order number.....?
Thanks in advance....
Raghav

hi , check the code
REPORT ZEX2  MESSAGE-ID arc NO STANDARD PAGE HEADING.
Tables :kna1,vbak.
SELECT-OPTIONS : so_vkorg FOR  vbak-vkorg OBLIGATORY,
                 so_vtweg FOR  vbak-vtweg OBLIGATORY,
                 so_spart FOR  vbak-spart,
                 so_kunnr FOR  kna1-kunnr.
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.
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'.
  LOOP AT sales_open.
    WRITE:/4 sy-vline,
           5 sales_open-vbeln HOTSPOT ON COLOR 2 INTENSIFIED OFF,
           16 sy-vline,
           17 sales_open-auart COLOR 2 INTENSIFIED OFF,
           27 sy-vline,
           28 sales_open-kunnr COLOR 2 INTENSIFIED OFF,
           40 sy-vline,
           41 sales_open-bstnk COLOR 2 INTENSIFIED OFF,
           55 sy-vline,
           56 sales_open-lfstk,
           76 sy-vline,
           77 sales_open-fkstk,
           96 sy-vline,
           97 sales_open-gbstk ,
           117 sy-vline.
    HIDE sales_open-vbeln .
  ENDLOOP.
ENDFORM.                    " sales_sel
*&      Form  sales_top_of_page
      text
-->  p1        text
<--  p2        text
FORM sales_top_of_page.
  WRITE:/4 sy-uline(114),
     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 .
  WRITE:/4 sy-uline(114).
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.

Similar Messages

  • Function module for reversing documents

    Is there a function module for posting reversal documents like F08 transaction.....

    Hi,
    We have BAPI's to reverse the documents.
    Check with 'BAPIREVERSE in SE37.
    Right now iam not on the systemto go indepth.
    Thanks,
    Deepak.

  • Function module for Change document for Business partner

    Hi Experts,
    Could any one send me the sample code of function module for CDHDR and CDPOS tables for extracting the change date along with role.
    Eg :
    BPRole Changd on crtd by crtd on Business partner
    ZCASH 30.11.2011 NHALLAL 24.11.2011 0001000237
    CRM000 03.12.2011 NHALLAL 24.11.2011 0001000237
    I wanted to catch up the changed date and changed role from CDHDR (base table) and CDPOS(cluster table - item level).
    Might be involved with creation of extract structure.
    Any sample codes are appreciated. Thanks.
    Regards,
    Janardhan

    resolved

  • Function Module for open Purchase Order & Sales Order?

    Hi, commonly I read the data from tables and calculate the open quantity for sales order and purchase order, but I want to know, are there any standard function modules for getting the list of open "purchase order" and "sales order" respectively?
    Thanks and Regards.

    hi Ren,
    u can check all these bapi's related to salesorder
    BAPI_SALESORDER_CHANGE Sales order: Change Sales Order
    BAPI_SALESORDER_CONFIRMDELVRY Sales Order: Confirmation of Delivery; Document Flow Update
    BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all Orders for Customer
    BAPI_SALESORDER_GETSTATUS Sales Order: Display Status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    May be this FM can help you
    MB_ADD_PURCHASE_ORDER_QUANTITY (Reading and adding open purchase order quantities)
    Regards,
    Naveen

  • Function Module For Item Level Details of a Sales Order

    Hi Guys,
    I have to get the item level details for a particular sales document no ..I want to know if there is any function module existing for the same.
    Also I need any function module for getting the contact information such as contact form (KNVK-ANRED),contact name(KNVK-NAM1),contact name(KNVK-NAMEV),Contact number (KNVK-TELF1).
    Please let me know if anyone is aware of it.
    Thanks in Advance,
    Mayank

    <b>SD_SALES_DOCUMENT_READ</b> Reads sales document header and business data: tables VBAK, VBKD and VBPA (Sold-to (AG), Payer (RG) and Ship-to (WE) parties)
    <b>SD_SALES_DOCUMENT_READ_POS</b> Reads sales document header and item material: tables VBAK, VBAP-MATNR
    <b>SD_DOCUMENT_PARTNER_READ</b> partner information including address. Calls SD_PARTNER_READ
    <b>SD_PARTNER_READ</b> all the partners information and addresses
    <b>SD_DETERMINE_CONTRACT_TYPE</b>
    In: at least VBAK-VBELN
    Exceptions: NO CONTRACT | SERVICE_CONTRACT | QUANTITY_CONTRACT
    <b>SD_SALES_DOCUMENT_COPY</b>
    <b>RV_ORDER_FLOW_INFORMATION</b> Reads sales document flow of sales document after delivery and billing
    SD_SALES_DOCUMENT_SAVE create Sales Doc from the copied document
    SD_SALES_DOCUMENT_ENQUEUE to dequeue use DEQUEUE_EVVBAKE
    RV_DELIVERY_PRINT_VIEW Data provision for delivery note printing
    SD_PACKING_PRINT_VIEW
    SD_DELIVERY_VIEW Data collection for printing
    called from RV_DELIVERY_PRINT_VIEW, SD_PACKING_PRINT_VIEW
    RV_BILLING_PRINT_VIEW Data Provision for Billing Document Print
    regards
    vinod

  • Standard BAPI or Function Module for FB01posting

    Hi Experts,
    My requirement is as follows.
    Invoice details would be sent across from Middleware to SAP and for which I have developed a Custom Remote Enabled Function Module. The Function Module needs to post the data using FB01 Transaction.
    I had planned for recording a BDC for FB01 and post the data, however, we are on the verge of getting upgraded from 4.7 to ECC 6.0. To avoid problems that we might face for change of screens in ECC 6.0, I would prefer using a BAPI or Function Module for FB01 posting, if available, instead of BDC.
    Data coming from Middleware are as follows.
    HEADER:
    BKPF-BLDAT :  Document Date
    BKPF-BUDAT : Posting Date
    BKPF-XBLNR: Reference (Invoice#)
    BKPF-BLART : Document Type
    BKPF-BUKRS : Company Code
    BKPF-BKTXT : DocHeader Text
    BKPF-WAERS : Currency
    LINE ITEM:
    BSEG-LIFNR : Vendor no
    BSEG-WRBTR - Total amt -Debit/Credit -Vendor
    BSEG-ZUONR : Assignment field
    BSEG-EMPFB : Alternative Payee
    BSEG-UZAWE : Payment Method Supplement
    BSEG-ZTERM : Pmt terms
    BSEG-KOSTL : Costcenter
    BSEG-HKONT : GL AccountNumber
    BSEG-WRBTR : Amount for GL
    BSEG-SGTXT : Line item text
    The Vendor Line Item would be one where as GL line items could me more than one.
    Can any of you suggest me a standard BAPI or Func Mod?
    Points will be awarded for valuable inputs.
    Thanks to all!!!!

    You can use RFBIBL00 program for FB01 postings. Go through the program help on how to use this program.
    This program requires a file to be on application server in a certain format.
    You may also refer the program RFBIBLT0 on how the file format should be.
    Hope this helps.
    Thanks,
    SKJ

  • Function Module for Excise and VAT Calculation

    Dear All,
    I required one Function module for calculation of Excise % and amount of Invoice Verification Document.
    We are use TAXINN tax procedure. I am try to make Purchases Register where we required the Break up of Full tax amount as basic excise duty, Education Cess, S&H Education Cess and VAT Amount.
    Thanks
    Mukesh

    Hi,
    Locks are usually appliend on Tables. So you could find the table names affecting.
    Then you could goto SE11 and n Lock objects search for table name
    Once you identify the lock object. Display. Goto->Lock Modules.
    You will get 2 module names one for enqueue and 1 for dequeue.
    e.g. Lock object EBKK_ACCNT.
    and FMs are DEQUEUE_EBKK_ACCNT and ENQUEUE_EBKK_ACCNT
    Hope this helps.
    Regards
    Megha

  • FUNCTION MODULE FOR MICROSOFT WORD

    Is there any function module for getting data from Microsoft Word document?
    I had tried 'GUI_UPLOAD' but some data could not be recognized. Probably because of format in Microsoft Word.

    Hi
    use this fun module LXE_SP_MSWORD_TO_ITF
    and convert from MS word to OTF and use other fun modules
    Regards
    Anji

  • Function Module for Posting the Delivery Doument

    Dear Experts,
            Could you please send me the Function Module for Posting the Delivery Doument.
    Thanks & Regards,
    Ashok.

    Hi,
    What do you mean by POSTING the delivery document?
    Are you mentioning the creation of Goods Issue?

  • Function module for sending email

    Hi all,
    Can I know list of function modules for sending emails.
    Other than "SO_DOCUMENT_SEND_API1"
    pls let me know

    Hi Praveen,
    Below is the sample code to send the external mail.
    &**********Reward Points if helpful**********&
    DATA: ld_mtitle LIKE sodocchgi1-obj_descr,
            ld_format TYPE  so_obj_tp ,
            ld_attdescription TYPE  so_obj_nam ,
            ld_attfilename TYPE  so_obj_des .
           ld_receiver LIKE  sy-subrc.
      DATA:   it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
              it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
              w_cnt TYPE i,
              w_sent_all(1) TYPE c,                             "#EC NEEDED
              w_doc_data LIKE sodocchgi1.
      REFRESH it_receivers . CLEAR it_receivers .
      IF v_trip_send = 'X'.
        it_receivers-receiver = it_trip_dload-approver_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-approver_email .
      ENDIF.
      it_receivers-rec_type = c_u .
      APPEND it_receivers. CLEAR it_receivers.
    it_receivers-receiver = " ------> pass your reciever email id.
      IF v_trip_send = 'X' .
        it_receivers-receiver = it_trip_dload-requester_email .
      ELSE .
        it_receivers-receiver = it_adv_dload-requester_email .
      ENDIF .
      it_receivers-rec_type = c_u .
      it_receivers-copy     = 'X' .
      APPEND it_receivers. CLEAR it_receivers.
      ld_mtitle = p_mtitle.
      ld_format              = p_format.
      ld_attdescription      = p_attdescription.
      ld_attfilename         = p_filename.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = c_saprpt.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = c_saprpt.
      w_doc_data-obj_descr  = ld_mtitle.
      w_doc_data-sensitivty = c_f.
      CLEAR it_attachment.
      REFRESH it_attachment.
      it_attachment[] = it_attach[].
    Describe the body of the message
      CLEAR it_packing_list.
      REFRESH it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES it_packing_list-body_num.
      it_packing_list-doc_type = c_raw.
      APPEND it_packing_list.
    Create attachment notification
      it_packing_list-transf_bin = c_x.
      it_packing_list-head_start = 1.
      it_packing_list-head_num   = 1.
      it_packing_list-body_start = 1.
      DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
      it_packing_list-doc_type   =  ld_format.
      it_packing_list-obj_descr  =  ld_attdescription.
      it_packing_list-obj_name   =  ld_attfilename.
      it_packing_list-doc_size   =  it_packing_list-body_num * 255.
      APPEND it_packing_list.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          document_data = w_doc_data
          put_in_outbox = c_x
          commit_work   = c_x
        IMPORTING
          sent_to_all   = w_sent_all
        TABLES
          packing_list  = it_packing_list
          contents_bin  = it_attachment
          contents_txt  = it_message
          receivers     = it_receivers.

  • Function module for Delivery and billing based on sales order

    Hi Friends
    I am developing an object which has to create the sales order, delivery for that sales order and billing for it at the same time.
    I have tried for few function modules to create the delivery and billing but I am not able to achieve.
    Would you please help me by providing the correct function modules for these 2 activities?
    Thanks
    Praveen

    Hi Nikhil
    Thanks for reply,
    i am creating the sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT1" only, but the billing document bapi
    "BAPI_BILLINGDOC_CREATE" is for online creation, it will call the t-code 'VF01'.
    I need to create the billing document with out calling the t-code like using bapi for sales order. Please suggest me if there are function modules to achieve this.
    Thanks
    Praveen

  • Function module for mb01 transaction

    Hello Gurus,
    I need a function module for creating Goods Receipt using PO number with transaction MB01.
    Specifically MB01 ,because I need to make GR with MIGO "05 Only Part1"
    There is a function module GOODS_RECEIPT_MB01 .
    But I am unable to collect the required parameters .
    As an output the material document number should get uploaded into table called  J_1IPART1.
    Thanks in Advance.
    A beginner in ABAP
    Your help will be greatly appreciated!!!
    Anagha
    Edited by: Anaghav on Jun 24, 2011 12:40 PM
    Edited by: Anaghav on Jun 24, 2011 4:52 PM

    There is a nice transaction 'BAPI' which will give overview all the available BAPI 's...
    For your requirement, please drill down at:
    Materials Management ->Inventory Management ->Goods Movement ->CreateFromData -> BAPI_GOODSMVT_CREATE
    Thanks.

  • Function module for submitting order in CRM B2B

    Hi Experts,
    we are customizing the CRM B2B functionality. as per our reqruirement, we have 3 types of orders (docuemnts) to submit. for each order we have differnt  extra fields data need to be sent to the back end system in the Header level and item level.
    In this case still we  can not use the standard function module to submit the document.
    need to use the same standard functiona module or need to create the z function module for submitting all three orders.
    Please advice.
    I have another question. What the standard functiona module name for submitting the order?
    Adavance Thanks

    HI
    We need not create any custom FM to send in extension data. Just extend the class which is called on save and overirde the
    customer exits available there.
    From the sales document object  get header and itemlist.
    ItemList itemsData                = salesDocument.getItems();
    HeaderData header                = salesDocument.getHeaderData();
    header.addExtensionData();
    ItemSalesDoc[] items = itemsData.toArray();
    for (int k = 0; k < items.length; k++) {
      ItemSalesDoc item = new ItemSalesDoc();
      item = items[k];
      item.addExtensionData();
    The header and item extension datas will be available in the respective place holders in the methods in BADI
    CRM_ISA_BASKET_ITEMS   CHANGEITEMS_BEFORE_ORDER  IT_EXTENSION
    CRM_ISA_BASKET_HEAD    CHANGEHEAD_BEFORE_IL         IT_EXTENSION
    The method name and place holder in backend also given above.
    Hope this helps
    Regards
    Antony

  • Function Module for message "MBGMCR" in outbound process

    Hi all,
    I want to create an IDoc via EDI when I post a material document. I use messgae type MBGMCR and IDoc type MBGMCR02 and I already configured in partner profile and all about output determination in SAP-IM.
    And now I need a function module to process outbound IDoc of posting material document but I couldn't find a function module for processing.
    Pls let me know about that.
    Thanks for your time.

    Hi,
    You need to Code your own Z Function Module for this. Copy any standard outbound FM to create your own Z FM, so as to ensure that Interfaces are correct.  
    Refer to given below threads:
    Re: Standard IDOC for Goods Receipt
    Re: Idoc type for Goods Receipt
    Goods Receipt MIGO IDOC

  • Functional module for automatic creation of pur requisition & pur order

    hello,
    what is the functional module for automatic creation of puchase requisition and automatic creation of purchase order which we will assign in action box in service order processing management.
    please let me know as early as possible
    regards,
    rajesh kumar raju

    Hi,
             Please check with following.
    IDOC_INPUT_ACC_PURCHASE_REQUI
    IDOC_INPUT_ACC_PURCHASE_ORDER
    /ISDFPS/OR_PURCHASE_ORDER_CR
    BS01_PURCHASE_DOCUMENT_CREATE
    CO_MP_CREATE_PURCHASE_ORDER
    Thanks & Regards
    Sadhu Kishore

Maybe you are looking for