Skip to Content
author's profile photo Former Member
Former Member

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2006 at 07:35 AM

    Hi , Raghavendra ,

    if u r looking for fm

    for the criteria,

    then RV_SALES_DOCUMENT_VIEW_3,,

    or for code go throught this.

    check this code for open sales order(basic list) + open items (secondary list).

    check the status as A--not yet processed..

    B--partially processed

    C--completely processed

    hope this helps u out in getting the functionality.

    u can take the header data from vbakuk ( vbak + vbuk )

    and items from vbap as shown ..

    fetching the data from vbakuk minimizes joins on vbak and vbuk.

    execute the below 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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2006 at 07:43 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 21, 2006 at 01:10 PM

    Hi Raghav,

    Please check this FM.

    SD_VBFA_SELECT

    SD_VBFA_ARRAY_READ_VBELV

    SD_VBFA_READ_WITH_VBELV

    SD_VBFA_SINGLE_READ

    SD_VBFA_TRANSFER_TO_BUFFER

    SD_VIEW_VBFAVG

    RV_FLOW

    RV_ORDER_FLOW_INFORMATION

    Hope this will help.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.