Userexit_move_field_to_vbkd

Hi,
I have created a sales order with one material.
Now in sales order change mode I'm going to add one more material, at that time it is throwing an error userexit_move_field_to_vbkd .
This is regarding Update Termination .
Can any one suggest me the solution for the same ?
Regards,
Vikas

HI Vikas,
If my understand is correct ur question is in VA02 after ading one more line item is throwing an error in "userexit_move_field_to_vbkd ".
In STD function support this, you can add line items in change mode. Where as in your case, check with your ABAPer any code has written in "userexit_move_field_to_vbkd ".
if any code has written then comment that and check with STD program, if it works fine then the problem with code only..
Regards,
Nagesh

Similar Messages

  • Userexists (MV45AFZZ - FORM USEREXIT_MOVE_FIELD_TO_VBKD.)

    Hi Gurus,
    The requirements is as like below and plead guide me where i am doing mistake in below coiding.
    If sales order required delivery date (VBAK-VDATU) is LT Document create date7days(SY-DATUM7) and next condition is
    item required delivery date (VBEP-EDATU) is LT the Document create date 7days(SY-DATUM7)
    then we need to move '0001' TO VBKD-ZTERM(Payment terms)
    ELSE move the payments terms as in the customer master (kurgv-zterm).
    now i am getting the error as :
    Header business data does not apply ti item 000020.
    Please find the code below and guide me where i am doing mistake.
    Ihad coded in program : MV45AFZZ ---> FORM USEREXIT_MOVE_FIELD_TO_VBKD.
    DATA: chk_date  TYPE vbep-edatu.
          CLEAR chk_date.
          chk_date = sy-datum + 7.
          CHECK : NOT vbak-vdatu IS INITIAL.
        IF vbak-vdatu < chk_date.
           CHECK : NOT vbap-posnr IS INITIAL.
           CHECK : NOT vbep-edatu IS INITIAL.
           IF vbep-edatu < chk_date.
              vbkd-zterm = '0001'.
           ELSE.
              vbkd-zterm = kurgv-zterm.
           ENDIF.
        ENDIF.
    Please let me know if my questin is not clear ...
    please reply me and i will give full points.
    Thanks in advance
    Srinivas....
    Edited by: Srinivas on Aug 22, 2008 12:39 AM

    When the user exits an external session (/i in the command field), the corresponding ABAP memory is automatically initialized or released.
    IMPORT/EXPORT to memory id uses ABAP memory.So, when user comes out of the transaction screen without saving, the data in the internal table will wipe out.
    Problem : Suppose the user doesnt save the order and come out , the record remains in the exported table and doesnt display popup .
    I think u won't have this problem.
    G@urav.

  • Userexit_move_field_to_vbkd effects when run via BAPI_SALESORD_CHANGE

    Hi developers,
                 I have the following problem.
    I implemented the user exit "userexit_move_field_to_vbkd" in "MV45AFZZ" to set the field VBKD-VALDT when I use "VA02" transaction. It works fine when I edit
    the sales order using the transaction, but when I edit it via "BAPI_SALESORD_CHANGE" it does not work.
    I mean: the source code that sets the value of the field is run and fills the internal table xvbkd with
    the right field value (the same found out when using the transaction), but it has no effects. When I display the order (using VA03) the field is blank (let me tell you I
    use BAPI_TRANSACTION_COMMIT after I call the bapi to edit the order.)
    Have you got any ideas?
    Thanx to all of you

    User exits should work as they work in regular transactions. Did you add a new Z field to the structure and moving the value in the user exit? If so, you may need to use the  EXTENSIONIN structure. Here is the documentation related to it.
    Customer Enhancement for VBAK, VBAP, VBEP
    Description
    You can use this parameter to transfer user-specific enhancments to a BAPI. The customer has to complete the EXTENSION structure and the system automatically continues processing it. If you have not defined any user-specific fields, then you can transfer a blank EXTENSIONIN structure.
    Technical information about Customer Enhancements
    The following description uses an example to explain how to proceed with customer enhancements to the SD tables VBAK, VBKD, VBAP and VBEP.
    The customer has added their own fields to table VBAP using the INCLUDE structure CUTEST. This structure contains 2 fields:
    CFIELD1, CHAR 10
    CFIELD2, CHAR 3.
    The customer also requires that these two fields can be maintained with the BAPI.
    1. Maintain structure CUTEST in table VBAP
    2. Because the BAPIs work with checkboxes, you must also define a CUTESTX checkbox for the customer structure. It should be structured like this:
    Field name       Data element
    CFIELD1            CHAR1
    CFIELD2          CHAR1
    3. Define these customer structures in the structures VBAPKOZ und VBAPKOZX using INCLUDE or APPEND.
    4. Add the customer structures to the BAPE_VBAP and BAPE_VBAPX BAPI structures using the APPEND technique.
    5. Adjust the following structures for customer enhancements to table VBAK:
    a) VBAKKOZ
    b) VBAKKOZX
    c) BAPE_VBAK
    d) BAPE_VBAKX
    6. Adjust the following structures for customer enhancements to table VBEK:
    a) VBEPKOZ
    b) VBEPKOZX
    c) BAPE_VBEP
    d) BAPE_VBEPX
    7. Generally, the data should be added to the BAPI interface in the internal communication structures (VBAKKOM, and so on). There, you can process the data in the SD tables (VBAK, and so on).
    8. If the EXTENSIONIN parameter contains customer data, you must complete at least the key fields in the relevant standard parameters.
    For example:
    You want to change customer field VBAP-CFIELD2 for item 20 to "XYZ" in order 4711.
    The following entries are expected:
    Import:     BAPIVBELN-VBELN       = '0000004711'  Document number
                BAPISDHD1X-UPDATEFLAG = 'U'           UPDKZ for doc header
    Tables:     BAPISDITM-ITM_NUMBER  = '000020'      Item number
                BAPISDITMX-ITM_NUMBER = '000020'      Item number
              + BAPISDITMX-UPDATEFLAG = 'U'           UPDKZ for item
    You must complete the EXTENSION table as follows:
    STRUCTURE                          VALUEPART1       1234561234567890123
    BAPE_VBAP                       0000004711000020                 XYZ
    BAPE_VBAPX                      0000004711000020       X
    Further Information
    You can find more information in the BAPI programming guide in the chapter for enhancements to BAPIs.
    Notes
    You must complete the STRUCTURE field with the name of the relevant enhancement structure (BAPE_VBAK, BAPE_VBAP, BAPE_VBEP). You can complete the remaining fields with the append structures from the enhancement structures.
    At the moment, you can use the BAPI to store enhancements in the following structures:
    VBAK : An enhancement to header data requires an append structure to BAPE_VBAK and an enhancement to structure VBAKKOZ.
    VBAP : An enhancement to item data requires an append structure to BAPE_VBAP and an enhancment to structure VBAPKOZ.
    VBEP : An enhancement to schedule line data requires an append structure to BAPE_VBEP and an enhancement to structure VBEPKOZ.
    VBKD : If you are using an enhancement for header data, you must add an append structure to BAPE_VBAK. You also need to enhance structure VBAKKOZ. If it is for item data, you need to add an append structure to BAPE_VBAP. You must also enhance structure VBAPKOZ.
    If you also want to work with checkboxes, each X-structure must also contain an append structure.
    For example:
    A customer has created an order and wants to include the material long text (50 digits long).
    The EXTENSIONIN structure must be completed with BAPE_VBAP. Two fields have fixed definitions in this structure. These are in the VBAP host key (VBELN, POSNR). The customer sets up an append structure that contains field ZMAT50.
    Because the VBELN is normally blank when you create an order, the data can look like this:
    STRUCTURE   |BAPE_VBAP
    VALUEPART1  |          000010Customermateriallongtext50
                  VBELN     POSNR ZMAT50

  • How many times USEREXIT_MOVE_FIELD_TO_VBKD is called in sales order

    Hi,
    I need to do some modifications to XVBKD internal structure depending data in XVBAP structure.
    Just wanted to know how many times USEREXIT_MOVE_FIELD_TO_VBKD is called while saving the order.
    Is it called for every item in VBKD table for that order or only for header?
    And what if a new item is added in order.. will it be called for that item too ??
    Please help..
    Regards,
    Anand

    Hi,
    I need to do some modifications to XVBKD internal structure depending data in XVBAP structure.
    Just wanted to know how many times USEREXIT_MOVE_FIELD_TO_VBKD is called while saving the order.
    Is it called for every item in VBKD table for that order or only for header?
    And what if a new item is added in order.. will it be called for that item too ??
    Please help..
    Regards,
    Anand

  • User-Exit MV45AFZZ - userexit_move_field_to_vbkd

    Hi All,
               I have one requirement which i need to get department number, stored in table T023T and assigned to sales order item level.
               The logic is based on material i am getting the material group and based on material group i am getting the department number which is maintained in the Description2 field of table T023T.
    i written the above logic in form 'userexit_move_field_to_vbkd' and moved department number to VBKD-ABTNR. But i dont know why for some materials Department number is assigning wrong values and for some it is assigning correct value.
    Please help me out is there any other place to move the data to department number while creating sales order.
    Regards,
    Siva.

    HI Siva,
    In this user MV45AFZZ, value are store in structure like,
    Xvbkd- hold current values, Yvbkd contain old value.
    like this yvbak, yvbak, Xvbep,yvbep,vbap,xvbap,yvbap.
    try to change this internal structure value then it will populate.
    Thanks,
    Sendil

  • Help in defaulting a value in a program

    I have a program called MV45AZZA, and I got the following requirement
    In MV45AFZZ we need to default VBAP-BWTAR = RH while new items are added in transaction VA01 and VA02, if sales org = 5090, order type = ZSBK and MBEW-BWTTY = 1 for the VBAP-MATNR. Once defaulted user should be able to change it to new value in VA01 and VA02, in that case system should not overwrite it with default value.
    Sales order functionality needs to be changed to account for Sbank sales updating to repair profit center.
    any help in coding is highly appreciated. i know little ABAP and I would appreciate if somebody can help in adding the code.Please highlight the code you added
    Please check the Program below.
    Thanks
    SP
    *TABLES: zue003, tvarv.
    *DATA: werks LIKE vbap-werks.
    Start of DEVK923935.
    Global Definition
    INCLUDE  zsdi_mv45afzz_top.
          FORM ZZEXAMPLE                                                *
          text......................................                    *
    *FORM ZZEXAMPLE.
    *ENDFORM.
    *eject
          FORM USEREXIT_DELETE_DOCUMENT                                 *
          This userexit can be used to delete data in additional tables *
          when a sales document is deleted.                             *
         This form is called in dialog at the end of form BELEG_LOESCHEN*
         just before form BELEG_SICHERN is performed to delete the      *
         datas on the database.                                         *
    FORM userexit_delete_document.
    ENDFORM.
    *eject
          FORM USEREXIT_FIELD_MODIFICATION                              *
          This userexit can be used to modify the attributes of         *
          screen fields.                                                *
          This form is processed for each field in the screen.          *
          The use of the fields screen-group1 to screen-group4 is:      *
          Screen-group1: Automatic modification contolles by transaction*
                         MFAW.                                          *
          Screen-group2: Contents 'LOO' for steploop-fields.            *
          Screen-group3: Used for modififaction, which are dependent on *
                         control tables or other fix information.       *
          Screen-group4: Unused                                         *
          For field mofifications, which are dependent on the document  *
          status, you can use the status field in the workareas         *
          XVBAP for item status and XVBUK for header status.            *
          This form is called from module FELDAUSWAHL.                  *
    FORM userexit_field_modification.
      DATA: zvbtyp LIKE vbfa-vbtyp_n,
            zvbeln LIKE vbfa-vbeln.
    CASE SCREEN-GROUP3.
      WHEN '900'.
        IF VBAK-VBTYP NE 'A'.
          SCREEN-ACTIVE = 0.
        ENDIF.
    ENDCASE.
    CASE SCREEN-NAME.
      WHEN 'VBAK-VBELN'.
        SCREEN-ACTIVE = 0.
    ENDCASE.
      IF vbap-pstyv = 'IRLA'.
       CHECK sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
        IF sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
          SELECT SINGLE vbtyp_n INTO zvbtyp FROM vbfa
                 WHERE vbelv = xvbap-vbeln AND posnv = vbap-posnr.
         CHECK sy-subrc <> 0.
          IF sy-subrc <> 0.
            CASE screen-group2.
              WHEN 'LOO'.
                IF screen-name = 'VBAP-WERKS'.
                  screen-input = 1.
                ENDIF.
            ENDCASE.
          ENDIF.
        ENDIF.
      ENDIF.
    Make Reject Reason modifiable when document category is 'RETURNS'
    06/10/02  
    Modified by Ak for check on subsequent credit memo
    This opens up the field - reason for rejection - for change even after
    the material has been received into the system on the returns delivery
    but before the Returns Credit Memo has been issued.
    Changed field to be modified from Reason for Rejection to Item
    Category on the line item for which no credit to be given.
    select single * from vbfa where vbelv = vbak-vbeln and
                                     vbtyp_n = 'O'.
    select a Returns Credit Memo document from VBFA that has NOT been
    cancelled. if the selection is successful, credit has been issued and
    the field should stay locked. however, if selection is unsuccessful
    and since no credit has been issued, the field for item category
    must be available for changing, if need be.
    check: vbak-vbtyp = 'H'.
      IF vbak-vbtyp = 'H'.
        IF sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
          SELECT SINGLE vbrk~vbeln INTO zvbeln
            FROM vbfa INNER JOIN vbrk ON vbfavbeln = vbrkvbeln
              WHERE vbfavbelv = vbak-vbeln AND vbfaposnv = vbap-posnr
                AND vbfavbtyp_n = 'O' AND vbrkfksto NE 'X'.
          CHECK sy-subrc NE 0.
          CASE screen-group2.
            WHEN 'LOO'.
              IF screen-name = 'VBAP-PSTYV'.
                screen-input = 1.
              ENDIF.
          ENDCASE.
        ENDIF.
      ENDIF.
      INCLUDE zue_sd_0029.
    **If no invoice is created then make PSTYV ready for input for item
    **category IRIN.
      INCLUDE zue_sd_0031.
    ENDFORM.
    *eject
          FORM USEREXIT_MOVE_FIELD_TO_VBAK                              *
          This userexit can be used to move some fields into the sales  *
          dokument header workaerea VBAK.                               *
          SVBAK-TABIX = 0:  Create header                               *
          SVBAK-TABIX > 0:  Change header                               *
          This form is called at the end of form VBAK_FUELLEN.          *
    FORM userexit_move_field_to_vbak.
    vbak-zzfield = xxxx-zzfield2.
    **Ernesto EDIT for UE DEMO 10/16/2002
    SELECT single * INTO TABLE i_tvarv FROM tvarv WHERE name =
    *ZKS_KSEASORG'.
    Start of DEVK923935.
    Initialization Section
      INCLUDE zsdi_mv45afzz_initialization.
    End of DEVK923935.
    **{   INSERT         SNDK900075                                        1
    Change user exit according to Online Documentation to
    copy ship-to info to sale doc header (VBAK)
    *CODE BELOW*REPLACED WITH zue_sd_0017***********
    IF vbak-kvgr1 IS INITIAL AND
        vbak-kvgr2 IS INITIAL AND
        vbak-kvgr3 IS INITIAL AND
        vbak-kvgr4 IS INITIAL AND
        vbak-kvgr5 IS INITIAL.
       SELECT SINGLE vkgrp vkbur kvgr1 kvgr2 kvgr3 kvgr4 kvgr5
       FROM knvv  INTO (vbak-vkgrp, vbak-vkbur, vbak-kvgr1, vbak-kvgr2,
                                    vbak-kvgr3, vbak-kvgr4, vbak-kvgr5)
       WHERE kunnr = kuwev-kunnr AND
             vkorg = vbak-vkorg AND
             vtweg = vbak-vtweg AND
             spart = vbak-spart.
    ENDIF.
    *CODE ABOVE*REPLACED WITH zue_sd_0017***********
      INCLUDE zue_sd_0017.
    *CODE BELOW*REPLACED WITH zue_sd_0017***********
    IF svbak-tabix = 0.
       SELECT SINGLE vsbed  FROM knvv INTO vbak-vsbed
    *WHERE kunnr = kuwev-kunnr AND
         vkorg = vbak-vkorg AND
         vtweg = vbak-vtweg AND
         spart = vbak-spart.
    ENDIF.
    *CODE ABOVE*REPLACED WITH zue_sd_0017***********
    Start of DEVK915182
    **Ernesto EDIT for UE DEMO 10/15/2002.
    READ TABLE i_tvarv WITH KEY name = 'ZKS_KSEASORG'.
    IF sy-subrc = 0.
       IF vbak-vkorg =  i_tvarv-low.
      IF vbak-vkorg IN i_zsd01_vkorg.
        IF sy-tcode EQ 'VA01'.
          IF sy-dynnr EQ '4021'.
            IF sy-ucomm NE 'SICH'.
              l_pop_type = 'X'.
              INCLUDE zue_sd_0027.
             PERFORM partner_validation USING 'X'.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    end-of DEVK915182
    Project : KSEA - Sales Force Expansion of 1st Jan 2003
    Include for KSEA  Sales Org 5010 only for PopUp Windows " 12/23/2002
      INCLUDE zsd_salesforce_expnsn_hdr." Include 1 of 4
    */ Description        : KSE Modification to remove the billing block for
    */                      returns/credits/debits if sales Org is 5090.
    *ORIGINAL CODE
    *if vbak-vkorg = '5090' and vbak-vbtyp ca 'HKL'.
    *vbak-faksk = ' '.
    *endif.
      IF sy-tcode = 'VA01'.
        IF vbak-vkorg IN i_zsd09_vkorg.
          IF vbak-vbtyp IN i_zsd09_vbtyp.
            vbak-faksk = ' '.
          ENDIF.
        ENDIF.
      ENDIF.
    BREAK-POINT.
    INCLUDE zue_sd_0039.
    ENDFORM.
    *eject
          FORM USEREXIT_MOVE_FIELD_TO_VBAP                              *
          This userexit can be used to move some fields into the sales  *
          dokument item workaerea VBAP                                  *
          SVBAP-TABIX = 0:  Create item                                 *
          SVBAP-TABIX > 0:  Change item                                 *
          This form is called at the end of form VBAP_FUELLEN.          *
    FORM userexit_move_field_to_vbap.
    VBAP-zzfield = xxxx-zzfield2.
    *{   INSERT         SNDK900164                                        1
    Item Category Determination
      DATA: zzbukrs LIKE tvko-bukrs,
            zzmtpos LIKE mvke-mtpos.
      DATA: BEGIN OF zzwerks OCCURS 0,
              werks LIKE marc-werks,
            END OF zzwerks.
      DATA: zdoccat LIKE tvak-vbklt,
            zvmsta LIKE mvke-vmsta,
            zspvbc LIKE tvms-spvbc,
            zvmstb LIKE tvmst-vmstb.
      DATA: z_xvbap LIKE xvbap,
            yp1 LIKE t001k-bwkey,
            z_uepos_bukrs LIKE t001k-bukrs.
      IF i_zsd01_vkorg[] IS INITIAL.
    If the initialization was not performed in the Fill VBAK,
    reload data
        INCLUDE zsdi_mv45afzz_initialization.
      ENDIF.
      SELECT SINGLE bukrs
        INTO zzbukrs
        FROM tvko
       WHERE vkorg = vbak-vkorg.
      SELECT w~werks
        INTO TABLE zzwerks
        FROM t001w AS w JOIN t001k AS k
          ON wbwkey = kbwkey
       WHERE k~bukrs = zzbukrs.
      SELECT SINGLE mtpos INTO zzmtpos
        FROM mvke
       WHERE matnr = vbap-matnr
         AND vkorg = vbak-vkorg
         AND vtweg = vbak-vtweg.
    Export Plant - inport in ZXQSMU07
      EXPORT zz_plant = vbap-werks TO MEMORY ID  'ZZPLANT'.   " KN05
    check vbap-pstyv = 'TAN' or vbap-pstyv = 'TANN'.
    removed the CHECK statement and replaced by IF-ENDIF.
    inserted by arvind r kulkarni for TAN, TANN switching
      IF vbap-pstyv = 'TAN' OR vbap-pstyv = 'TANN'
      OR vbap-pstyv = 'REN'                                     " KN02
      OR vbap-pstyv = 'RENN' .                                  " KN02
        READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
       check sy-subrc ne 0.
        IF sy-subrc NE 0.
          IF vbap-pstyv = 'TAN'.
            vbap-pstyv = 'ZAN'.
          ELSEIF vbap-pstyv = 'REN'.                            " KN02
            vbap-pstyv = 'YREN'.                                " KN02
          ELSEIF vbap-pstyv = 'RENN'.                           " KN02
            vbap-pstyv = 'YRNN'.                                " KN02
          ELSEIF vbap-pstyv = 'TANN'.
            vbap-pstyv = 'ZANN'.
          ENDIF.
        ENDIF.
      ENDIF.
      INCLUDE zue_sd_0014.
    Begin insert for check for discontinued material in repair orders
    LOGIC: For IRAT item categories, check if the material status field *
           blank or populated.                                          *
           If populated, get the value of the D-Chain specific status   *
           and issue warning/error message with the associated text     *
           from config the D-Chain specific material status.            *
           Included YRAT to this logic (YRAT is free IRAT); 11/22/2002. *
      IF vbap-pstyv = 'IRAT' OR vbap-pstyv = 'YRAT'.
        CLEAR: zvmsta, zvmstb, zspvbc.
        SELECT SINGLE vmsta INTO zvmsta FROM mvke WHERE
                matnr = vbap-matnr AND vkorg = vbak-vkorg
                AND vtweg = vbak-vtweg.
       CHECK: NOT zvmsta IS INITIAL.
        IF NOT zvmsta IS INITIAL.
          SELECT SINGLE spvbc INTO zspvbc FROM tvms WHERE
                  vmsta = zvmsta.
          SELECT SINGLE vmstb INTO zvmstb FROM tvmst WHERE
                  spras = sy-langu AND vmsta = zvmsta.
          CASE zspvbc.
            WHEN 'A'.
              MESSAGE ID 'V1' TYPE 'W' NUMBER '028' WITH zvmsta zvmstb.
            WHEN 'B'.
              MESSAGE ID 'V1' TYPE 'E' NUMBER '028' WITH zvmsta zvmstb.
          ENDCASE.
        ENDIF.
      ENDIF.
    End insert for check for discontinued material in repair orders
      INCLUDE zue_sd_0004.
      INCLUDE zue_sd_0005.
    end of DEVK923935.
    ****************END OF TEST SOURCE CODE******************
    Begin Insert to assign material entered for TRADE material
    Ak; 11/08/2002.
    For trade material, the system will now mandate entry of higher level
    item number and based on this, the system will bring in specialty,
    material number (into material entered) and profit centre from this
    higher level item into the line item for material TRADE.
    Added MVGR2 & 3 to pass onto TRADE material; 11/12/2002 - Arvind.
    Added material a/c assignment grp to trade-in material.
    Added ZTRD item category to this logic.  - Arvind 11/18/2002.
      INCLUDE zzsdprc01.
      INCLUDE zue_sd_0028.
    End Insert to assign material entered for TRADE material
    ********************End of DIP Profile change************************
    Get custom group data from MVKE (Sales Data for Material) by Material
    when order type is 'RAS' (Repairs/Service)
    and populate line item's Additional data A
      INCLUDE zue_sd_0006.
      INCLUDE zue_sd_0001.
    include ZUE_SD_0032.
      INCLUDE zue_sd_0002.
    Get similar data (as above) from Servicable Material
      INCLUDE zue_sd_0003.
    *}   INSERT
    Determine Delivery Priority from SH Partner
    11/02/2001
      SELECT SINGLE lprio
      FROM knvv
      INTO vbap-lprio
      WHERE kunnr = kuwev-kunnr AND
            vkorg = vbak-vkorg AND
            vtweg = vbak-vtweg AND
            spart = vbak-spart.
    Determine Delivery Priority for Order Type RAS
      INCLUDE zsd_check_pstyv_werks.
    To re-determine Matwa if the replacement item is changed afterwards
    Niranjan 05/10/05 and ECLARKE
    INCLUDE zue_sd_0021.
    Mod for all sales organizations
    Determination of Profit Center
    06/24/03
      INCLUDE zue_sd_0007.
    End PRCTR Determination for KSI's document
    KSI modification
    Code to enter the actual part number of the item being repaired,
    rather than "REPAIR"
    09/18/02  GM
      DATA: intercoflag TYPE c.
      PERFORM zz_determine_cross_comp USING vbak-vkorg
                                            vbap-werks
                                            intercoflag.
      IF intercoflag = 'Y'
        AND
        ( vbap-pstyv = 'IRIN' OR vbap-pstyv = 'ZRIN' ).
        SELECT SINGLE matwa INTO vbap-matwa FROM vbap
        WHERE vbeln = vbap-vbeln AND posnr = vbap-uepos.
        IF sy-subrc NE 0.
          MESSAGE e006(z1) WITH vbap-uepos.
        ENDIF.
      ENDIF.
    End material look up modification GM 9/17/02
    KSI modification
    DP90 Only:
    Remove Billing Block from IRIN items and moved them to the header
    10/06/02 CNG
    11/18/2002     Tr-DEVK917363
    Added Sales Orgs 5040 & 5060
    KSI modification
    06/10/2003   CNG  CN01
    If IRIN, clear billing block at item level
      IF sy-tcode = 'DP90'.
      IF vbap-werks = '7000' AND vbak-vkorg = '5010' AND"            SM01-
        vbap-pstyv = 'IRIN'."                                        SM01-
        IF vbap-werks = '7000' AND"                                    SM01+
           ( vbak-vkorg IN i_zsd01_vkorg OR"                    SM01+
             vbak-vkorg = '5040' OR"                                   SM01+
    Removed >>
            vbak-vkorg = '5060' )"              SM01+                CN01-
         AND vbap-pstyv = 'IRIN'."              SM01+                CN01-
        vbak-faksk = '02'.
    Removed <<
    Inserted - check and block for line item IRIN only
             vbak-vkorg = '5060' )."                                   SM01+
          vbak-faksk = '02'.
         IF vbap-pstyv = 'IRIN'."                                      CN01+
            CLEAR vbap-faksp.
    Inserted - check and block for line item IRIN only
          ENDIF.
        ENDIF.
      ENDIF.
    KSI modification
    Routine to populate VBAP-ZZEDATU and VBAP-ZZVDATU on change and
    creation of order
    02/10/03 CNG
      PERFORM check_custom_dates.
    KSE Modification to create return item automatically**
    Copied from Niranjan's routine tested in SND210  Date 04/05/03
      INCLUDE zue_sd_0008.
    User Exit for Service Processing - Clear Results
    Analysis Key in sales order item for non-KSE service
    items.  DEVK927084       W. Miller 05/12/2003
    Changed to validate by plant instead of sales org.
    06/30/03    BEGIN>>>
    if not vbak-vkorg = '5090' and vbap-bedae = 'SE'.
    *Added 5000 for  KSEM Prjct 02-09-2006 EC
      IF NOT ( vbap-werks = '9000' OR vbap-werks = '5000' )
      AND ( vbap-bedae = 'SE' OR VBAP-BEDAE = 'SERA' ).
    06/30/03    END  <<<<
        CLEAR vbap-abgrs.
      ENDIF.
    End of DEVK924084
    */ Author             :  w/ Trimb.
    */ Date               : 10/07/2003   ---> Repair No : DEVK930002
    */ Description        : KSE Modification For plant 9000, to check the
    */                      material is 'Non-R' for RAS order type
    */                      and is 'R' for ZREX and ZWAR order types.
    *Added lines below for -  There is a user exit which exists that does
    *not allow materials that do not begin with an "R" to be posted into
    *plant 9000 if they are attached to a ZWAR order type.  KSE/KSEA would
    *like to modify this exit to allow materials with profit centers
    *5090-03003 and 5090-04003 to be posted.
    *ECLARKE/Niranjan 07-29-2004
    *________________________n 07-29-2004__________________
      DATA: flag_dexe.
      TABLES: zzue027.
      CLEAR: flag_dexe.
      SELECT SINGLE werks auart prctr INTO (zzue027-werks, zzue027-auart,
      zzue027-prctr) FROM zzue027 WHERE werks = vbap-werks AND auart =
      vbak-auart AND prctr = vbap-prctr.
      IF sy-subrc = 0.
        flag_dexe = 'X'.
      ENDIF.
    *________________________ 07-29-2004__________________
      IF flag_dexe IS INITIAL. " 07-29-2004
        IF vbap-werks IN i_zsd09_werks.
       IF ( vbak-auart IN i_zsd02_auart AND vbap-pstyv IN i_zsd04_pstyv AND
                 vbap-matwa(1) = 'R' ) OR ( vbak-auart IN i_zsd02_auart AND
                      vbap-pstyv IN i_zsd03_pstyv AND vbap-matnr(1) = 'R' ).
            IF vbap-matwa(1) = 'R'.
              MESSAGE e001(zkse) WITH vbap-matwa vbap-posnr vbak-auart
                vbap-pstyv.
            ENDIF.
            IF vbap-matnr(1) = 'R'.
              MESSAGE e001(zkse) WITH vbap-matnr vbap-posnr vbak-auart
              vbap-pstyv.
            ENDIF.
          ELSEIF ( vbak-auart IN i_zsd03_auart AND vbap-pstyv IN
      i_zsd04_pstyv AND vbap-matwa(1) <> 'R' ) OR ( vbak-auart IN
    i_zsd03_auart AND vbap-pstyv IN i_zsd03_pstyv AND vbap-matnr(1) <> 'R' )
      OR ( vbak-auart IN i_zsd04_auart AND vbap-pstyv IN i_zsd04_pstyv AND
    vbap-matwa(1) <> 'R' ) OR ( vbak-auart IN i_zsd04_auart AND vbap-pstyv
      IN i_zsd03_pstyv AND vbap-matnr(1) <> 'R' ).
            IF vbap-matwa(1) <> 'R'.
              MESSAGE e001(zkse) WITH vbap-matwa vbap-posnr vbak-auart
              vbap-pstyv.
            ENDIF.
            IF vbap-matnr(1) <> 'R'.
              MESSAGE e001(zkse) WITH vbap-matnr vbap-posnr vbak-auart
              vbap-pstyv.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
      INCLUDE zue_sd_0015.
    include zue_sd_0019
    Enhancement to populate Storage Location for sales order 5090
    and plant 9000. But any companies can use it as long as entries are
    maintained in table zsd_default_sloc
    Niranjan  02/11/04
    DEVK933987 - MV45AFZZ - MPitisci 4/12/2004
       DEVK933989 - ZUE_SD_0019  include
       DEVK933998 - ZSD_DEFAULT_SLOC table
      INCLUDE zue_sd_0019.
    To give hard error for D-CHin status 07 for items catgories other
    than trade.
    04/10/05
      INCLUDE zue_sd_0034.
    Checks if the storage location value is changed and checks to see if
    the storage location correlates to the P3 Partner function rules
    08/05/2005
      INCLUDE zue_sd_0036.
      INCLUDE zue_sd_0013.
    ENDFORM.
    *eject
          FORM USEREXIT_MOVE_FIELD_TO_VBEP                              *
          This userexit can be used to move some fields into the sales  *
          dokument schedule line workaerea VBEP                         *
          SVBEP-TABIX = 0:  Create schedule line                        *
          SVBEP-TABIX > 0:  Change schedule line                        *
          This form is called at the end of form VBEP_FUELLEN.          *
    FORM userexit_move_field_to_vbep.
      DATA: intercoflag TYPE c.
    VBEP-zzfield = xxxx-zzfield2.
    Assign 'ZP' to Schedule line Category for Acct Assignment Grp =
    Chui 10/23/2001
      DATA: zzbukrs LIKE tvko-bukrs,
            zzmtpos LIKE mvke-mtpos.
      DATA: z_vbelv LIKE vbfa-vbelv,"                                KN03
            z_auart LIKE vbak-auart,"                                KN03
            z_vbtyp LIKE vbak-vbtyp,"                                KN03
            z_ettyp LIKE vbep-ettyp,"                                KN03
            z_pstyv LIKE vbap-pstyv,"                                KN04
            z_posnr LIKE vbap-posnr."                                KN04
      DATA: BEGIN OF zzwerks OCCURS 0,
              werks LIKE marc-werks,
            END OF zzwerks.
      IF vbak-vbtyp CN 'AB'. "ECLARKE 01-26-04
        SELECT SINGLE bukrs
          INTO zzbukrs
          FROM tvko
         WHERE vkorg = vbak-vkorg.
        SELECT w~werks
          INTO TABLE zzwerks
          FROM t001w AS w JOIN t001k AS k
            ON wbwkey = kbwkey
         WHERE k~bukrs = zzbukrs.
        SELECT SINGLE mtpos INTO zzmtpos
          FROM mvke
         WHERE matnr = vbap-matnr
           AND vkorg = vbak-vkorg
           AND vtweg = vbak-vtweg.
    *lines added for valuated customer-returns project by msn
    110903. It will set required schedule line category YR on specific
    item categories if the document created is of type RE with reference
    document being an invoice of type F2
    *ECLARKE & MILIND NAND. 11-11-2003.
    *Schedule Line Category - Valuate Customer Returns Stock
    INCLUDE zue_sd_0010.
        CASE vbap-pstyv.
          WHEN  'ZRPN'.
            EXIT.
          WHEN 'TAN' OR 'TANN'.
            IF vbkd-ktgrd = '01'.            " Added 6/5/02
              IF vbep-ettyp = 'CN'.
                vbep-ettyp = 'ZA'.
              ELSE.
                vbep-ettyp = 'ZP'.
              ENDIF.
            ENDIF.
    **Ernesto EDIT for UE DEMO 10/15/2002
    ***************TEST FUNCTION MODULE FOR USER EXIT MAINT.******
    **ADDED  A CASE STATEMENT BELOW.
    CALL FUNCTION 'Z_UE_SD_GET_SCHEDULE_LINE_CAT'
          EXPORTING
               pstyv  = vbap-pstyv
               ktgrd  = vbkd-ktgrd
               ettyp2 = vbep-ettyp
          IMPORTING
               ettyp  = vbep-ettyp.
    ****************END OF TEST SOURCE CODE******************
            READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
         check sy-subrc ne 0.
            IF sy-subrc NE 0.
    Change inserted by Arvind R Kulkarni; 07/22/2002
    TAN -> ZAN; TANN => ZANN
           vbap-pstyv = 'ZAN'.
              IF vbap-pstyv = 'TAN'.
                vbap-pstyv = 'ZAN'.
              ELSEIF vbap-pstyv = 'TANN'.
                vbap-pstyv = 'ZANN'.
              ENDIF.
    end of change
            ENDIF.
    *ADDED CASE HERE FOR TEST FOR SYNTAX CHECK 10/15/2002
    *CASE vbap-pstyv.
          WHEN 'ZAN'.
            READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
            CHECK sy-subrc EQ 0.
            vbap-pstyv = 'TAN'.
          WHEN 'ZANN'.
            READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
            CHECK sy-subrc EQ 0.
            vbap-pstyv = 'TANN'.
          WHEN 'ZTAN'.
            IF vbkd-ktgrd = '01'.            " Added 6/5/02
              IF vbep-ettyp = 'CN'.
                vbep-ettyp = 'ZA'.
              ELSE.
                vbep-ettyp = 'ZP'.
              ENDIF.
            ENDIF.
            READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
         check sy-subrc ne 0.
            IF sy-subrc NE 0.
              IF vbep-ettyp = 'CN'.
                vbep-ettyp = 'ZA'.
              ELSE.
                vbep-ettyp = 'ZP'.
              ENDIF.
            ENDIF.
    03/23/2005 KN03 Set Schedule Line default to ZF order type ZFD,
    item cat ZTAN, sales org 5060, 5070, and 5071
            IF vbak-auart EQ 'ZFD' AND
            ( vbak-vkorg = '5060' OR vbak-vkorg = '5070'
             OR vbak-vkorg = '5071' ).
              vbep-ettyp = 'ZF'.
            ENDIF.
    Begin of insertion for IRAT processing
    Arvind R Kulkarni; Dated: 07/17/2002.
    Changed to include YRAT; ; 11/22/2002
          WHEN 'IRAT' OR 'YRAT'.
            IF vbak-auart NE 'ZWAR'.
    the sales order is NOT a ZWAR
              READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
              IF sy-subrc NE 0.
    the transaction IS intercompany
                IF vbep-ettyp = 'CN'.
                  vbep-ettyp = 'YN'.
                ELSE.
                  vbep-ettyp = 'YL'.
                ENDIF.
              ELSE.
    the transaction IS NOT intercompany
                IF vbep-ettyp = 'CN'.
                  vbep-ettyp = 'ZN'.
                ELSE.
                  vbep-ettyp = 'ZL'.
                ENDIF.
              ENDIF.
              IF vbkd-ktgrd = '01'.
    sale is to an affiliate in local sales org
                IF vbep-ettyp = 'CN'.
                  vbep-ettyp = 'YN'.
                ELSE.
                  vbep-ettyp = 'YL'.
                ENDIF.
              ENDIF.
            ELSE.
    the sales order IS a ZWAR
              READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
              IF sy-subrc NE 0.
    the transaction IS intercompany
                IF vbep-ettyp = 'CN'.
                  vbep-ettyp = 'ZA'.
                ELSE.
                  vbep-ettyp = 'ZP'.
                ENDIF.
         ELSE.
    the transaction IS NOT intercompany
    NOTHING NEEDS TO BE DONE FOR ZWAR DOMESTIC
    STD SCHED LINE CATEGORIES TO BE MAINTAINED.
           IF VBEP-ETTYP = 'CN'.
             VBEP-ETTYP = 'ZN'.
           ELSE.
             VBEP-ETTYP = 'ZL'.
           ENDIF.
         ENDIF.
         IF VBKD-KTGRD = '01'.
    sale is to an affiliate in local sales org
                IF vbep-ettyp = 'CN'.
                  vbep-ettyp = 'ZA'.
                ELSE.
                  vbep-ettyp = 'ZP'.
                ENDIF.
              ENDIF.
            ENDIF.
    End of insertion for IRAT processing
          WHEN 'IRRS' OR 'IRRE' OR 'IRLA' OR 'IRLB' OR 'KBN' OR 'TAQ'
    KSI Modification    04/22/03
    Exclude check for item category 'YKW'
            OR 'YTAN' OR 'ZKLN' OR 'KAN'  OR 'ZTAQ'
            OR 'YKW' OR 'IRRP'  OR 'ZKBC' OR 'ZKBN' OR 'ZKAN' OR 'KLN'.
          or  'ZKEN' OR 'ZKEC' or ZREK OR 'KEN'.
            EXIT.
          WHEN 'ZTR1' OR 'ZRBB' OR 'ZREB' OR 'ZREC' OR 'ZREF' OR 'ZREN'
    Removed ZRTN to validate plant 9000
            OR 'ZRFF' OR 'ZRNB' OR 'ZRNN' OR 'REN' OR 'RENN'
            OR 'ZLN' OR 'IRAL' OR 'ZTR0' OR 'KLN'.
            EXIT.
    03/23/2005 KN03 set default sched line for KE & ZKE
          WHEN 'KEN' OR 'ZKEG' OR 'ZKEN' OR 'ZKEC'.
            IF vbak-vkorg EQ '5070'.
              vbep-ettyp = 'Z0'.
            ENDIF.
          WHEN 'ZREK'.
            INCLUDE zue_sd_0033.
            IF vbap-werks = '9000'.                    " KN04
              IF vbkd-ktgrd = '01'.                    " KN04
                IF  z_auart = 'ZFD ' and z_pstyv = 'KLN '.    " KN04
                  vbep-ettyp = 'YK'.                   " KN04
                ENDIF.
              ENDIF.
            ENDIF.
    KSE Modification    04/10/03
    For Item Cate 'ZRTN'
    Assign 'YQ' to Schedule line cat, if cross-company
    'YU' if not.
          WHEN 'ZRTN'.

    Hi,
    Step 1) Create a include ZSD_DEFAULT_BWTAR and add the following code
    DATA: S_MBEW TYPE MBEW.
    Check for create and change.
    IF T180-TRTYP = 'H' OR T180-TRTYP = 'V'.
    IF VBAK-VKORG = '5090' AND VBAK-AUART = 'ZSBK'.
    SELECT SINGLE * FROM MBEW
    INTO S_MBEW
    WHERE MATNR = VBAP-MATNR
    AND BWKEY = VBAP-WERKS.
    IF SY-SUBRC = 0 AND S_MBEW-BWTTY = '1'.
    Check if it is for line item creation.
    WHen the changes the value this will not trigger.
    IF SVBAP-TABIX = 0.
    VBAP-BWTAR = 'RH'.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    STEP 2)
    Add the include to the subroutine USEREXIT_FIELD_TO_VBAP. The include statement is marked in bold.
    *TABLES: zue003, tvarv.
    *DATA: werks LIKE vbap-werks.
    Start of DEVK923935.
    Global Definition
    INCLUDE zsdi_mv45afzz_top.
    FORM ZZEXAMPLE *
    text...................................... *
    *FORM ZZEXAMPLE.
    *ENDFORM.
    *eject
    FORM USEREXIT_DELETE_DOCUMENT *
    This userexit can be used to delete data in additional tables *
    when a sales document is deleted. *
    This form is called in dialog at the end of form BELEG_LOESCHEN*
    just before form BELEG_SICHERN is performed to delete the *
    datas on the database. *
    FORM userexit_delete_document.
    ENDFORM.
    *eject
    FORM USEREXIT_FIELD_MODIFICATION *
    This userexit can be used to modify the attributes of *
    screen fields. *
    This form is processed for each field in the screen. *
    The use of the fields screen-group1 to screen-group4 is: *
    Screen-group1: Automatic modification contolles by transaction*
    MFAW. *
    Screen-group2: Contents 'LOO' for steploop-fields. *
    Screen-group3: Used for modififaction, which are dependent on *
    control tables or other fix information. *
    Screen-group4: Unused *
    For field mofifications, which are dependent on the document *
    status, you can use the status field in the workareas *
    XVBAP for item status and XVBUK for header status. *
    This form is called from module FELDAUSWAHL. *
    FORM userexit_field_modification.
    DATA: zvbtyp LIKE vbfa-vbtyp_n,
    zvbeln LIKE vbfa-vbeln.
    CASE SCREEN-GROUP3.
    WHEN '900'.
    IF VBAK-VBTYP NE 'A'.
    SCREEN-ACTIVE = 0.
    ENDIF.
    ENDCASE.
    CASE SCREEN-NAME.
    WHEN 'VBAK-VBELN'.
    SCREEN-ACTIVE = 0.
    ENDCASE.
    IF vbap-pstyv = 'IRLA'.
    CHECK sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
    IF sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
    SELECT SINGLE vbtyp_n INTO zvbtyp FROM vbfa
    WHERE vbelv = xvbap-vbeln AND posnv = vbap-posnr.
    CHECK sy-subrc <> 0.
    IF sy-subrc <> 0.
    CASE screen-group2.
    WHEN 'LOO'.
    IF screen-name = 'VBAP-WERKS'.
    screen-input = 1.
    ENDIF.
    ENDCASE.
    ENDIF.
    ENDIF.
    ENDIF.
    Make Reject Reason modifiable when document category is 'RETURNS'
    06/10/02
    Modified by Ak for check on subsequent credit memo
    This opens up the field - reason for rejection - for change even after
    the material has been received into the system on the returns delivery
    but before the Returns Credit Memo has been issued.
    Changed field to be modified from Reason for Rejection to Item
    Category on the line item for which no credit to be given.
    select single * from vbfa where vbelv = vbak-vbeln and
    vbtyp_n = 'O'.
    select a Returns Credit Memo document from VBFA that has NOT been
    cancelled. if the selection is successful, credit has been issued and
    the field should stay locked. however, if selection is unsuccessful
    and since no credit has been issued, the field for item category
    must be available for changing, if need be.
    check: vbak-vbtyp = 'H'.
    IF vbak-vbtyp = 'H'.
    IF sy-tcode = 'VA01' OR sy-tcode = 'VA02'.
    SELECT SINGLE vbrk~vbeln INTO zvbeln
    FROM vbfa INNER JOIN vbrk ON vbfavbeln = vbrkvbeln
    WHERE vbfavbelv = vbak-vbeln AND vbfaposnv = vbap-posnr
    AND vbfavbtyp_n = 'O' AND vbrkfksto NE 'X'.
    CHECK sy-subrc NE 0.
    CASE screen-group2.
    WHEN 'LOO'.
    IF screen-name = 'VBAP-PSTYV'.
    screen-input = 1.
    ENDIF.
    ENDCASE.
    ENDIF.
    ENDIF.
    INCLUDE zue_sd_0029.
    **If no invoice is created then make PSTYV ready for input for item
    **category IRIN.
    INCLUDE zue_sd_0031.
    ENDFORM.
    *eject
    FORM USEREXIT_MOVE_FIELD_TO_VBAK *
    This userexit can be used to move some fields into the sales *
    dokument header workaerea VBAK. *
    SVBAK-TABIX = 0: Create header *
    SVBAK-TABIX > 0: Change header *
    This form is called at the end of form VBAK_FUELLEN. *
    FORM userexit_move_field_to_vbak.
    vbak-zzfield = xxxx-zzfield2.
    **Ernesto EDIT for UE DEMO 10/16/2002
    SELECT single * INTO TABLE i_tvarv FROM tvarv WHERE name =
    *ZKS_KSEASORG'.
    Start of DEVK923935.
    Initialization Section
    INCLUDE zsdi_mv45afzz_initialization.
    End of DEVK923935.
    **{ INSERT SNDK900075 1
    Change user exit according to Online Documentation to
    copy ship-to info to sale doc header (VBAK)
    *CODE BELOW*REPLACED WITH zue_sd_0017***********
    IF vbak-kvgr1 IS INITIAL AND
    vbak-kvgr2 IS INITIAL AND
    vbak-kvgr3 IS INITIAL AND
    vbak-kvgr4 IS INITIAL AND
    vbak-kvgr5 IS INITIAL.
    SELECT SINGLE vkgrp vkbur kvgr1 kvgr2 kvgr3 kvgr4 kvgr5
    FROM knvv INTO (vbak-vkgrp, vbak-vkbur, vbak-kvgr1, vbak-kvgr2,
    vbak-kvgr3, vbak-kvgr4, vbak-kvgr5)
    WHERE kunnr = kuwev-kunnr AND
    vkorg = vbak-vkorg AND
    vtweg = vbak-vtweg AND
    spart = vbak-spart.
    ENDIF.
    *CODE ABOVE*REPLACED WITH zue_sd_0017***********
    INCLUDE zue_sd_0017.
    *CODE BELOW*REPLACED WITH zue_sd_0017***********
    IF svbak-tabix = 0.
    SELECT SINGLE vsbed FROM knvv INTO vbak-vsbed
    *WHERE kunnr = kuwev-kunnr AND
    vkorg = vbak-vkorg AND
    vtweg = vbak-vtweg AND
    spart = vbak-spart.
    ENDIF.
    *CODE ABOVE*REPLACED WITH zue_sd_0017***********
    Start of DEVK915182
    **Ernesto EDIT for UE DEMO 10/15/2002.
    READ TABLE i_tvarv WITH KEY name = 'ZKS_KSEASORG'.
    IF sy-subrc = 0.
    IF vbak-vkorg = i_tvarv-low.
    IF vbak-vkorg IN i_zsd01_vkorg.
    IF sy-tcode EQ 'VA01'.
    IF sy-dynnr EQ '4021'.
    IF sy-ucomm NE 'SICH'.
    l_pop_type = 'X'.
    INCLUDE zue_sd_0027.
    PERFORM partner_validation USING 'X'.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    end-of DEVK915182
    Project : KSEA - Sales Force Expansion of 1st Jan 2003
    Include for KSEA Sales Org 5010 only for PopUp Windows " 12/23/2002
    INCLUDE zsd_salesforce_expnsn_hdr." Include 1 of 4
    */ Description : KSE Modification to remove the billing block for
    */ returns/credits/debits if sales Org is 5090.
    *ORIGINAL CODE
    *if vbak-vkorg = '5090' and vbak-vbtyp ca 'HKL'.
    *vbak-faksk = ' '.
    *endif.
    IF sy-tcode = 'VA01'.
    IF vbak-vkorg IN i_zsd09_vkorg.
    IF vbak-vbtyp IN i_zsd09_vbtyp.
    vbak-faksk = ' '.
    ENDIF.
    ENDIF.
    ENDIF.
    BREAK-POINT.
    INCLUDE zue_sd_0039.
    ENDFORM.
    *eject
    FORM USEREXIT_MOVE_FIELD_TO_VBAP *
    This userexit can be used to move some fields into the sales *
    dokument item workaerea VBAP *
    SVBAP-TABIX = 0: Create item *
    SVBAP-TABIX > 0: Change item *
    This form is called at the end of form VBAP_FUELLEN. *
    FORM userexit_move_field_to_vbap.
    VBAP-zzfield = xxxx-zzfield2.
    *{ INSERT SNDK900164 1
    Item Category Determination
    DATA: zzbukrs LIKE tvko-bukrs,
    zzmtpos LIKE mvke-mtpos.
    DATA: BEGIN OF zzwerks OCCURS 0,
    werks LIKE marc-werks,
    END OF zzwerks.
    DATA: zdoccat LIKE tvak-vbklt,
    zvmsta LIKE mvke-vmsta,
    zspvbc LIKE tvms-spvbc,
    zvmstb LIKE tvmst-vmstb.
    DATA: z_xvbap LIKE xvbap,
    yp1 LIKE t001k-bwkey,
    z_uepos_bukrs LIKE t001k-bukrs.
    IF i_zsd01_vkorg[] IS INITIAL.
    If the initialization was not performed in the Fill VBAK,
    reload data
    INCLUDE zsdi_mv45afzz_initialization.
    ENDIF.
    SELECT SINGLE bukrs
    INTO zzbukrs
    FROM tvko
    WHERE vkorg = vbak-vkorg.
    SELECT w~werks
    INTO TABLE zzwerks
    FROM t001w AS w JOIN t001k AS k
    ON wbwkey = kbwkey
    WHERE k~bukrs = zzbukrs.
    SELECT SINGLE mtpos INTO zzmtpos
    FROM mvke
    WHERE matnr = vbap-matnr
    AND vkorg = vbak-vkorg
    AND vtweg = vbak-vtweg.
    Export Plant - inport in ZXQSMU07
    EXPORT zz_plant = vbap-werks TO MEMORY ID 'ZZPLANT'. " KN05
    check vbap-pstyv = 'TAN' or vbap-pstyv = 'TANN'.
    removed the CHECK statement and replaced by IF-ENDIF.
    inserted by arvind r kulkarni for TAN, TANN switching
    IF vbap-pstyv = 'TAN' OR vbap-pstyv = 'TANN'
    OR vbap-pstyv = 'REN' " KN02
    OR vbap-pstyv = 'RENN' . " KN02
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    check sy-subrc ne 0.
    IF sy-subrc NE 0.
    IF vbap-pstyv = 'TAN'.
    vbap-pstyv = 'ZAN'.
    ELSEIF vbap-pstyv = 'REN'. " KN02
    vbap-pstyv = 'YREN'. " KN02
    ELSEIF vbap-pstyv = 'RENN'. " KN02
    vbap-pstyv = 'YRNN'. " KN02
    ELSEIF vbap-pstyv = 'TANN'.
    vbap-pstyv = 'ZANN'.
    ENDIF.
    ENDIF.
    ENDIF.
    INCLUDE zue_sd_0014.
    Begin insert for check for discontinued material in repair orders
    LOGIC: For IRAT item categories, check if the material status field *
    blank or populated. *
    If populated, get the value of the D-Chain specific status *
    and issue warning/error message with the associated text *
    from config the D-Chain specific material status. *
    Included YRAT to this logic (YRAT is free IRAT); 11/22/2002. *
    IF vbap-pstyv = 'IRAT' OR vbap-pstyv = 'YRAT'.
    CLEAR: zvmsta, zvmstb, zspvbc.
    SELECT SINGLE vmsta INTO zvmsta FROM mvke WHERE
    matnr = vbap-matnr AND vkorg = vbak-vkorg
    AND vtweg = vbak-vtweg.
    CHECK: NOT zvmsta IS INITIAL.
    IF NOT zvmsta IS INITIAL.
    SELECT SINGLE spvbc INTO zspvbc FROM tvms WHERE
    vmsta = zvmsta.
    SELECT SINGLE vmstb INTO zvmstb FROM tvmst WHERE
    spras = sy-langu AND vmsta = zvmsta.
    CASE zspvbc.
    WHEN 'A'.
    MESSAGE ID 'V1' TYPE 'W' NUMBER '028' WITH zvmsta zvmstb.
    WHEN 'B'.
    MESSAGE ID 'V1' TYPE 'E' NUMBER '028' WITH zvmsta zvmstb.
    ENDCASE.
    ENDIF.
    ENDIF.
    End insert for check for discontinued material in repair orders
    INCLUDE zue_sd_0004.
    INCLUDE zue_sd_0005.
    end of DEVK923935.
    ****************END OF TEST SOURCE CODE******************
    Begin Insert to assign material entered for TRADE material
    Ak; 11/08/2002.
    For trade material, the system will now mandate entry of higher level
    item number and based on this, the system will bring in specialty,
    material number (into material entered) and profit centre from this
    higher level item into the line item for material TRADE.
    Added MVGR2 & 3 to pass onto TRADE material; 11/12/2002 - Arvind.
    Added material a/c assignment grp to trade-in material.
    Added ZTRD item category to this logic. - Arvind 11/18/2002.
    INCLUDE zzsdprc01.
    INCLUDE zue_sd_0028.
    End Insert to assign material entered for TRADE material
    ********************End of DIP Profile change************************
    Get custom group data from MVKE (Sales Data for Material) by Material
    when order type is 'RAS' (Repairs/Service)
    and populate line item's Additional data A
    INCLUDE zue_sd_0006.
    INCLUDE zue_sd_0001.
    include ZUE_SD_0032.
    INCLUDE zue_sd_0002.
    Get similar data (as above) from Servicable Material
    INCLUDE zue_sd_0003.
    *} INSERT
    Determine Delivery Priority from SH Partner
    11/02/2001
    SELECT SINGLE lprio
    FROM knvv
    INTO vbap-lprio
    WHERE kunnr = kuwev-kunnr AND
    vkorg = vbak-vkorg AND
    vtweg = vbak-vtweg AND
    spart = vbak-spart.
    Determine Delivery Priority for Order Type RAS
    INCLUDE zsd_check_pstyv_werks.
    To re-determine Matwa if the replacement item is changed afterwards
    Niranjan 05/10/05 and ECLARKE
    INCLUDE zue_sd_0021.
    Mod for all sales organizations
    Determination of Profit Center
    06/24/03
    INCLUDE zue_sd_0007.
    End PRCTR Determination for KSI's document
    KSI modification
    Code to enter the actual part number of the item being repaired,
    rather than "REPAIR"
    09/18/02 GM
    DATA: intercoflag TYPE c.
    PERFORM zz_determine_cross_comp USING vbak-vkorg
    vbap-werks
    intercoflag.
    IF intercoflag = 'Y'
    AND
    ( vbap-pstyv = 'IRIN' OR vbap-pstyv = 'ZRIN' ).
    SELECT SINGLE matwa INTO vbap-matwa FROM vbap
    WHERE vbeln = vbap-vbeln AND posnr = vbap-uepos.
    IF sy-subrc NE 0.
    MESSAGE e006(z1) WITH vbap-uepos.
    ENDIF.
    ENDIF.
    End material look up modification GM 9/17/02
    KSI modification
    DP90 Only:
    Remove Billing Block from IRIN items and moved them to the header
    10/06/02 CNG
    11/18/2002 Tr-DEVK917363
    Added Sales Orgs 5040 & 5060
    KSI modification
    06/10/2003 CNG CN01
    If IRIN, clear billing block at item level
    IF sy-tcode = 'DP90'.
    IF vbap-werks = '7000' AND vbak-vkorg = '5010' AND" SM01-
    vbap-pstyv = 'IRIN'." SM01-
    IF vbap-werks = '7000' AND" SM01+
    ( vbak-vkorg IN i_zsd01_vkorg OR" SM01+
    vbak-vkorg = '5040' OR" SM01+
    Removed >>
    vbak-vkorg = '5060' )" SM01+ CN01-
    AND vbap-pstyv = 'IRIN'." SM01+ CN01-
    vbak-faksk = '02'.
    Removed <<
    Inserted - check and block for line item IRIN only
    vbak-vkorg = '5060' )." SM01+
    vbak-faksk = '02'.
    IF vbap-pstyv = 'IRIN'." CN01+
    CLEAR vbap-faksp.
    Inserted - check and block for line item IRIN only
    ENDIF.
    ENDIF.
    ENDIF.
    KSI modification
    Routine to populate VBAP-ZZEDATU and VBAP-ZZVDATU on change and
    creation of order
    02/10/03 CNG
    PERFORM check_custom_dates.
    KSE Modification to create return item automatically**
    Copied from Niranjan's routine tested in SND210 Date 04/05/03
    INCLUDE zue_sd_0008.
    User Exit for Service Processing - Clear Results
    Analysis Key in sales order item for non-KSE service
    items. DEVK927084 W. Miller 05/12/2003
    Changed to validate by plant instead of sales org.
    06/30/03 BEGIN>>>
    if not vbak-vkorg = '5090' and vbap-bedae = 'SE'.
    *Added 5000 for KSEM Prjct 02-09-2006 EC
    IF NOT ( vbap-werks = '9000' OR vbap-werks = '5000' )
    AND ( vbap-bedae = 'SE' OR VBAP-BEDAE = 'SERA' ).
    06/30/03 END <<<<
    CLEAR vbap-abgrs.
    ENDIF.
    End of DEVK924084
    */ Author : w/ Trimb.
    */ Date : 10/07/2003 ---> Repair No : DEVK930002
    */ Description : KSE Modification For plant 9000, to check the
    */ material is 'Non-R' for RAS order type
    */ and is 'R' for ZREX and ZWAR order types.
    *Added lines below for - There is a user exit which exists that does
    *not allow materials that do not begin with an "R" to be posted into
    *plant 9000 if they are attached to a ZWAR order type. KSE/KSEA would
    *like to modify this exit to allow materials with profit centers
    *5090-03003 and 5090-04003 to be posted.
    *ECLARKE/Niranjan 07-29-2004
    *________________________n 07-29-2004__________________
    DATA: flag_dexe.
    TABLES: zzue027.
    CLEAR: flag_dexe.
    SELECT SINGLE werks auart prctr INTO (zzue027-werks, zzue027-auart,
    zzue027-prctr) FROM zzue027 WHERE werks = vbap-werks AND auart =
    vbak-auart AND prctr = vbap-prctr.
    IF sy-subrc = 0.
    flag_dexe = 'X'.
    ENDIF.
    *________________________ 07-29-2004__________________
    IF flag_dexe IS INITIAL. " 07-29-2004
    IF vbap-werks IN i_zsd09_werks.
    IF ( vbak-auart IN i_zsd02_auart AND vbap-pstyv IN i_zsd04_pstyv AND
    vbap-matwa(1) = 'R' ) OR ( vbak-auart IN i_zsd02_auart AND
    vbap-pstyv IN i_zsd03_pstyv AND vbap-matnr(1) = 'R' ).
    IF vbap-matwa(1) = 'R'.
    MESSAGE e001(zkse) WITH vbap-matwa vbap-posnr vbak-auart
    vbap-pstyv.
    ENDIF.
    IF vbap-matnr(1) = 'R'.
    MESSAGE e001(zkse) WITH vbap-matnr vbap-posnr vbak-auart
    vbap-pstyv.
    ENDIF.
    ELSEIF ( vbak-auart IN i_zsd03_auart AND vbap-pstyv IN
    i_zsd04_pstyv AND vbap-matwa(1) <> 'R' ) OR ( vbak-auart IN
    i_zsd03_auart AND vbap-pstyv IN i_zsd03_pstyv AND vbap-matnr(1) <> 'R' )
    OR ( vbak-auart IN i_zsd04_auart AND vbap-pstyv IN i_zsd04_pstyv AND
    vbap-matwa(1) <> 'R' ) OR ( vbak-auart IN i_zsd04_auart AND vbap-pstyv
    IN i_zsd03_pstyv AND vbap-matnr(1) <> 'R' ).
    IF vbap-matwa(1) <> 'R'.
    MESSAGE e001(zkse) WITH vbap-matwa vbap-posnr vbak-auart
    vbap-pstyv.
    ENDIF.
    IF vbap-matnr(1) <> 'R'.
    MESSAGE e001(zkse) WITH vbap-matnr vbap-posnr vbak-auart
    vbap-pstyv.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    INCLUDE zue_sd_0015.
    include zue_sd_0019
    Enhancement to populate Storage Location for sales order 5090
    and plant 9000. But any companies can use it as long as entries are
    maintained in table zsd_default_sloc
    Niranjan 02/11/04
    DEVK933987 - MV45AFZZ - MPitisci 4/12/2004
    DEVK933989 - ZUE_SD_0019 include
    DEVK933998 - ZSD_DEFAULT_SLOC table
    INCLUDE zue_sd_0019.
    To give hard error for D-CHin status 07 for items catgories other
    than trade.
    04/10/05
    INCLUDE zue_sd_0034.
    Checks if the storage location value is changed and checks to see if
    the storage location correlates to the P3 Partner function rules
    08/05/2005
    INCLUDE zue_sd_0036.
    INCLUDE zue_sd_0013.
    <b>**************New code********
    INCLUDE ZSD_DEFAULT_BWTAR.
    ********************************</b>
    ENDFORM.
    *eject
    FORM USEREXIT_MOVE_FIELD_TO_VBEP *
    This userexit can be used to move some fields into the sales *
    dokument schedule line workaerea VBEP *
    SVBEP-TABIX = 0: Create schedule line *
    SVBEP-TABIX > 0: Change schedule line *
    This form is called at the end of form VBEP_FUELLEN. *
    FORM userexit_move_field_to_vbep.
    DATA: intercoflag TYPE c.
    VBEP-zzfield = xxxx-zzfield2.
    Assign 'ZP' to Schedule line Category for Acct Assignment Grp =
    Chui 10/23/2001
    DATA: zzbukrs LIKE tvko-bukrs,
    zzmtpos LIKE mvke-mtpos.
    DATA: z_vbelv LIKE vbfa-vbelv," KN03
    z_auart LIKE vbak-auart," KN03
    z_vbtyp LIKE vbak-vbtyp," KN03
    z_ettyp LIKE vbep-ettyp," KN03
    z_pstyv LIKE vbap-pstyv," KN04
    z_posnr LIKE vbap-posnr." KN04
    DATA: BEGIN OF zzwerks OCCURS 0,
    werks LIKE marc-werks,
    END OF zzwerks.
    IF vbak-vbtyp CN 'AB'. "ECLARKE 01-26-04
    SELECT SINGLE bukrs
    INTO zzbukrs
    FROM tvko
    WHERE vkorg = vbak-vkorg.
    SELECT w~werks
    INTO TABLE zzwerks
    FROM t001w AS w JOIN t001k AS k
    ON wbwkey = kbwkey
    WHERE k~bukrs = zzbukrs.
    SELECT SINGLE mtpos INTO zzmtpos
    FROM mvke
    WHERE matnr = vbap-matnr
    AND vkorg = vbak-vkorg
    AND vtweg = vbak-vtweg.
    *lines added for valuated customer-returns project by msn
    110903. It will set required schedule line category YR on specific
    item categories if the document created is of type RE with reference
    document being an invoice of type F2
    *ECLARKE & MILIND NAND. 11-11-2003.
    *Schedule Line Category - Valuate Customer Returns Stock
    INCLUDE zue_sd_0010.
    CASE vbap-pstyv.
    WHEN 'ZRPN'.
    EXIT.
    WHEN 'TAN' OR 'TANN'.
    IF vbkd-ktgrd = '01'. " Added 6/5/02
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ENDIF.
    **Ernesto EDIT for UE DEMO 10/15/2002
    ***************TEST FUNCTION MODULE FOR USER EXIT MAINT.******
    **ADDED A CASE STATEMENT BELOW.
    CALL FUNCTION 'Z_UE_SD_GET_SCHEDULE_LINE_CAT'
    EXPORTING
    pstyv = vbap-pstyv
    ktgrd = vbkd-ktgrd
    ettyp2 = vbep-ettyp
    IMPORTING
    ettyp = vbep-ettyp.
    ****************END OF TEST SOURCE CODE******************
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    check sy-subrc ne 0.
    IF sy-subrc NE 0.
    Change inserted by Arvind R Kulkarni; 07/22/2002
    TAN -> ZAN; TANN => ZANN
    vbap-pstyv = 'ZAN'.
    IF vbap-pstyv = 'TAN'.
    vbap-pstyv = 'ZAN'.
    ELSEIF vbap-pstyv = 'TANN'.
    vbap-pstyv = 'ZANN'.
    ENDIF.
    end of change
    ENDIF.
    *ADDED CASE HERE FOR TEST FOR SYNTAX CHECK 10/15/2002
    *CASE vbap-pstyv.
    WHEN 'ZAN'.
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    CHECK sy-subrc EQ 0.
    vbap-pstyv = 'TAN'.
    WHEN 'ZANN'.
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    CHECK sy-subrc EQ 0.
    vbap-pstyv = 'TANN'.
    WHEN 'ZTAN'.
    IF vbkd-ktgrd = '01'. " Added 6/5/02
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ENDIF.
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    check sy-subrc ne 0.
    IF sy-subrc NE 0.
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ENDIF.
    03/23/2005 KN03 Set Schedule Line default to ZF order type ZFD,
    item cat ZTAN, sales org 5060, 5070, and 5071
    IF vbak-auart EQ 'ZFD' AND
    ( vbak-vkorg = '5060' OR vbak-vkorg = '5070'
    OR vbak-vkorg = '5071' ).
    vbep-ettyp = 'ZF'.
    ENDIF.
    Begin of insertion for IRAT processing
    Arvind R Kulkarni; Dated: 07/17/2002.
    Changed to include YRAT; ; 11/22/2002
    WHEN 'IRAT' OR 'YRAT'.
    IF vbak-auart NE 'ZWAR'.
    the sales order is NOT a ZWAR
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    IF sy-subrc NE 0.
    the transaction IS intercompany
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'YN'.
    ELSE.
    vbep-ettyp = 'YL'.
    ENDIF.
    ELSE.
    the transaction IS NOT intercompany
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZN'.
    ELSE.
    vbep-ettyp = 'ZL'.
    ENDIF.
    ENDIF.
    IF vbkd-ktgrd = '01'.
    sale is to an affiliate in local sales org
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'YN'.
    ELSE.
    vbep-ettyp = 'YL'.
    ENDIF.
    ENDIF.
    ELSE.
    the sales order IS a ZWAR
    READ TABLE zzwerks WITH TABLE KEY werks = vbap-werks.
    IF sy-subrc NE 0.
    the transaction IS intercompany
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ELSE.
    the transaction IS NOT intercompany
    NOTHING NEEDS TO BE DONE FOR ZWAR DOMESTIC
    STD SCHED LINE CATEGORIES TO BE MAINTAINED.
    IF VBEP-ETTYP = 'CN'.
    VBEP-ETTYP = 'ZN'.
    ELSE.
    VBEP-ETTYP = 'ZL'.
    ENDIF.
    ENDIF.
    IF VBKD-KTGRD = '01'.
    sale is to an affiliate in local sales org
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ENDIF.
    ENDIF.
    End of insertion for IRAT processing
    WHEN 'IRRS' OR 'IRRE' OR 'IRLA' OR 'IRLB' OR 'KBN' OR 'TAQ'
    KSI Modification 04/22/03
    Exclude check for item category 'YKW'
    OR 'YTAN' OR 'ZKLN' OR 'KAN' OR 'ZTAQ'
    OR 'YKW' OR 'IRRP' OR 'ZKBC' OR 'ZKBN' OR 'ZKAN' OR 'KLN'.
    or 'ZKEN' OR 'ZKEC' or ZREK OR 'KEN'.
    EXIT.
    WHEN 'ZTR1' OR 'ZRBB' OR 'ZREB' OR 'ZREC' OR 'ZREF' OR 'ZREN'
    Removed ZRTN to validate plant 9000
    OR 'ZRFF' OR 'ZRNB' OR 'ZRNN' OR 'REN' OR 'RENN'
    OR 'ZLN' OR 'IRAL' OR 'ZTR0' OR 'KLN'.
    EXIT.
    03/23/2005 KN03 set default sched line for KE & ZKE
    WHEN 'KEN' OR 'ZKEG' OR 'ZKEN' OR 'ZKEC'.
    IF vbak-vkorg EQ '5070'.
    vbep-ettyp = 'Z0'.
    ENDIF.
    WHEN 'ZREK'.
    INCLUDE zue_sd_0033.
    IF vbap-werks = '9000'. " KN04
    IF vbkd-ktgrd = '01'. " KN04
    IF z_auart = 'ZFD ' and z_pstyv = 'KLN '. " KN04
    vbep-ettyp = 'YK'. " KN04
    ENDIF.
    ENDIF.
    ENDIF.
    KSE Modification 04/10/03
    For Item Cate 'ZRTN'
    Assign 'YQ' to Schedule line cat, if cross-company
    'YU' if not.
    WHEN 'ZRTN'.
    KN03 for KSI set default schedule line for order type ZREK
    INCLUDE zue_sd_0033.
    IF svbep-tabix IS INITIAL.
    IF vbap-werks = '9000'.
    IF vbkd-ktgrd = '01'. " KN04
    IF z_auart = 'ZFD' and z_pstyv = 'KLN '. " KN04
    vbep-ettyp = 'YK'. " KN04
    ELSE. " KN04
    vbep-ettyp = 'YQ'.
    ENDIF.
    ELSE.
    vbep-ettyp = 'YU'.
    ENDIF.
    ENDIF.
    ENDIF.
    KN03 for KSI set default schedule line for order type ZREK
    INCLUDE zue_sd_0033.
    WHEN OTHERS.
    IF vbkd-ktgrd = '01'.
    IF vbep-ettyp = 'CN'.
    vbep-ettyp = 'ZA'.
    ELSE.
    vbep-ettyp = 'ZP'.
    ENDIF.
    ENDIF.
    ENDCASE.
    endif.
    Redetermine Movement Type
    PERFORM tvep_select(sapmv45a) USING vbep-ettyp
    charx
    sy-subrc.
    vbep-bwart = tvep-bwart.
    ENDIF.
    KSE Mod
    User Exit for Repair Replacement
    Export VBEP-ETTYP, imported by RV64A950
    04/18/03
    EXPORT i_ettyp = vbep-ettyp TO MEMORY ID 'ZZSCHEDULE'.
    **lines added for valuated customer-returns project by msn
    110903. It will set required schedule line category YR on specific
    item categories if the document created is of type RE with reference
    document being an invoice of type F2
    **. 11-11-2003.
    **Schedule Line Category - Valuate Customer Returns Stock
    BREAK-POINT.
    INCLUDE zue_sd_0010.
    *KSEA Modification to default item creation date for the IRAT
    *line item schedule line. SAP Note 23281
    04/01/04
    INCLUDE zue_sd_0020.
    ENDFORM.
    *eject
    FORM USEREXIT_MOVE_FIELD_TO_VBKD *
    This userexit can be used to move some fields into the sales *
    dokument business data workaerea VBKD *
    SVBKD-TABIX = 0: Create data *
    SVBKD-TABIX > 0: Change data *
    This form is called at the end of form VBKD_FUELLEN. *
    FORM userexit_move_field_to_vbkd.
    VBKD-zzfield = xxxx-zzfield2.
    Get Customer group, Price group and Price list type *
    by Ship-to party
    10/04/2001
    DATA: yp1 LIKE t001k-bwkey,
    z_uepos_bukrs LIKE t001k-bukrs.
    *Request by Customer Service - Marian Favors 11-08-2004
    TABLES: zzue030. "ECLARKE 11-08-2004
    SELECT SINGLE tcode INTO zzue030-tcode FROM zzue030
    WHERE tcode = sy-tcode. "ECLARKE 11-08-2004
    IF sy-subrc = 0. "ECLARKE 11-08-2004
    Removed check for customer group as this was required by Steve Ludewig
    IF " vbkd-kdgrp IS INITIAL AND "Arvind Kulkarni; 08/05/2002.
    vbkd-konda IS INITIAL AND
    vbkd-pltyp IS INITIAL.
    SELECT SINGLE kdgrp konda pltyp bzirk
    INTO (vbkd-kdgrp, vbkd-konda, vbkd-pltyp, vbkd-bzirk)
    FROM knvv
    WHERE kunnr = kuwev-kunnr
    AND vkorg = vbak-vkorg
    AND vtweg = vbak-vtweg
    AND spart = vbak-spart.
    ENDIF.
    ENDIF. "ECLARKE 11-08-2004
    Redetermine Schedule line Category if Acct Assignment Grp is changed
    to
    Chui 10/23/2001
    IF svbkd-tabix > 0 AND sy-dynnr = '4311'.
    IF vbkd-ktgrd = '01' AND vbep-ettyp <> 'ZP'.
    PERFORM userexit_move_field_to_vbep.
    ENDIF.
    ENDIF.
    INCLUDE zzsdprc01.
    To make the value of the field VBAK-ZUONR same as VBKD-BSTKD
    05/04/04
    vbak-zuonr = vbkd-bstkd.
    ENDFORM.
    *eject
    FORM USEREXIT_NUMBER_RANGE *
    This userexit can be used to determine the numberranges for *
    the internal document number. *
    US_RANGE_INTERN - internal number range *
    This form is called from form BELEG_SICHERN *
    FORM userexit_number_range USING us_range_intern.
    Example: Numer range from TVAK like in standard
    US_RANGE_INTERN = TVAK-NUMKI.
    ENDFORM.
    *eject
    FORM USEREXIT_PRICING_PREPARE_TKOMK *
    This userexit can be used to move additional fields into the *
    communication table which is used for pricing: *
    TKOMK for header fields *
    This form is called from form PREISFINDUNG_VORBEREITEN. *
    FORM userexit_pricing_prepare_tkomk.
    TKOMK-zzfield = xxxx-zzfield2.
    *{ INSERT SNDK900075 1
    tkomk-aland = t001-land1.
    *} INSERT
    Fill Zip code with Ship-to party's
    tkomk-post_code1 = kuwev-pstlz.
    ENDFORM.
    *eject
    FORM USEREXIT_PRICING_PREPARE_TKOMP *
    This userexit can be used to move additional fields into the *
    communication table which is used for pricing: *
    TKOMP for item fields *
    This form is called from form PREISFINDUNG_VORBEREITEN. *
    FORM userexit_pricing_prepare_tkomp.
    TKOMP-zzfield = x

  • Exit MV45AFZZ is not working as per our requirement

    Hi Friends,
    In the transaction 'VA02' based on the Sales Order type and the Delivery Block I want to change the Schedule line category in the Sales Order item. We used the exit MV45AFZZ (FORM USEREXIT_SAVE_DOCUMENT_PREPARE) and it changes the Schedule line category as per our requirement.
    The problem is that once the Sales Order is saved with the new Schedule line category it does not transfer the requirements to the Stock/Requirements List(Transaction MD04). But if we change the Schedule line category in Sales Order manually (without using the exit) then the requirements are transfered to the Stock/Requirements List which we can see against that Material in the Transaction MD04. Could you kindly help.
    Regards

    Hi Raju,
    The below code only triggers
    FORM USEREXIT_MOVE_FIELD_TO_VBKD.
    VBKD-zzfield = xxxx-zzfield2.
    ENDFORM.
    when there is some manual change done on the Schedule line. So the control of the program will not stop on this form. Kindly suggest.
    Regards
    Siddharth

  • Elementry Seach help is not working as per requirement.........plsss help

    Hi Friends,
    Here is my query on Sap Search help.
    I have created a customised elelemtary search help zclarify in the table EKKO for the field  zf_clarify.
    This search help i have created under the collective search help MEKK and the included search help ASH_MEKK.
    Now my probelem is whenever i am trying to seach the PO using the table by using the zf_clarify as the reference i am not getting anything.
    Ex- if you to to the selection criteria screen of EKKO table and try to searhch for any particular Purchase Order by selecting the PO,that po number will display in the selection screen.Similarly if i am trying to search through clarify option i am not getting any value in the clarify field.
    Please help me where i am doing wrong, I have one confusion that while creating the Data Element there is a search help option,there i have given MEKK and zclarify,but i am not getting any value in the table seletion screen.
    Please give me idea how to create the search help so that my problem will solve.
    Thanks a lot
    mrutyu n^

    Hi Raju,
    The below code only triggers
    FORM USEREXIT_MOVE_FIELD_TO_VBKD.
    VBKD-zzfield = xxxx-zzfield2.
    ENDFORM.
    when there is some manual change done on the Schedule line. So the control of the program will not stop on this form. Kindly suggest.
    Regards
    Siddharth

  • Incoterm to be derived from Ship to party in sales order creation via va02

    Hi Experts,
    I have a requirement.
    When a new sales order is created from the screen va02, the inco term flows from the sold to party.
    It should infact flow from the ship to party.
    So standard SAP  SAP derives the incoterms from the sold-to -party when creating saloes order from the va02 screen.
    we should implement user exit for this.
    I just did a little bit of search and got the info that the euxt should be done in MV45AFZZ. in the FORM USEREXIT_MOVE_FIELD_TO_VBKD
    If anyone has worked on this please share your code details of things to be considered.
    Regs,
    SuryaD.

    Hi Experts,
    Found the solution.
    TCode SE38,
    In program MV45AFZZ, in FORM USEREXIT_MOVE_FIELD_TO_VBKD:
    IF us_posnr = 0 AND svbkd-tabix GT 0 AND NOT kuwev-inco1 IS INITIAL.
        vbkd-inco1 = kuwev-inco1.
        vbkd-inco2 = kuwev-inco2.
    ENDIF.
    SVBKD_TABIX = 0 means that you are in the creation mode (VA01),
    SVBKD_TABIX>0 means we are in the change mode(VA02)
    US_POSNR = 0 means that there is no position number for the item yet.
    Regs,
    SuryaD.

  • Copy selection criteria from quotation to Sales order

    Hi Experts,
    I am creating a quotation. For the quotation line item, i am going to batch determination. Then i am clicking the SELECTION CRITERIA button. It gives me the batch characteristics screen. There i am entering the values to the characteristics. While coming back to sales order screen, i am copying only the SELECTION CRITERIA ( i am not copying the batches ).
    I am creating a sales order w.r.t the quotation. I want the selection criteria of the quotation line item to be copied into sales order line item. How to proceed for this?
    I checked the copy control in VTAA. But i am not able to find any configuration to copy a Quotation line item "SELECTION CRITERIA" to a sales order line item.
    Is this possible via a configuraton or thorugh any user exit?
    Thanks,
    Niranjan.

    Hi,
        Check the exit in programs MV45AFZZ (FORM USEREXIT_MOVE_FIELD_TO_VBKD) as u are using purchase order text.
    Regards

  • Auto update of Valid to and Payment Terms field

    Hi,
    I have a scenario, where based on the Net value of the document, Valid To date of the Quotation and Payment Terms should auto populate.
    Ex: If Net value is above 5lks, then payment terms should be 100% with in 20 days from current day and valid to date is also 20 days from now. Like wise, if Net value is below 5lks, then payment terms and valid to date should be 10 days.
    Thanks for response in advance.
    Vam

    Hi,
    Please check if the following user exits help.
    USEREXIT_MOVE_FIELD_TO_VBAK
    Use this user exit to assign values to new fields at sales document header level. It is described in the section "Transfer of the customer master fields into the sales document".
    The user exit is called up at the end of the FORM routine VBAK_FUELLEN.
    USEREXIT_MOVE_FIELD_TO_VBKD
    Use this user exit to assign values to new fields for business data of the sales document. It is described in the section "Copy customer master fields into sales document" .
    The user exit is called up at the end of the FORM routine VBKD_FUELLEN.
    Regards,
    P Gomatheeswaran

  • Adding new field to sale order BDOC and replicate to R3

    Hi all,
    I'm trying to map the new customize field in CRM to field VBKD-VSART in R3.
    The reason behind this  was because my customer would like to have field shipping type appear in CRM order, but since this field is not provided by SAP, I've to create it. 
    What I did was:
    1) Create new field VSART via EEWB in CRM. This is done and working fine, the field appeared in 'customer fields' tab.
    2) Put this new field to BDOC in CRM.  I believe this is done when I created via EEWB. I think it use BADI CRM_BTX_EXTENSIONS , implementation CRM_GEN_OBJECTS for this part.
    3) Put BDOC into BAPI in CRM.  This is the part that I'm having a problem with.
    I found that I need to use BADI CRM_DATAEXCHG_BADI for that and I've checked example from implementation CRM_BTX_EEW_DATAEXCH. However, it only contain example to input field in VBAK, VBAP and VBEP.  Can anyone guide me on this part?
    4) Map BAPI to R3. I think that I need to use userexit MV45AFZZ form USEREXIT_MOVE_FIELD_TO_VBKD for that. But what is the incoming structure that I could use to map with VBKD.
    Any help would be appreciate, Thank you in advance.
    Gilbert

    Hello Gilbert,
    Please find if this helps,
    BDOC's to update the custom fields in R/3 from the CRM sales order
    Replication of new customer fields in order to R/3
    regards,
    Muralidhar Prasad Chatna.

  • What are the User Exits for Sales Order creation process?

    Hi,
    what are the User Exits for Sales Order creation process? how can I find them?
    thanks in advance,
    will reward,
    Mindaugas

    Please check this info:
    User Exits In Sales Document Processing
    This IMG step describes additional installation-specific processing in sales document processing. In particular, the required INCLUDES and user exits are described.
    Involved program components
    System modifications for sales document processing affect different areas. Depending on the modification, you make the changes in the program components provided:
    MV45ATZZ
    For entering metadata for sales document processing. User-specific metadata must start with "ZZ".
    MV45AOZZ
    For entering additional installation-specific modules for sales document processing which are called up by the screen and run under PBO (Process Before Output) prior to output of the screen. The modules must start with "ZZ".
    MV45AIZZ
    For entering additional installation-specific modules for sales document processing. These are called up by the screen and run under PAI (Process After Input) after data input (for example, data validation). The modules must start with "ZZ".
    MV45AFZZ and MV45EFZ1
    For entering installation-specific FORM routines and for using user exits, which may be required and can be used if necessary. These program components are called up by the modules in MV45AOZZ or MV45AIZZ.
    User exits in the program MV45AFZZ
    The user exits which you can use for modifications in sales document processing are listed below.
    USEREXIT_DELETE_DOCUMENT
    This user exit can be used for deleting data which was stored in a separate table during sales document creation, for example, if the sales document is deleted.
    For example, if an additional table is filled with the name of the person in charge (ERNAM) during order entry, this data can also be deleted after the sales order has been deleted.
    The user exit is called up at the end of the FORM routine BELEG_LOESCHEN shortly before the routine BELEG_SICHERN.
    USEREXIT_FIELD_MODIFICATION
    This user exit can be used to modify the attributes of the screen fields.
    To do this, the screen fields are allocated to so-called modification groups 1 - 4 and can be edited together during a modification in ABAP. If a field has no field name, it cannot be allocated to a group.
    The usage of the field groups (modification group 1-4) is as follows:
    Modification group 1: Automatic modification with transaction MFAW
    Modification group 2: It contains 'LOO' for step loop fields
    Modification group 3: For modifications which depend on check tables or on other fixed information
    Modification group 4: is not used
    The FORM routine is called up for every field of a screen. If you require changes to be made, you must make them in this user exit.
    This FORM routine is called up by the module FELDAUSWAHL.
    See the Screen Painter manual for further information on structuring the interface.
    USEREXIT_MOVE_FIELD_TO_VBAK
    Use this user exit to assign values to new fields at sales document header level. It is described in the section "Transfer of the customer master fields into the sales document".
    The user exit is called up at the end of the FORM routine VBAK_FUELLEN.
    USEREXIT_MOVE_FIELD_TO_VBAP
    Use this user exit to assign values to new fields at sales document item level. It is described in the section "Copy customer master fields into the sales document".
    The user exit is called up at the end of the FORM routine VBAP_FUELLEN.
    USEREXIT_MOVE_FIELD_TO_VBEP
    Use this user exit to assign values to new fields at the level of the sales document schedule lines.
    The user exit is called up at the end of the FORM routine VBEP_FUELLEN.
    USEREXIT_MOVE_FIELD_TO_VBKD
    Use this user exit to assign values to new fields for business data of the sales document. It is described in the section "Copy customer master fields into sales document".
    The user exit is called up at the end of the FORM routine VBKD_FUELLEN.
    USEREXIT_NUMBER_RANGE
    Use this user exit to define the number ranges for internal document number assignment depending on the required fields. For example, if you want to define the number range depending on the sales organization (VKORG) or on the selling company (VKBUR), use this user exit.
    The user exit is called up in the FORM routine BELEG_SICHERN.
    USEREXIT_PRICING_PREPARE_TKOMK
    Use this user exit if you want to include and assign a value to an additional header field in the communication structure KOMK taken as a basis for pricing.
    USEREXIT_PRICING_PREPARE_TKOMP
    Use this user exit if you want to include or assign a value to an additional item field in the communication structure KOMP taken as a basis for pricing.
    USEREXIT_READ_DOCUMENT
    You use this user exit if further additional tables are to be read when importing TA01 or TA02.
    The user exit is called up at the end of the FORM routine BELEG_LESEN.
    USEREXIT_SAVE_DOCUMENT
    Use this user exit to fill user-specific statistics update tables.
    The user exit is called up by the FORM routine BELEG-SICHERN before the COMMIT command.
    Note
    If a standard field is changed, the field r185d-dataloss is set to X. The system queries this indicator at the beginning of the safety routine. This is why this indicator must also be set during the maintenance of user-specific tables that are also to be saved.
    USEREXIT_SAVE_DOCUMENT_PREPARE
    Use this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.
    The user exit is carried out at the beginning of the FORM routine BELEG_SICHERN.
    User exits in the program MV45AFZA
    USEREXIT_MOVE_FIELD_TO_KOMKD
    Use this user exit to include or assign values to additional header fields in the communication structure KOMKD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination".
    USEREXIT_MOVE_FIELD_TO_KOMPD
    Use this user exit to include or assign values to additional item fields in the communication structure KOMPD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination".
    USEREXIT_MOVE_FIELD_TO_KOMKG
    Use this user exit to include or assign values to additional fields in the communication structure KOMKG taken as a basis for material determination and material listing. This is described in detail in the section "New fields for listing/exclusion".
    USEREXIT_MOVE_FIELD_TO_KOMPG
    Use this user exit to include or assign values to additional fields in the communication structure KOMPG taken as a basis for material determination and material listung. This is described in detail in the section "New fields for listing/exclusion".
    USEREXIT_REFRESH_DOCUMENT
    With this user exit, you can reset certain customer-specific fields as soon as processing of a sales document is finished and before the following document is edited.
    For example, if the credit limit of the sold-to party is read during document processing, in each case it must be reset again before processing the next document so that the credit limit is not used for the sold-to party of the following document.
    The user exit is executed when a document is saved if you leave the processing of a document with F3 or F15.
    The user exit is called up at the end of the FORM routine BELEG_INITIALISIEREN.
    User-Exits in program MV45AFZB
    USEREXIT_CHECK_XVBAP_FOR_DELET
    In this user exit, you can enter additional data for deletion of an item. If the criteria are met, the item is not deleted (unlike in the standard system).
    USEREXIT_CHECK_XVBEP_FOR_DELET
    In this user exit, you can enter additional data for deletion of a schedule line. If the criteria are met, the schedule line is not deleted (unlike in the standard system).
    USEREXIT_CHECK_VBAK
    This user exit can be used to carry out additional checks (e.g. for completion) in the document header. The system could, for example, check whether certain shipping conditions are allowed for a particular customer group.
    USEREXIT_CHECK_VBAP
    This user exit can be used to carry out additional checks (e.g. for completion) at item level.
    USEREXIT_CHECK_VBKD
    The user exit can be used to carry out additional checks (e.g. for completion) on the business data in the order.
    USEREXIT_CHECK_VBEP
    This user exit can be use to carry out additional checks (e.g. for completion) on the schedule line. During BOM explosion, for example, you may want certain fields to be copied from the main item to the sub-items (as for billing block in the standard system).
    USEREXIT_CHECK_VBSN
    You can use this user exit to carry out additional checks (e.g. for completion) on the serial number.
    USEREXIT_CHECK_XVBSN_FOR_DELET In this user exit, you can enter additional criteria for deletion of the serial number. If the criteria are met, the serial number is not deleted (unlike in the standard system).
    USEREXIT_FILL_VBAP_FROM_HVBAP
    You can use this user exit to fill additional fields in the sub-item with data from the main item.
    USEREXIT_MOVE_FIELD_TO_TVCOM_H
    You can use this user exit to influence text determination for header texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.
    USEREXIT_MOVE_FIELD_TO_TVCOM_I
    You can use this user exit to influence text determination for item texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.
    User-Exits for product allocation:
    The following user exits all apply to structure COBL, in which the data for account determination is copied to item level.
    USEREXIT_MOVE_FIELD_TO_COBL
    Option to include new fields in structure COBL.
    USEREXIT_COBL_RECEIVE_VBAK
    Option to assign values from the document header to the new fields.
    USEREXIT_COBL_RECEIVE_VBAP
    Option to supply values from the item to the new fields.
    USEREXIT_COBL_SEND_ITEM
    A changed field can be copied from the structure into the item. You could use the user exit to display a certain field in the account assignment block (see also MV45AFZB).
    USEREXIT_COBL_SEND_HEADER
    A changed field can be copied from the structure to the header (see source text MV45AFZB)
    USEREXIT_SOURCE_DETERMINATION
    You can use this user exit to determine which plant will be used for the delivery. In the standard system, the delivering plant is copied from the customer master or the customer-material info record. If you want to use a different rule, then you must enter it in this user exit.
    USEREXIT_MOVE_FIELD_TO_ME_REQ
    With this user exit you can include additional fields for the following fields:
    EBAN (purchase requisition)
    EBKN (purchase requisition-account assignment)
    USEREXIT_GET_FIELD_FROM_SDCOM
    Option to include new fields for the variant configuration. Fields that are included in structure SDCOM can be processed and then returned to the order.
    USEREXIT_MOVE_WORKAREA_TO_SDWA
    You can use this user exit to format additional work areas for the variant configuration. You will find notes on the user exit in MV45AFZB.
    User-Exits for first data transfer:
    The following user exits can only be used for the first data transfer.
    Note
    Only use the user exits if the names/fields do NOT have the same name.
    USEREXIT_MOVE_FIELD_TO_VBAKKOM
    Option to include additional fields in structure VBAKKOM (communiction fields for maintaining the sales document header)
    USEREXIT_MOVE_FIELD_TO_VBAPKOM
    Option to include additional fields in structure VBAPKOM (communication fields for maintaining a sales item)
    USEREXIT_MOVE_FIELD_TO_VBEPKOM
    Option to include additional fields in structure VBEPKOM (communication fields for maintaining a sales document schedule line)
    USEREXIT_MOVE_FIELD_TO_VBSN
    You can use this user exit to include fields in structure VBSN (scheduling agreement-related change status).
    USEREXIT_MOVE_FIELD_TO_KOMKH
    You can use this user exit to include new fields for batch determination (document header).
    USEREXIT_MOVE_FIELD_TO_KOMPH
    You can use this user exit to include new fields for batch determination (document item).
    USEREXIT_CUST_MATERIAL_READ
    You can use this user exit to set another customer number in the customer material info record (e.g. with a customer hierarchy)
    USEREXIT_NEW_PRICING_VBAP
    Option for entry of preconditions for carrying out pricing again (e.g. changes made to a certain item field could be used as the precondition for pricing to be carried out again). Further information in MV45AFZB.
    USEREXIT_NEW_PRICING_VBKD
    Option for entry of preconditions for carrying out pricing again (e.g. changes to the customer group or price group could be set as the preconditions for the system to carry out pricing again). Further information in MV45AFZB.
    User-Exits in Program MV45AFZD
    USEREXIT_CONFIG_DATE_EXPLOSION
    The BOM is exploded in the order with the entry date. You can use this user exit to determine which data should be used to explode the BOM (explosion with required delivery date, for example).
    User exits in the program FV45EFZ1
    USEREXIT_CHANGE_SALES_ORDER
    In the standard SAP R/3 System, the quantity and confirmed date of the sales document schedule line is changed automatically if a purchase requisition is allocated, and it or the sales document is changed (for example, quantity, date).
    If you want to change this configuration in the standard system, you can define certain requirements in order to protect your sales orders from being changed automatically. Use this user exit for this purpose. Decide at this point whether the schedule lines are to be changed.
    User-Exits in Program RV45PFZA
    USEREXIT_SET_STATUS_VBUK
    In this user exit you can you can store a specification for the reserve fields in VBUK (header status). Reserve field UVK01 could, for example, be used for an additional order status (as for rejections status, etc.).
    The following workareas are available for this user exit:
    VBUK (header status)
    FXVBUP (item status)
    FXVBUV (Incompletion)
    USEREXIT_SET_STATUS_VBUP
    In this user exit you can you can store a specification for the reserve fields for VBUP (item status).
    The following workareas are available for this user exit:
    FXVBAP (Item data)
    FXVBAPF (Dynamic part of order item flow)
    FXVBUV (Incompletion)
    USEREXIT_STATUS_VBUK_INVOICE
    You can use this user exit to influence billing status at header level.
    User exits in the screens
    Additional header data is on screen SAPMV45A 0309, additional item data on screen SAPMV45A 0459. These screens contain the Include screens SAPMV45A 8309 or SAPMV45A 8459 as user exits.
    Fields which are also to be included in the sales document for a specific installation should be included on the Include screens for maintaining. If an application-specific check module is needed for the fields, this can be included in the Include MV45AIZZ. The module is called up in the processing logic of the Include screens.
    For field transports, you do not have to make changes or adjustments.
    Example
    A new field, VBAK-ZZKUN, should be included in table VBAK.
    If the check is defined via the Dictionary (fixed values or check table) the field must be included with the fullscreen editor in the Include screen SAPMV45A 8309. In this case, no change has to be made to the processing logic.
    User Exits in Program MV45AFZ4
    USEREXIT_MOVE_FIELD_TO_KOMK
    You can use this user exit to add or edit additional header fields in the communication structure - KOMK- for free goods determination. For more information, see the New Fields for Free Goods Determination IMG activity.
    USEREXIT_MOVE_FIELD_TO_KOMP
    You can use this user exit to add or edit additional item fields in the communication structure KOMP for free goods determination. For more information see the New Fields for Free Goods Determination IMG activity.
    User Exits in the SAPFV45PF0E and SAPFV45PF0C Programs
    EXIT_SAPFV45P_001
    You can use this user exit to decide whether intercompany billing data is used in the profitability segment for cross-company code sales, or whether the data comes from external billing (external customer, sales data from the selling company code.
    Regards
    Eswar

  • Restrict Shipping conditions on the Sales Orde Header Document

    Hi,
    I have a unique requirement
    We have a large pool of shipping conditions for our products namely
    Overnight
    One day
    Ground
    International
    Saturday Delivery etc
    Hazard Overnight
    Hazard Ground
    We have a few hazardous materials for which we want to restrict the shipping conditions to only 2
    i.e
    Hazardous Overnight
    Hazardous 3 Day
    in sales order creation.
    What i mean is tht any time a sales order is created for these hazardous material,the customer service representative should not be able to select any other shipping conditions expect
    Hazardous Overnight
    Hazardous 3 Day
    In Standard SAP we can have the shipping condition defaulted from the customer master in the sales document.However if required we can manually go and change the shipping conditions to any thing different.
    How can i restrict this for specific materials though?
    Thanks

    >
    Dspsac wrote:
    > What i mean is tht any time a sales order is created for these hazardous material,the customer service representative should not be able to select any other shipping conditions expect
    >
    > Hazardous Overnight
    > Hazardous 3 Day
    > Thanks
    If the question is "can we limit the list that appears in the drop-down box to these 2 selections" then the answer is "No".
    But in a user exit you can trigger an error message if the users select an invalid shipping condition. As correctly suggested above, this can be done in MV45AFZZ include.
    There are various routines that are triggered at different times. You may be able to use USEREXIT_MOVE_FIELD_TO_VBAP or USEREXIT_MOVE_FIELD_TO_VBKD (if "shipping conditions" are stored in VBKD-VSART).

  • Item & Discount added in the Sales Order

    Dear All,
    I have a requirement where in once a Sales Order is created with approved Quotation, then no new extra items to be added in the sales order.
    Quantity in the existing line item can be decreased to the lower side but no addition in quantity to be done.
    Also no change in discount condition  types to be done.
    Please suggest the approprite Config. If there is no standard config, then please suggest the code which needs to be written in the approprite Userexit.
    Best solution will be rewarded.
    Thanks and regards,
    Dilip Kumar Rao

    Hi,
    To restrict creation of new items and to restrict addition of quantity to existing items, use following user-exits and coding.
    Program : MV45AFZB
    FORM USEREXIT_CHECK_VBAP USING US_DIALOG.
    *{   INSERT         D50K904678                                        1
      if sy-tcode eq 'VA01' or sy-tcode eq 'VA02'.
        check vbap-vgbel <> space and vbap-vgpos <> space.
        read table vvbap with key vbeln = vbap-vgbel
                                  posnr = vbap-vgpos.
        if sy-subrc eq 0.
          if vbap-kwmeng gt vvbap-kwmeng.
            message e499(sy) with
              'Quantity entered is greater then referenced'.
          endif.
        endif.
      endif.
    *}   INSERT
    ENDFORM.
    Program : MV45AFZZ
    FORM USEREXIT_MOVE_FIELD_TO_VBKD.
      if sy-tcode eq 'VA01' or sy-tcode eq 'VA02'.
        loop at xvbap where vgbel eq space
                      and   updkz eq 'I'.
          exit.
        endloop.
        if sy-subrc eq 0.
          message e499(sy) with 'New Item is not allowed'.
        endif.
      endif.
    ENDFORM. 
    -Alpesh

Maybe you are looking for

  • Schedule lines generated on wrong date

    Dear Experts, In my scenario I am creating a Sales schedule & running MRP to generating Purchasing Schedule lines for the Brought Out parts(BOP). Here Planned delivery time is =10 days (MRP2). There is dependent req. for a BOP u201CXu201D as per belo

  • Since updating to IOS 8.1 on ipad mini can't download apps.  Apps show "waiting." Have reset to new condition with no improvement.  Any solution?

    Since updating to IOS 8.1 on ipad mini can't download apps from iTunes store.  Apps show "waiting." Have reset to new condition with no improvement.  Also turned off Wi-Fi and re-connected.   Any solution?  Thanks,

  • Unable to digitally sign

    I have a form created that multiple people go in and sign, but one person in particular always gets the message "The file may be read-only, or another user may have it open.  Please......."  I know what that usually means but in this case there's no

  • JDK1.1.8 'Random'

    Hi Im having a problem compiling my program that requires a random generator. The error says I have passed the wrong number of arguments, but I have taken my example straight from the textbook I am using. I am wondering if this is a version issue or

  • Original application file Text search

    Hi DMS Gurus, we Have a common requirement of finding the DIR by using the word or sentence present inside the Original application file. can any one please let me know the complete requirement for this, is this feature inbuilt in standard DMS system