Userexit_move_field_to_vbap.

i have added a new column  in the screen 4900 of sales order which corresponds to the field zzitbsez in vbap table . i have added this field in vbap . I wrote code in userexit_move_field_to_vbap to move values
MOVE xVBAP-ZZITBSEQ TO VBAP-ZZITBSEQ. in mv45afzz
But the problem comes when i enter some value in this column in VA01 transaction, the debugger does not even goto this code part.

Hi,
Since you want to update vbap at item level with the new field you have inserted, write your logic in
FORM USEREXIT_SAVE_DOCUMENT_PREPARE and loop table XVBAP with the number of line items and update table VBAP finally with commit.
This should work with FORM USEREXIT_MOVE_FIELD_TO_VBAP , try checking VBAP after the sales order is saved if there is any entry in your new field. Try inserting just a breakpoint and comment your logic and see if it stops there at the time of order processing.
Regards,
Amit

Similar Messages

  • Doubt in Include MV45AFZZ - form userexit_move_field_to_vbap

    Hello ,
    When user enters material at line item in VA01 , to throw a pop-up mentioning texts .
    I have added a include in form userexit_move_field_to_vbap in which i declared a internal table containing material number and item number .
    First i import this table from memory so nothing was there and it throws a popup after checks .
    And then export the same table .
    Now suppose the user enters again the same material and line item no popup will come .
    Problem : Suppose the user doesnt save the order and come out , the record remains in the exported table and doesnt display popup .
    Please help .

    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.

  • FORM USEREXIT_MOVE_FIELD_TO_VBAP.

    Hi all,
    Reqirement: To display STCEG(vat reg num) on VA01, 02 and 03 transactions.
    I have added field zz_stceg to VBAP table. Then in "userexit_move_field_to_vbap", i have coded to move stceg from TKOMK to VBAP as follows.
    VBAP-zz_stceg = TKOMK-STCEG.  (because i need to take STCEG value from KOMK structure.)
    after that, i have added zz_stceg field to screen.
    But in transactions VA01, 02 and 03 it is showing empty field.
    Please suggest me how to proceed.
    Thnaks & regards,
    NarsiReddy.

    Hi Narsi,
    Please note that KOMK is a structure, hence it wont be having any values. There should be another table which will hold the value for STCEG. Please find that table from your functional people. After that find the relationship of that table with VBAP. then write your code to fill the data in the VBAP table.
    Foe filling the data in VBAP table it is not necessary that you should code in the user exit. you can even do it in a normal Z report program. Once you find entries in VBAP table for the field ZZSTCEG, then drag it to the screen.
    Hope you understand. Please try this from your end.
    Thanks and regards,
    Satish

  • Sales Order Create - MV45AFZZ - Userexit_move_field_to_vbap

    Hi There,
    Can anyone tell me how many times the userexit "Userexit_move_field_to_vbap" will be executed in VA01 transaction....
    My requirement is to update VBAP-KWMENG field by KOMV-KAWRT filed...Since pricing takes place after the userexit "serexit_move_field_to_vbap" was executed, I couldn't update the value.
    If the same userexit triggers after pricing takes place, then I can update the value easily...
    Your help is greatly appreciated...
    Regards,
    Geetha

    Hi,
    Q1) Can anyone tell me how many times the userexit "Userexit_move_field_to_vbap" will be executed in VA01 transaction....
    Ans: This userexit will be executed (min) for each line item that you have in your sales order...
    So the nos of line items you have , the nos of times it will execute.
    Also you can update the field VBAP-KWMENG at "USEREXIT_PRICING_PREPARE_TKOMP" instead of "Userexit_move_field_to_vbap".
    Try to debug, debugging is the best way to analyse user exits..
    For any clarifications, reply...
    Regards,
    Fawaz
    Edited by: Fawaz Sheikh on Jun 26, 2008 9:09 AM
    Edited by: Fawaz Sheikh on Jun 26, 2008 9:10 AM
    Edited by: Fawaz Sheikh on Jun 26, 2008 9:24 AM

  • 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

  • Remessa de Entrega Futura

    Senhores tenho o seguinte problema:
    Estamos em processo de implantanção do sap na empresa, e ainda tudo é novo, mas tenho uma duvida sobre o faturamento antecipado.
    No processo cria-se uma ordem para faturamento antecipando (entrega futura) e um documento de faturamento relacionado a esta ordem, até este ponto tudo bem.
    O problema esta na criação das notas de remessa relacionadas ao faturamento antecipado, cria-se uma ordem relacionando o faturamento antecipado mas o Sap nao controla o saldo do faturamento antecipado, trazendo para a ordem sempre a quantidade total faturada antecipadamente.
    O exemplo seria assim:
    Entrega Futura: 100
    Remessa Entrega Futura 1: Saldo 100 Quantidade Utilizada 10 Saldo Restante 90
    Remessa Entrega Futrua 2: Saldo 90   Quantidade Utilizada 20 Saldo Restante 70
    E assim por diante, até zerar o saldo de faturamento futuro.
    Gostaria de saber se tem como controlar este saldo

    Olá Petrúcio,
    O cenário de venda/entrega futura é muito comum nas empresas, porém a SAP não criou essa consistência/inteligência de controlar o saldo das quantidades na remessa.
    Ao mesmo tempo, também não faz para uma simples devolução. As quantidades não são controladas, daquilo que vendeu, daquilo que foi devolvido.
    Quando ocorre a  referencia o sistema simplesmente copia o campo da quantidade e não realiza a verificação se o campo é ou não maior.                                                                               
    A única alternativa para que o sistema atenda as necessidades do negócio,nesse caso, é modificando essa funcionalidade padrão. Veja as sugestões abaixo:                                                                               
    1. Verificar por meio das userexist se o campo está com a quantidade maior que a fatura. Podes usar, por exemplo, a userexit:    
    USEREXIT_CHECK_VBAP -> MV45AFZB ou                                     
    USEREXIT_MOVE_FIELD_TO_VBAP -> MV45AFZZ                                                                               
    2. Bloquear a modificação da quantidade do campo, a userexist USEREXIT_FIELD_MODIFICATION -> MV45AFZZ é uma sugestão para que o campo seja copiado e não modificado o seu valor.                             
    Espero poder ter ajudado.
    Ruy Castro

  • Material text is not getting updated in the VBAP table

    Hi All,
    There is an customized field in the sales order which picks up the addition material information maintained for a material. When we create the sales order the text appears. After we save the sales order, when we open the sales order(VA01/VA02), the text does not appear. If you check the VBAP table, the field which stores this text is blank. It will not update when we save the sales order.
    Could someone please let me know how can we check this problem.
    Regards,
    Swathi

    Hi
    Usually, this fields (zzfield) are populated with the subroutine userexit_move_field_to_vbap in include MV45AFZZ.
    I hope this helps you
    Regards
    Eduardo

  • Availability at Storage Location Level

    Dear All,
    While  creating a sales order system is checking the material  stock at the plant level it is including the stock in all the storage location
    we have several storage locations in the plant
    Hence i want to restrict the availablity to be done only for one storage location that is sales storage location
    Kilndly Advise
    Mohammed Raees

    Just try to populate the stock storage location in the sales order using user exit USEREXIT_MOVE_FIELD_TO_VBAP in program MV45AFZZ (or Userexit_Source_Determination in program MV45AFZB.). By this way, the system will check only in the particular storage location.
    Also check the link, which discussed similar requirement Re: Availability Check - Storage Location
    Regards,

  • Displaying Total Stoc & Open Order Quantity while creating SO

    Dear Experts,
    we have requiremet that while creating SO (VA01) for each item it sould show the message (Popup Screen) about Total Stock & Total Open Oder quantity for that material when user enters the material, plant & storage location in line item.
    Please let me know your ideas in detail if anyone knows about this....
    Thanks in Advance
    Best Regards
    Venkatesh

    Hello Venkatesh,
    You can use userexit USEREXIT_MOVE_FIELD_TO_VBAP in include MV45AFZZ. This user exit is executed every time the user enters item data and hits return. The VBAP data is available in structure xvbap.
    xvbap-kwmeng contains the ordered qty. for that item
    xvbap-kbmeng contains the confirmed qty. for that item
    I am not so sure in regard of the available stock qty. because it depends on your stock set up (e.g. batch stock, etc.) but you should be able to figure that out.
    Just check, if the required xvbap fields are populated and then raise the popup which displays the information to the user.
    Hope that helps,
    Michael

  • Sales Order Materials from Notification

    Hi All,
    Request your help.
    From Notification creation, after we create Tasks in All tasks tab, when we try to create the Sales Order, we have a requirement to pull the details from the Task long text using Read_text( here in the long text, we give the material and quantity)
    and fill in the Sales Order Item list,
    for ex, in the Task long text we hv a material
    12345678 and qty 2 pce
    then, when we navigate to sales order screen, the materials in the item list to be filled in with these materials,
    like
    for item 10, material 12345678 and qty 2.
    I tried using the User exit USEREXIT_MOVE_FIELD_TO_VBAP, but it is of no use.
    Could some one help me out at the earliest.
    Thanks in advance.
    Best regards,
    Githa

    Hi Ramesh,
    Thank you.
    But, the problem is when I fill the structure XVBAP with the materials and the corresponding quantities, the data is not getting shown on the table control. The data is still there, but not getting reflected in VA01 table control for the items.
    I tried filling VBAP and that too was not helpful.
    I am now worried, is it really feasible to do so?
    Kindly suggest some way out.
    Best regards,
    Githa

  • Need to Split Sales Order Line Item in VA01

    Hi,
      I have a requirement in which i have to split an order line item for KMAT materail number. system popup configurable screen, here all the required characteristic values have to be selected as per the customer requirement.
    After entering all the required customer specific characteristic values, system determines batch automatically. If characteristic values of the Batch matches with the characteristic values of configurable screen selected in the sales order
    Here also we have to check the sales Order Quantity (VBAP u2013 KWMENG) and order Confirmed quantity (VBEP u2013 BMENG), if the both the quantities are not same, consider order has partially confirmed.
    If Order quantity is partially confirmed, check for the batches with the same characteristic values of the quotation configurable screen and if batch found, system has to create a one more line item and new batch has to be assigned to create line item.
    Reduce the order quantity equal to the confirmation quantity in the first line item.
    Create a new line item in the quotation, copy all the remaining unconfirmed quantity from the first line item and also copy all the characteristics and properties (item category, schedule line category, business data, item data, and requirement type) and assign the batch to the new line item. System does the availability check automatically and confirms.
    In another scenario system doesnu2019t find batch, in this case capable to promise has to trigger directly.
    Here we have to check the Order confirmed quantity, if confirmed quantity is equal to zero.
    Change the item category of the line item, due to which system determines different Requirement type and schedule line category.
    Based on the Requirement type system triggers the capable to promise.
    I would lke to know which is the suitable user eixt or BADI to split the line items and what all the tables or structures i need to populate in order to create a new line item successfully.
    I have seen many post in sdn but no body gives the right user exit name where i can add new line item.
    Regards,

    Hi Amit,
      Thanks for your reply. In this scenario configurable material is involved. And first Make to Stock scenario is executed to check any material with customer entered characteristics are avialable. If its so it will determine its batch and assigned the quantity.
    If zero quantity is assigned or no quantity is assigned then I have to trigger the Make to Order scenario for rest of unconfirmed quantities in order.
    I have check it in USEREXIT_MOVE_FIELD_TO_VBAP but it was of no use. I even tried in USEREXIT_CHECK_VBAP but still no result. I am not sure what all the tables and structures i need to populate there.
    Regards,

  • User Exit for Updating Delivery Plant at Item Level in Sales Order

    Hello Experts
    There is a requirement to determine the delivery plant for each item level and than update the items with newly determined plant.  There is a user exit MV45AFZZ routine FORM USEREXIT_MOVE_FIELD_TO_VBAP. to update the item level entries in Sales Order in VA01 or VA02. Is this the right place to do this?, if yes , do i need to perform any other standard logic (like re determine Shipping points , schedule lines ) for newly determined plant? If not , can you please suggest any other place , BADI or user exit to change the delivery plant of sales order.
    Thanks a lot....
    -Harkamal

    Best place is MV45AFZZ-USEREXIT_SAVE_DOCUMENT_PREPARE. Populates the values just before saving the document. You can have your own deriving logic. Make sure that peice of code is trigger only for Sales Order create or change (VA01/VA02).
    Are you kidding???  You do realize that this is AFTER all validations against configuration, ATP, pricing, etc. have been performed??!!!  Never, ever change a critical value like plant in the SAVE user exits...

  • Identify when a user has change value in USEREXIT_CHECK_VBAP before saving

    I originally posted and closed this question, but I am still struggling with the code.
    The req is now to also update the value of VBAP-LPRIO, so I now have to use the Exit : USEREXIT_CHECK_VBAP.
    The issue is that my solution must take into account when a user manually overwrites a value and not replace it with a value determined in the user exit.
    My problem is that the user might do the following
    1 - Create a sales order and enter a new item line, press enter
    2 - The user exit is triggered, and I check that XVBAP-UPDKZ = I  (user add a new line)
    3 - The user-exit determines the new value and populates the field
    4- the user then click on the item line, and then manually changes the value of VBAP-LPRIO
    5- The user-exit is triggered again, and because  XVBAP-UPDKZ = I , my code is triggered and updates the field.
    What I want is to identify that a user has manually changed the value and not overwritte the value.
    1 - I have check YVBAP and it is blank, as the user has not saved the sales order.
    2- The values of VBAP and XVBAP are the same..
    3 - I cannot re-read the database (KNVV) table as the user could have populate the value with the same value.
    What I need is how to identify when a user has made a change to a field before they save the sales item, as YVBAP is never filled.
    Previous post----
    Hello,
    I am writing a bit of code that will overwrite the payment terms in a sales order item based on a number of factors. (ship-to, incoterms, document type, etc)
    I am using the following program MV45AFZB at Exit : USEREXIT_CHECK_VBAP. I am using this exit as the users need to see the payment terms after an item has been entered into the sales order and not have the value determined at sales order save.
    I am not using USEREXIT_MOVE_FIELD_TO_VBAP as it is only triggered once at the time of creation and not when I change the document. I need it in USEREXIT_CHECK_VBAP as users could change the incoterms in VA02, so the code must be redetermined.
    My code is working as expected, however, I have a problem when a user enters a sales order item line and then manually changes the payment terms, as my code then is over writes the users values.
    The flow is as follows
    As user creates a sales order
    They populate the sales order header
    They populate material number and qty
    User exit USEREXIT_CHECK_VBAP is triggered and correctly determines the payment terms
    The user then double clicks on the sales order item and decides to overwrite the payment terms.
    My user-exit is retriggered and check to see if XVBAP-UPDKZ = I (insert)
    As it is still an insert, my code triggers.
    I have tried to check YVBAP, but no entry exist as it stills is seen as in insert? What I really need to know that while it is still an insert, the user has change the field value and my code should not over write the users value.

    When do you need to update LPRIO ? When user makes the change at the Payment terms on line item?
    Regards,
    Naimesh Patel

  • User Unable to change Ship to address in SC while creating

    Hi All,
    When user is trying to change the ship to address which was defaulted is unable to make change.
    USer is trying to make manual entry in the NAME field change so that the other field would automatically gets changed withrespect to NAME in the SHIP to address tab.
    We have informed user that there exist Find option for other ship to address to choose.
    But user has insisted that it is easier to make manual change in NAME filed of the SHIP to address tab so that evrything should automatcially gets changed ,This will avoid search time .
    All other fields like CC & GL  are able to make change
    Please let me know what needs to be done to change the ship to address.
    Thanks
    Prasanna
    Message was edited by:
            PRASANNA HAVINAL

    Hi Ravish,
    I am already changing the UOM in the same include and in the subroutine "USEREXIT_MOVE_FIELD_TO_VBAP".  But it is again over writing in the standard program.  What I need to do, to remain same UOM.
    Thanks,
    srinivas.

  • User Exit for Partner Determination in VA01, VA02 transaction ( Sales order

    Dear All,
    I have an issue in which i need to determine partner for every change in ship to party both at header and item level during sales order creation or change.
    Can you please suggest an appropriate user exit for the same.
    I have tried
    EXIT_SAPLV09A_003
    EXIT_SAPLV09A_004
    but they get triggered only when we enter into VA01 transaction and not when the ship to party is manually changed.
    If possible i want to avoid MV45 exits as there are chances of regression due to too many different functionalities already present in my system.
    In worst case scenario please specify the place wherein i need to code in MV45 exits and what are the fields i need to change.
    Most probably i filtered out on "USEREXIT_MOVE_FIELD_TO_VBAP" but i am not 100 percent sure on this, please suggest.
    Thanks in advance
    Ronak

    Hi,
    please use User exit function: EXIT_SAPMV45A_003
    Put your coding in include: ZXVVAU05 (create it by double clicking, if not already created) and activate.
    Regards,
    Sanjay Gogikar

Maybe you are looking for

  • My Bestbuy reward status changed and is incorrect

    I just logged into my account for first time in over month and I see Best Buy moved me from premier silver to basic and I spent well over the $1500 requirement last year.  I know many and i mean many of my purchases never got credit for reward zone p

  • Login error for User in OBIEE 11g

    Hi All I have created an User(TEST_USER) in oracle 11g but for some i have to delete the user and recreate in the same name(TEST_USER) but when i am trying to login in analytics after recreating the user am getting the followwing error. "An error occ

  • Missing Calendar Items

    I can't see calendar appointments on my Palm Z22. I have recurring events that have disappeared, doctors appointments that I have entered have disappeared, etc. When I hotsync they appear on the Palm Desktop, but not on the Z22. When I attempt to ree

  • Item name in detail block changed!?  Help please!

    Hi, All I have a master-detail relationship. The join condition is Mast.ref_id = Detail.id. There was no returning records when I run datablock. When I came backe to the form, I found that the item name for Detail.Id was changed to FMNITE. I tried a

  • IProc, PR Account Generation workflow customization

    Hi All, We are in R11.5.10.2 and we are implementing Tax for our client. End user wants to default the segment6 of charge account with the segment6 of tax_code code combination. I've tried to default the account using the package por_custom_pkg but t