How to put sales order on hold

HI sap minds ,
help me how can i put a sales order on hold , through va01 .

Add delivery block and/or billing block.

Similar Messages

  • Report on sales order on hold

    hello sdn friends,
    how to develop an report to display to open sales orders on hold.
    i dont have any idea about this,please help regarding this.

    Hi,
    Check the program
    TABLES:vbak,
           vbap,
           tvko,
           tvak,
           mara,
           tvtw,
           kna1,
           vbpa.
    TYPE-POOLS : slis.
                               GLOBAL TYPES
                       naming convention: "TY_name"
    TYPES : BEGIN OF ty_vbak       ,
            vbeln  TYPE vbak-vbeln ,
            auart  TYPE vbak-auart , " DRFK904686
            vkorg  TYPE vbak-vkorg ,
            vtweg  TYPE vbak-vtweg ,
            vkgrp  TYPE vbak-vkgrp ,
            bstnk  TYPE vbak-bstnk ,  "DRFK904686(+)
            kunrsl TYPE vbak-kunnr ,
            END OF ty_vbak         .
    TYPES: BEGIN OF ty_vbap        ,
            vbeln TYPE vbap-vbeln  ,
            posnr TYPE vbap-posnr  ,
            matnr TYPE vbap-matnr  ,
            matkl TYPE vbap-matkl  ,
            kwmeng TYPE vbap-kwmeng,
            vrkme  TYPE vbap-vrkme ,   "order unit
            zmeng  TYPE vbap-zmeng ,
            zieme  TYPE vbap-zieme ,  "order unit
            netpr  TYPE vbap-netpr ,  "price
            netwr  TYPE vbap-netwr ,  "DRFK904686(+)
          END OF ty_vbap           .
    TYPES:BEGIN OF ty_vbuk     ,
          vbeln TYPE vbuk-vbeln,
    Start of addition DRFK904686
          lfstk TYPE statv     ,
          lfgsk TYPE statv     ,
          fkstk TYPE statv     ,
    End of addition DRFK904686
          END OF ty_vbuk       .
    TYPES:BEGIN OF ty_vbpa     ,
            vbeln TYPE vbpa-vbeln,
            kunrsh TYPE kunnr    ,
          END OF ty_vbpa       .
    TYPES:BEGIN OF ty_makt  ,
            matnr TYPE matnr,
            maktx TYPE maktx,
          END OF ty_makt.
    TYPES:BEGIN OF ty_t023t,
           matkl TYPE matkl,
           wgbez TYPE wgbez,
         END OF ty_t023t.
    TYPES:BEGIN OF ty_kna1    ,
           kunnr TYPE kunnr   ,
           name1 TYPE name1_gp,
         END OF ty_kna1.
    TYPES:BEGIN OF ty_final         ,
            vbeln  TYPE vbak-vbeln  ,
            auart  TYPE vbak-auart  ,
            vkorg  TYPE vbak-vkorg  ,
            vtweg  TYPE vbak-vtweg  ,
            vkgrp  TYPE vbak-vkgrp  ,
            bstnk  TYPE vbak-bstnk  , "PO Number; DRFK904686(+)
            kunrsl TYPE vbak-kunnr  ,
            name1  TYPE name1_gp    ,
            matnr  TYPE vbap-matnr  ,
            maktx  TYPE maktx       ,
            matkl  TYPE vbap-matkl  ,
            wgbez  TYPE wgbez       ,
            kwmeng TYPE vbap-kwmeng ,
            vrkme  TYPE vbap-vrkme  ,   "order unit
            zmenge TYPE vbap-kwmeng ,
            netpr  TYPE vbap-netpr  ,  " price "vv
            netwr  TYPE vbap-netwr  ,
            zmein  TYPE vbap-meins  ,
            kunrsh TYPE kunnr       ,
            name2  TYPE name1_gp    ,
    Start of addition DRFK904686
            lfstk  TYPE statv     ,
            lfgsk  TYPE statv     ,
            fkstk  TYPE statv     ,
    End of addition DRFK904686
          END OF ty_final         .
                              GLOBAL CONSTANTS
                       naming convention: "c_name"
    CONSTANTS: c_sh                         TYPE vbpa-parvw        VALUE 'WE'                   ,
               c_formname_top_of_page       TYPE slis_formname     VALUE 'F_DISPLAY_TOP_OF_PAGE',
               c_en(2)                      TYPE c                 VALUE 'EN'                   ,
               c_a                          TYPE char1             VALUE 'A'                    .
                        GLOBAL ELEMENTARY VARIABLES
                        naming convention: "w_name"
    DATA :w_list_top_of_page      TYPE slis_t_listheader,
          w_kwmeng                TYPE vbap-kwmeng      ,
          w_meins                 TYPE t006-msehi       ,
          w_zmein                 TYPE t006-msehi       ,
          w_repid                 TYPE sy-repid         ,
          w_zmenge                TYPE vbap-kwmeng      ,
          w_events                TYPE slis_t_event     ,
          w_datum                 TYPE sy-datum         ,
          w_umrez1                TYPE marm-umrez       ,
          w_umren1                TYPE marm-umren       ,
          w_umrez2                TYPE marm-umrez       ,
          w_umren2                TYPE marm-umren       ,
          w_text(25)              TYPE c                .
                              GLOBAL STRUCTURES
                        naming convention: "st_name"
    DATA:st_vbak  TYPE ty_vbak  ,
         st_vbap  TYPE ty_vbap  ,
         st_vbpa  TYPE ty_vbpa  ,
         st_makt  TYPE ty_makt  ,
         st_t023t TYPE ty_t023t ,
         st_knasl TYPE  ty_kna1 ,
         st_knash TYPE  ty_kna1 ,
         st_vbuk  TYPE  ty_vbuk ,
         st_final TYPE ty_final .
    DATA:st_fieldcat    TYPE slis_fieldcat_alv ,
         st_layout      TYPE slis_layout_alv   .
                           GLOBAL INTERNAL TABLES
                         naming convention: "i_name"
    DATA:i_vbak  TYPE TABLE OF ty_vbak  ,
         i_vbap  TYPE TABLE OF ty_vbap  ,
         i_vbuk  TYPE TABLE OF ty_vbuk  ,
         i_vbpa  TYPE TABLE OF ty_vbpa  ,
         i_makt  TYPE TABLE OF ty_makt   ,
         i_t023t TYPE TABLE OF ty_t023t ,
         i_knasl TYPE TABLE OF ty_kna1  ,
         i_knash TYPE TABLE OF ty_kna1  ,
         i_final TYPE TABLE OF ty_final .
    DATA:i_fieldcat    TYPE slis_t_fieldcat_alv ,
         i_variant     TYPE disvariant          .
    DEFINE m_fieldcat.
      add 1 to st_fieldcat-col_pos.
      st_fieldcat-fieldname   = &1.
      st_fieldcat-ref_tabname = &2.
      st_fieldcat-seltext_s   = &3.
      st_fieldcat-seltext_l   = &4.
      st_fieldcat-datatype    = &5.
      append st_fieldcat to i_fieldcat.
    END-OF-DEFINITION.
                          PARAMETERS & SELECT-OPTIONS
                     aming convention: "p_name" & "s_name"
    SELECTION-SCREEN  BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    *SELECT-OPTIONS : s_vkorg    FOR  vbak-vkorg  OBLIGATORY,
                    s_vtweg    FOR  vbak-vtweg  OBLIGATORY,
                    s_kunrsl   FOR  vbak-kunnr            ,
                    s_kunrsh   FOR  vbpa-kunnr            ,
                    s_matnr    FOR  vbap-matnr            ,
                    s_auart    for  vbak-auart            . "DRFK904686
                 s_datum    FOR  sy-datum  OBLIGATORY DEFAULT sy-datum."DRFK904686
    SELECT-OPTIONS : s_vkorg    FOR  tvko-vkorg  OBLIGATORY,
                     s_vtweg    FOR  tvtw-vtweg  OBLIGATORY,
                     s_kunrsl   FOR  kna1-kunnr            ,
                     s_kunrsh   FOR  kna1-kunnr            ,
                     s_matnr    FOR  mara-matnr            ,
                     s_auart    FOR  tvak-auart            .    "DRFK904686
    PARAMETERS:   p_meins TYPE vbap-meins.
    SELECTION-SCREEN  END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-006 FOR FIELD p_var.
    PARAMETERS: p_var TYPE disvariant-variant.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b5.
                              INITIALIZATION
    INITIALIZATION.
    Report id assigned to Global variable
      w_repid = sy-repid.
    EVENTS TABLE BUILD
      PERFORM f_eventtab_build USING w_events[].
    Processing of listheader
      PERFORM f_comment_build  USING w_list_top_of_page[].
      CLEAR i_variant.
      i_variant-report = sy-repid.
    Read default display variant (description only, w/o field catalog)
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = c_a
        CHANGING
          cs_variant = i_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc EQ 0.
        p_var = i_variant-variant.
      ENDIF.
    Start of addition DRFK904686
                          AT SELECTION-SCREEN ON s_vkorg
    Sales Organisation
    AT SELECTION-SCREEN ON s_vkorg.
      PERFORM f_validate_vkorg.
                          AT SELECTION-SCREEN ON s_vtweg
    Distribution Channel
    AT SELECTION-SCREEN ON s_vtweg.
      PERFORM f_validate_vtweg.
                          AT SELECTION-SCREEN ON s_kunrsl
    Sold-to-party
    AT SELECTION-SCREEN ON s_kunrsl.
      IF NOT s_kunrsl[] IS INITIAL.
        PERFORM f_validate_cust.
      ENDIF.
                          AT SELECTION-SCREEN ON s_kunrsh
    Ship-to-party
    AT SELECTION-SCREEN ON s_kunrsh.
      IF NOT s_kunrsh[] IS INITIAL.
        PERFORM f_validate_shipto.
      ENDIF.
                          AT SELECTION-SCREEN ON s_matnr
    Material Number
    AT SELECTION-SCREEN ON s_matnr.
      IF NOT s_matnr[] IS INITIAL.
        PERFORM f_validate_matnr.
      ENDIF.
                          AT SELECTION-SCREEN ON s_auart
    Order Type
    AT SELECTION-SCREEN ON s_auart.
      IF NOT s_auart[] IS INITIAL.
        PERFORM f_validate_auart.
      ENDIF.
    End of addition DRFK904686
                   AT SELECTION-SCREEN ON VALUE-REQUEST
    F4 for Layout Variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
      PERFORM f_get_alv_variant CHANGING p_var.
                          AT SELECTION-SCREEN ON
    Validate Layout Variant
    AT SELECTION-SCREEN ON p_var.
      IF NOT p_var IS INITIAL.
        PERFORM f_check_alv_variant USING p_var.
      ENDIF.
                               START-OF-SELECTION
    START-OF-SELECTION.
    begin of changes DRFK904686
      PERFORM f_fetch_vbuk.
      PERFORM f_fetch_vbak.
    *perform to fetch the data from vbuk.
    *perform to fetch the data from vbak.
    PERFORM f_fetch_vbak.
    *perform to fetch the data from vbuk.
    PERFORM f_fetch_vbuk.
    end of changes DRFK904686
    *perform to fetch the data from vbpa.
      PERFORM f_fetch_vbpa.
    *perform to fetch the data from vbap.
      PERFORM f_fetch_vbap.
    *perform to fetch the material description.
      PERFORM f_fetch_makt.
    *perform to fetch the material group description.
      PERFORM f_fetch_t023t.
    *perform to fetch the customer name
      PERFORM f_fetch_knasl.
    *perform to fetch the customer name
      PERFORM f_fetch_knash.
    *perofrm to move the data into final table
      PERFORM f_move_final.
    Finding no of entries in Internal Table
      IF LINES( i_final ) EQ 0.
        MESSAGE s000 WITH 'No documents found for the  selection criteria'(019).
        EXIT.
      ENDIF.
    *perform for fieldcatalog building
      PERFORM f_build_fieldcat.
    *perform to display the list
      PERFORM f_list_dispaly.
    *&      Form  f_validate_vkorg
          text
         -->P_S_VKORG  text
    FORM f_validate_vkorg.
      SELECT vkorg
         FROM tvko
         UP TO 1 ROWS
         INTO tvko-vkorg
       WHERE vkorg IN s_vkorg.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Sales Organization is invalid'(033).
      ENDIF.
    ENDFORM.                    " f_validate_vkorg
    *&      Form  f_validate_vtweg
          text : This form is used to validate the Distribution Channel
    FORM f_validate_vtweg.
      SELECT vtweg
            FROM tvtw
            UP TO 1 ROWS
            INTO tvtw-vtweg
          WHERE vtweg IN s_vtweg.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Distribution Channel is invalid'(032).
      ENDIF.
    ENDFORM.                    " f_validate_vtweg
    *&      Form  f_validate_cust
          text: This form is used to validate the Sold-to party .
    FORM f_validate_cust.
      SELECT kunnr
             FROM kna1
             UP TO 1 ROWS
             INTO kna1-kunnr
           WHERE kunnr IN s_kunrsl.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Customer is invalid'(034).
      ENDIF.
    ENDFORM.                    " f_validate_cust
    *&      Form  f_validate_shipto
           text: This form is used to validate the Ship-to party .
    FORM f_validate_shipto.
      SELECT kunnr
             FROM kna1
             UP TO 1 ROWS
             INTO kna1-kunnr
           WHERE kunnr IN s_kunrsh.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Ship-to party is invalid'(035).
      ENDIF.
    ENDFORM.                    " f_validate_shipto
    *&      Form  f_validate_matnr
          text: This form is used to validate material.
    FORM f_validate_matnr .
      SELECT matnr
        FROM mara
        UP TO 1 ROWS
        INTO mara-matnr
      WHERE matnr IN s_matnr.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Material is invalid'(036).
      ENDIF.
    ENDFORM.                    " f_validate_matnr
    *&      Form  f_validate_auart
          text: This form is used to validate Order Type
    FORM f_validate_auart .
      SELECT auart
          FROM tvak
          UP TO 1 ROWS
          INTO tvak-auart
        WHERE auart IN s_auart.
      ENDSELECT.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH 'Order Type is invalid'(037).
      ENDIF.
    ENDFORM.                    " f_validate_auart
    *&      Form  sub_get_alv_variant
          To display variant selection dialog box
    FORM f_get_alv_variant  CHANGING p_layvar TYPE disvariant-variant.
      CLEAR i_variant.
      DATA lw_exit(1) TYPE c.
      i_variant-report   = sy-repid.
      i_variant-username = sy-uname.
    Display variant selection dialog box
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = i_variant
          i_save        = c_a
        IMPORTING
          e_exit        = lw_exit
          es_variant    = i_variant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc EQ 0.
        IF lw_exit IS INITIAL.
          p_layvar = i_variant-variant.
        ENDIF.
      ELSE.
        MESSAGE i000 WITH 'No display variants found'(007).
      ENDIF.
    ENDFORM.                    " sub_get_alv_variant
    *&      Form  sub_check_alv_variant
          to check whether a display variant exists
    FORM f_check_alv_variant  USING p_layvar TYPE disvariant-variant.
      CLEAR i_variant.
      i_variant-report   = sy-repid.
      i_variant-username = sy-uname.
      IF p_layvar NE space.
        MOVE p_layvar TO i_variant-variant.
    Checks whether a display variant exists
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
          EXPORTING
            i_save     = c_a
          CHANGING
            cs_variant = i_variant.
      ENDIF.
    ENDFORM.                    "f_check_alv_variant
    " sub_check_alv_variant
    *&      Form  f_fetch_vbak
    from to fetch sales org, dis chanel,sales group sold to party from vbak
    FORM f_fetch_vbak .
    *{ begin of change DRFK904686
      IF i_vbuk IS NOT INITIAL.
        SELECT vbeln
               auart
               vkorg
               vtweg
               vkgrp
               bstnk
               kunnr
          FROM vbak
          INTO TABLE i_vbak
             FOR ALL ENTRIES IN i_vbuk
         WHERE vbeln EQ i_vbuk-vbeln
           AND auart IN s_auart
           AND vkorg IN s_vkorg
           AND vtweg IN s_vtweg
           AND kunnr IN s_kunrsl  .
    end of change DRFK904686 }
        IF sy-subrc EQ 0.
          SORT i_vbak BY vbeln.
        ELSE.
          MESSAGE s000 WITH 'No documents found for the  selection criteria'(019).
          EXIT.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f_fetch_vbak
    *&      Form  f_fetch_vbuk
      from to fetch open sales doc from vbuk
    FORM f_fetch_vbuk .
    IF i_vbak IS NOT INITIAL.
       SELECT vbeln
         FROM vbuk
         INTO TABLE i_vbuk
          FOR ALL ENTRIES IN i_vbak
        WHERE vbeln EQ i_vbak-vbeln
          AND ( lfstk NE 'C'
          OR    fkstk NE 'C' ) .
      SELECT vbeln
             lfstk               
             lfgsk       
             fkstk            FROM vbuk
        INTO TABLE i_vbuk
       WHERE ( ( lfstk EQ 'A'
         OR lfstk EQ 'B')
         OR (  fkstk EQ 'A'
         OR    fkstk EQ 'B' ) ) .
    ENDIF.
    ENDFORM.                    " f_fetch_vbuk
    *&      Form  f_fetch_vbpa
         from to fetch ship to party from vbpa
    FORM f_fetch_vbpa .
      IF i_vbak IS NOT INITIAL.
        SELECT vbeln
               kunnr
          FROM vbpa
          INTO TABLE i_vbpa
           FOR ALL ENTRIES IN i_vbak
         WHERE vbeln EQ i_vbak-vbeln
           AND kunnr IN s_kunrsh
           AND parvw EQ c_sh.
      ENDIF.
    ENDFORM.                    " f_fetch_vbpa
    *&      Form  f_fetch_vbap
      from to fetch sales doc, mat no, mat group,order UOM from vbap
    FORM f_fetch_vbap .
      IF i_vbpa IS NOT INITIAL.
        SELECT vbeln
               posnr
               matnr
               matkl
               kwmeng
               vrkme
               zmeng
               zieme
               netwr
               netpr
          FROM vbap
          INTO TABLE i_vbap
           FOR ALL ENTRIES IN i_vbpa
         WHERE vbeln EQ i_vbpa-vbeln
           AND matnr IN s_matnr.
      ENDIF.
    ENDFORM.                    " f_fetch_vbap
    *&      Form  f_fetch_makt
    form to fetch the material description
    FORM f_fetch_makt .
      IF i_vbap IS NOT INITIAL.
        SELECT
            matnr
            maktx
       FROM makt
          INTO TABLE i_makt
           FOR ALL ENTRIES IN i_vbap
         WHERE matnr EQ i_vbap-matnr
           AND spras EQ c_en.
      ENDIF.
    ENDFORM.                    " f_fetch_makt
    *&      Form  f_fetch_t023t
       form to fetch the material group description
    FORM f_fetch_t023t .
      IF i_vbap IS NOT INITIAL.
        SELECT
            matkl
            wgbez
       FROM t023t
          INTO TABLE i_t023t
           FOR ALL ENTRIES IN i_vbap
         WHERE spras EQ c_en
           AND matkl EQ i_vbap-matkl.
      ENDIF.
    ENDFORM.                    " f_fetch_t023t
    *&      Form  f_fetch_kna1
       form to fetch the sold to customer name
    FORM f_fetch_knasl .
      IF i_vbak IS NOT INITIAL.
        SELECT
            kunnr
            name1
       FROM kna1
          INTO TABLE i_knasl
           FOR ALL ENTRIES IN i_vbak
         WHERE kunnr EQ i_vbak-kunrsl.
      ENDIF.
    ENDFORM.                    " f_fetch_kna1
    *&      Form  f_fetch_knash
       form to fetch the ship to customer name
    FORM f_fetch_knash .
      IF i_vbpa IS NOT INITIAL.
        SELECT
            kunnr
            name1
       FROM kna1
          INTO TABLE i_knash
           FOR ALL ENTRIES IN i_vbpa
         WHERE kunnr EQ i_vbpa-kunrsh.
      ENDIF.
    ENDFORM.                    " f_fetch_knash
    *&      Form  f_move_final
    form for moving all the fields into the final internal table for
    *dispalying the final output.
    FORM f_move_final .
      SORT : i_vbak  BY vbeln,
             i_vbpa  BY vbeln,
             i_makt  BY matnr,
             i_t023t BY matkl,
             i_knasl BY kunnr,
             i_vbuk  BY vbeln,
             i_knash BY kunnr.
    *looping at i_vbap and moving mat no,mat group,quantity and
    *UOM into final table.
      LOOP AT i_vbap INTO st_vbap.
        IF st_vbap-kwmeng IS INITIAL.
          st_vbap-kwmeng = st_vbap-zmeng.
          st_vbap-vrkme  = st_vbap-zieme.
        ENDIF.
        MOVE: st_vbap-matnr  TO st_final-matnr,
              st_vbap-matkl  TO st_final-matkl,
              st_vbap-kwmeng TO st_final-kwmeng,
              st_vbap-netwr  TO st_final-netwr,
              st_vbap-vrkme  TO st_final-vrkme.
        IF p_meins IS INITIAL.
          MOVE:st_vbap-vrkme  TO st_final-zmein ,
               st_vbap-kwmeng TO st_final-zmenge.
        ELSE.
          CLEAR : w_kwmeng,
                  w_meins,
                  w_zmein.
    *Order Quantity
          w_kwmeng = st_vbap-kwmeng.
    *Order Unit
          w_meins = st_vbap-vrkme.
    *Report Unit
          w_zmein = p_meins.
          CLEAR : w_umrez1,
                  w_umren1,
                  w_umrez2,
                  w_umren2.
          SELECT SINGLE umrez
                        umren
                  INTO (w_umrez1,
                        w_umren1)
                   FROM marm
                  WHERE matnr EQ st_vbap-matnr
                    AND meinh EQ w_meins.
          SELECT SINGLE umrez
                        umren
                  INTO (w_umrez2,
                        w_umren2)
                   FROM marm
                  WHERE matnr EQ st_vbap-matnr
                    AND meinh EQ w_zmein.
          IF w_umrez1 IS NOT INITIAL AND w_umren2 IS NOT INITIAL.
            w_zmenge = w_kwmeng * ( w_umren1 / w_umrez1 ) * ( w_umrez2 / w_umren2 ).
        update new report unit and quantity
            MOVE p_meins  TO st_final-zmein.
            MOVE w_zmenge TO st_final-zmenge.
          ELSE.
       if failed to convert update report unit and quantity with order values
            MOVE st_vbap-vrkme TO st_final-zmein.
            MOVE st_vbap-kwmeng TO st_final-zmenge.
          ENDIF.
        ENDIF.
    Start of changes DRFK904686
    To get the delivery, overall and billing status
        CLEAR st_vbuk.
        READ TABLE i_vbuk INTO st_vbuk
                    WITH KEY vbeln = st_vbap-vbeln
                    BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE : st_vbuk-lfstk TO st_final-lfstk,
                 st_vbuk-lfgsk TO st_final-lfgsk,
                 st_vbuk-fkstk TO st_final-fkstk.
        ENDIF.
    End of changes DRFK904686
    *reading i_vbak and moving sales doc,sales org,dist chanel,
    *sales group,and sold to party into the final internal table
        CLEAR st_vbak.
        READ TABLE i_vbak
              INTO st_vbak
          WITH KEY vbeln = st_vbap-vbeln
          BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE: st_vbak-vbeln  TO st_final-vbeln ,
                st_vbak-vkorg  TO st_final-vkorg ,
                st_vbak-vtweg  TO st_final-vtweg ,
                st_vbak-vkgrp  TO st_final-vkgrp ,
                st_vbak-auart  TO st_final-auart ,
                st_vbak-bstnk  TO st_final-bstnk , "DRFK904686(+)
                st_vbak-kunrsl TO st_final-kunrsl.
        ENDIF.
    *reading i_vbpa and moving ship to party to the final internal table
        CLEAR st_vbpa.
        READ TABLE i_vbpa
              INTO st_vbpa
          WITH KEY vbeln = st_vbap-vbeln
          BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE st_vbpa-kunrsh TO st_final-kunrsh.
        ENDIF.
    *reading i_makt and moving material description to the final table
        CLEAR st_makt.
        READ TABLE i_makt
                  INTO st_makt
              WITH KEY matnr = st_vbap-matnr
              BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE st_makt-maktx TO st_final-maktx.
        ENDIF.
    *reading i_t023t
        CLEAR st_t023t.
        READ TABLE i_t023t
                  INTO st_t023t
              WITH KEY matkl = st_vbap-matkl
              BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE st_t023t-wgbez TO st_final-wgbez.
        ENDIF.
    *READINGI_KNASL
        CLEAR st_knasl.
        READ TABLE i_knasl
                  INTO st_knasl
              WITH KEY kunnr = st_final-kunrsl
              BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE st_knasl-name1 TO st_final-name1.
        ENDIF.
    *READINGI_KNASH
        CLEAR st_knash.
        READ TABLE i_knash
                  INTO st_knash
              WITH KEY kunnr = st_final-kunrsh
              BINARY SEARCH.
        IF sy-subrc EQ 0.
          MOVE st_knash-name1 TO st_final-name2.
        ENDIF.
        APPEND st_final TO i_final.
        CLEAR st_final.
      ENDLOOP.
    ENDFORM.                    " f_move_final
    *&      Form  f_build_fieldcat
    form for building the field catalog
    FORM f_build_fieldcat .
      m_fieldcat 'VKORG'   'VBAK'   'Sales Organisation'(004)   'Sales Organisation'(004)                     ' '.
      m_fieldcat 'VTWEG'   'VBAK'   'Distribution Channel'(005) 'Distribution Channel'(005)                   ' '.
      m_fieldcat 'VKGRP'   'VBAK'   'Sales Group'(008)          'Sales Group'(008)                            ' '.
      m_fieldcat 'VBELN'   'VBAK'   'Sales Document'(009)       'Sales Document'(009)                         ' '.
      m_fieldcat 'AUART'   'VBAK'   'Order Type'(026)           'Order Type'(026)                             ' '.
      m_fieldcat 'BSTNK'   'VBAK'   'PO number'(031)            'PO number'(031)                              ' '.
      m_fieldcat 'KUNRSL'  'VBAK'   'Sold to Party'(010)        'Sold to Party'(010)                          ' '.
      m_fieldcat 'NAME1'   'KNA1'   'Name Sold to'(020)         'Name Sold to'(020)                           ' '.
      m_fieldcat 'KUNRSH'  'VBPA'   'Ship to Party'(011)        'Ship to Party'(011)                          ' '.
      m_fieldcat 'NAME2'   'KNA1'   'Name Ship to'(022)         'Name Ship to'(022)                           ' '.
      m_fieldcat 'KWMENG'  'VBAP'   'Order Quantity'(012)       'Order Quantity'(012)                 'QUAN '(014).
      m_fieldcat 'VRKME'   'VBAP'   'Order UOM'(017)            'Order UOM'(017)                               ' '.
      m_fieldcat 'ZMENGE'  'VBAP'   'Report Quantity'(013)      'Report Quantity'(013)                'QUAN '(014).
      m_fieldcat 'ZMEIN'   'VBAP'   'Report UOM'(018)           'Report UOM'(018)                              ' '.
      m_fieldcat 'NETWR'   'VBAP'   'Net value'(030)            'Net value'(030)                               ' '.
    m_fieldcat 'MATKL'   'VBAP'   'Material Group Description'(023)    'Material Group Description'(023)    ' '. "DRFK904686(-)
    m_fieldcat 'WGBEZ'   'T023T'  'Material Group'(015)       'Material Group'(015)                         ' '. "DRFK904686(-)
      m_fieldcat 'MATKL'   'VBAP'   'Material Group'(015)       'Material Group'(015)                          ' '. "DRFK904686(+)
      m_fieldcat 'WGBEZ'   'T023T'  'Material Group Description'(023)    'Material Group Description'(023)     ' '. "DRFK904686(+)
      m_fieldcat 'MATNR'   'VBAP'   'Material Number'(016)      'Material Number'(016)                         ' '.
      m_fieldcat 'MAKTX'   'MAKT'   'Materia Description'(024)  'Material Description'(025)                    ' '.
    Begin of addition DRFK904686
      m_fieldcat 'LFSTK'   'VBUK'   'Delivery status'(027)         'Delivery status'(027)  'DelStat'           .
      m_fieldcat 'LFGSK'   'VBUK'   'Overall delivery status'(028) 'Overall delivery status'(028)              ' '.
      m_fieldcat 'FKSTK'   'VBUK'   'Billing status'(029)          'Billing status'(029)                       ' '.
    End of addition DRFK904686
    ENDFORM.                    " f_build_fieldcat
    *&      Form  f_list_dispaly
    form for displaying the final output in the Alv grid
    FORM f_list_dispaly .
      st_layout-cell_merge        = 'X'.
      st_layout-colwidth_optimize = 'X'.
    To display the required data
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_buffer_active    = 'X'
          i_callback_program = w_repid
          is_layout          = st_layout
          it_fieldcat        = i_fieldcat[]
          i_save             = 'A'
          is_variant         = i_variant
          it_events          = w_events[]
        TABLES
          t_outtab           = i_final.
    ENDFORM.                    " f_list_dispaly
    " f_EVENTTAB_BUILD
          FORM F_DISPLAY_TOP_OF_PAGE                                    *
    *form for providing the report heading                                *
            event     TOP_OF_PAGE                                       *
    FORM f_display_top_of_page.                                 "#EC CALLED
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = w_list_top_of_page.
    ENDFORM.                    "DISPLAY_TOP_OF_PAGE
    *&      Form  f_EVENTTAB_BUILD
            Ereignistabelle Bilden
            EVENTS TABLE BUILD
         -->U_ER_EVENTS[]  text
    FORM f_eventtab_build USING p_u_er_events TYPE slis_t_event.
      FIELD-SYMBOLS: <fs_event> TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_u_er_events.
      READ TABLE p_u_er_events WITH KEY name = slis_ev_top_of_page
                             ASSIGNING <fs_event>.
      IF sy-subrc = 0.
        <fs_event>-form = c_formname_top_of_page.
      ENDIF.
    ENDFORM.                               " f_EVENTTAB_BUILD
    *&      Form  F_COMMENT_BUILD
           Bearbeitung des Listenkopfes
           Processing of listheader
         -->U_ER_LIST_TOP_OF_PAGE[]  text
    FORM f_comment_build USING u_er_list_top_of_page TYPE slis_t_listheader.
      DATA: lw_line TYPE slis_listheader.
    Type H
      CLEAR lw_line.
      lw_line-typ  = 'H'.
    Daily Historical Volume
      lw_line-info = text-003.
      APPEND lw_line TO u_er_list_top_of_page.
    Type S
      CLEAR lw_line.
      lw_line-typ  = 'S'.
    Run Date - Sy-datum
      WRITE sy-datum TO w_datum MM/DD/YY .
      CONCATENATE text-021 w_datum INTO w_text.
      lw_line-info = w_text.
      APPEND lw_line TO u_er_list_top_of_page.
    ENDFORM.                               " COMMENT_BUILD
    Reward the points for useful answers.

  • How to compare sale order bom and production order bom.

    i would like to provide report with respect to comparation of sale order bom and production order bom, but i am not familiar with SD and PP, can anyone give me some clue? i only know sale order bom is created via 'CS61', afterwards run mrp to get production order, the process appears complicated, i needn't know the process detail, just want to know how to get sale order bom and relative production order bom. please guide me.

    Hi,
    Check Tcode:CS14 to SD/PP BOM's
    Chidambaram

  • How to put Sales employee (Splcode) Mandatory Field, when adding A/R invoice

    Hi,
    Kindly solve, How to put Sales employee (Splcode) Mandatory Field, when adding A/R invoice.
    Regards,
    Rajeev.

    Follow this step..
    1. In SQL Server, go to the SAP B1 Database you're using. 
    2. then on the Object Explorer , go to Database Folder, explode the SAP DB->Programmability->Stored Procedures->SBO_SP_TransactionNotification * the only Stored Procedure that is allowed to be edited. Just right click and modify
    3.  Try to paste this -> and click F5
    If
    @object_type ='13' and @transaction_type in ('A','U')
    Begin
    If EXISTS
    select DocEntry from ONIV
    Where DocEntry = @list_of_cols_val_tab_del
    and  SlpCode<>'-1'
    Begin
    set @error_message = 'Please select the Sales Employee'
    set @error = 1
    END
    END
    Regards
    Kennedy

  • WMS :  How to Process Sales Order Released before Turning on WMS

    Hello Gurus,
    How to process sales orders released before WMS enable flag is turned on in the  new WMS enviournment in Oracle 11.5.10 ?

    Helios,
    Thanks for the document.
    I m looking for how to perform Pick confirm transactions for already printed Pick slips before WMS enabled flag is turn on for the org.
    One option is to close all the deliveries  but if there is no on hand at that point the they will remain option.
    Other option is to Back order those deliveries and re release them post wms enable flag is turned on... The only issue i see here is that if there are more new orders for one of the items  and the orders are released then which orders will get allocated/reserved if there is limited on hand quantity to statisfy the SO need.
    Let me know if you can think off some alternative solution.
    Apprecite help !!
    Thanks,
    Sam

  • How to create sales order Automatically with reference to contract?

    how to create sales order automatically through batch or online? can anyone please suggest what needs to be change in SAPMV45A program?

    Hi,
    Wt am able to understand from the above question is, you want to create automatic sales order against contract on a day to day basis by doing batch program, hope am wright.
    See you can do it in two ways.
    1. By using BDC, in SHDB T code record how exactly you will do transaction and then give it to your abaper rest he will do. he will write a program and he will schedule that program every day night.
    2. By using BAPI. Just check in there are many threads are there which gives sales order bapi. Tell your abaper to map that bapi and tell them to schedule back ground job.
    Hope this will help out in solving your problem.
    Regards,
    Nagesh

  • How to list Sales Order with credit block

    Hi, Gurus,
    I really don't know how to list sales orders with credit block?
    Is there any way for end user to do it?
    If so, is it possible to list SO with credit block for certain period of time such as one month?
    Any help would be appreciated.

    HI
    Check T-Code VKM2 (Released documents)
    You need to check VKM1 (Blocked Documents)
    Sorry before i gave wrong information , myself i corrected VKM2 for released not for blocked list (Due to non Availability of SAP access )
    Regards,
    Prasanna
    Edited by: prasanna_sap on Feb 7, 2012 7:12 AM

  • How to print sales order acknowledgement while printing purchase order

    how to print sales order acknowledgement while printing corresponding purchase order
    in me22n

    in print program of Purchase order.. try to trigger output for Order Ack. as well...
    Order acknowledgement

  • How to find sales order no., purchase order no. using sales order ID,PO ID

    hi,
    how to find sales order no., purchase order no. using sales order ID,PO ID
    Thank you,
    hari om

    Dear Hari Om,
    Could you please tell me, to what are you referring Sales Order ID and P.O. ID?
    meanwhile check with:
    T. Code: SE16
    Table: VBKD
    Execute (F8) the Report.
    On to next Screen, Go to Menu-bar
    Settings --> Format_Lists --> Choose Fields
    Field: VBELN - Sales Order
    Field: BSTKD - Purchase Order No.
    Best Regards,
    Amit

  • How to search sales order

    Hie Guys,
    Can anyone plz help me how to search sales order in SRM.
    I worked on CRM but it looks to be new applcation.. also kindly suggest me sme basic transactions..
    Many thanks!
    Regards,
    Dinesh.

    Hi Dinesh,
    in SRM we don't have sales order, but for the basic transctions please see the thread:
    https://forums.sdn.sap.com/click.jspa?searchID=26421773&messageID=4950023
    Regards,
    Peter

  • How to cancel sales order which I placed?

    How to cancel sales order which I placed? And this order had not been delivered.

    Rejection SO & Cancellation SO both are same. So please follow the below steps-
    1. Use Tcode VA02
    2. Enter Sales order number which you want to cancel.
    3. Click "enter"
    4. Click the icon "Reject Document"
    5. Select suitable u2018Reason for rejectionu2019.
    6. Save
    Many Thanks & Regards,
    Susanta K Senapati

  • How to create sale order step by step

    Hi all,
    I am new in SAP SD and how to create sale order. Please give step by step guid for this please.
    Thanks,
    Suresh.

    Please go through the forum rules.  First you have to search the forum to find answers to your queries.  If it is not there, then you can very well post the same.
    thanks
    G. Lakshmipathi

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • How to block sale order

    Hi
         Can anybody clarify me how to block sale order at material level (One sale order for no. of materials).  While searching for it got solution using XD05 Tcode which blocks at customer level. For my scenario one customer having more than one material.  How to block it?
    Regards,
    K.V.Manikandan

    HI,
    Listing and exclusion functionality are used to block customer for particular material which is readily available in standard SAP.Use standard exclusion type B001 and create condition record for all customer material combination for which you want to block the customer,
    Path: Spro-IMG-Sales and distribution-basc function-listing and exclusion:
    Second way:  You can also block particular customer at sales area level by assign 01 at sales org level against field "DChain-spec. status'
    This will resolve your problem if you want to block the material for particular customer.
    Regards
    Jitendra singh

  • How to configure Sales order item text copy to Purchase requisition item

    Hi,
    How to configure sales order item text copy to Purchase requisition text then copy to PO item text.
    Regards
    Jack

    Hi Rajesha,
    Thanks for your reply, some of the items in sales order are procured externally by us and our customer maintains text related to price and specification in the item details of the sales order, MRP creates planned order for these materials and these planned orders are always converted in pur requisition, we want that text from the sales order item details should be copied in to the purchase requisitions converted from planned orders.
    is there any user exit which can be called at the time of saving a purchase req or user exit for converting planned order in to pur req.?
    if there is any such exit available, then I think I can read the pegged requirement of the planned order where sales order item will be found then read the text in the item then copy this text in pur req then save pur req may work.
    but this will be a bulky development, please let me know if we can shorten the development.
    Thanks again
    Anand

Maybe you are looking for