Enhancement on save in VA02 SAPMV45A

Hello,
Could someone please advise how I can do the following: On a save in VA02, if the billing block field is "approved request" and there are items that have been rejected, then a warning popup appears and I clear the rejected status.
The environment is Netweaver so I have access to the new enhancement framework. The only problem is i'm not sure how to go about using it.
Please advise.
Points awarded to clearly worded help.
thanks,
Matt

Hi Matt,
You may use the subroutine 'USEREXIT_SAVE_DOCUMENT_PREPARE' which is present in the MV45AFZZ include of the main program SAPMV45A.
Since it's Netweaver, you will have to use the New Enhancement Framework. Follow the below approach for writing the code.
1. Go to the include MV45AFZZ and the above mentioned sub routine.
2. Select Enhancement Operations from the EDIT menu.
3. To view the enhancement points available, select 'Show Implicit Enhancement options'.
4. You may then write your code under the Enhancement-Section or in Enhancement Spots.
Refer to this link for more information on New Enhancement Framework.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9cd334f3-0a01-0010-d884-f56120039915
Regards,
Arun

Similar Messages

  • BADI OR ENHANCEMENT WHEN SAVE VA01 OR VA02

    Hi All,
    I have a requirement that when I save in VA01 or VA02, Some values which i entered in application should populated to my custom FM(i.e item,schedule and notes ). as i googled and found the include MV45AFZZ and kept code in.
    FORM USEREXIT_SAVE_DOCUMENT.
    as lv_vbeln = vbak-vbeln
    Here i am getting Vbeln.
    in that code iam using fms
    1.  BAPISDORDER_GETDETAILEDLIST
    2..SHP_GET_SD_DATA
    to read the data about current vbeln. Here Iam unable to get data.
    Here I sholud not use VBAP-POSNR or VBEP-MENGE AND NO SELECT STATEMENT.
    And      'in update task' doesnot work for above FMs. Means it is showing sytax error for(changing ,importing parameters).
    Please help me.
    Thank in advance.
    Regards,
    Mithuunn

    Hi Mithuunn,
    In USER_EXIT_SAVEDOCUMENT you should not put a COMMIT WORK.
    Call your function in UPDATE TASK passing it the number of sales order.
    To stop in debugging your function and see if you really order arrives or have to put a delay with WAIT UP xx TIMES do the following:
    Put a break inside your FM and in the user-exit and activates the debugging and:  Options --> update debugging
    Stop within your function and you can debug it at runtime.
    I hope you help.

  • Enhancements and Badi for va02

    Hi Experts,
        My requirment is in VA02 , Delivery Block(LIFSK) and Billing Block(FAKSK) fields should be initialized.
    When user change these values and saving the sales order it should check the authorization of the user from table SETLEAF.
    If he is a valid user it will save else it will through a error message like "not authorized'.
    can any body please tell me which exit or badi is suitable for this requrement.
    Regards,
    Praveena

    Hi vinod..
    Thanks for giving replies....
    now i could activate the enhancement fine..
    this code not triggering while saving the sales order VA02...can you plzz check this code..
    FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(1 ) Form USEREXIT_SAVE_DOCUMENT_PREPARE, Start                                                                                D
    $$-Start: (1 )----
    $$
    ENHANCEMENT 315  ZSO_APPROVALCHECK.    "active version
    DATA: WA_USR01 TYPE USR01,
          UNAME TYPE SY-UNAME.
    CASE SY-UCOMM.
    WHEN 'SICH'.
        if sy-tcode = 'VA02'.
       UNAME = SY-UNAME.
       SELECT SINGLE VALFROM FROM SETLEAF INTO WA_USR01 WHERE VALFROM = UNAME.
         IF SY-SUBRC NE 0.
           MESSAGE E000(ZMSG) WITH 'You are not authorized for approval'.
           endif.
           endif.
       ENDCASE.
    ENDENHANCEMENT.
    $$-End:   (1 )----
    $$
    ENDFORM.

  • System resets the sales order item price changes after save in VA02.

    Hi All,
    We have implemented automatic credit control at sales order level.
    System is blocking the sales order once saved in VA01.
    But if I do any changes in prices at item level in VA02 and save before credit releasing the sales order then system agian reset to the original prices from pricing condition records.
    Can any body tell me why this is happening? I should able to change the sales order prices manually before releasing the sales order credit block. Is it possible?
    Regards,
    Kartheek.

    Like Lakshmipathi said, you should be able to change the prices in the order even if the order is under credit limit block.
    Please check the condition types which are being changed . In the condition type definition( T Code V/06) for the field Manual Changes - the value should be either "Manual entry has priority" or "....should allow to change manually...".
    Also in your pricing procedure ( T Code V/08) , against your pricing procedure , please select the value for pricing type as ..."copy manual conditions and redetermine others".
    Hope this helps
    Regards
    Sai

  • Is there a way to save in VA02 and VA22 and not quit the screen?

    Hello friends
    When I use transaction code VA02 and VA22 and make changes and then click on save button, it saves the changes and then quit the screen. However, is there place where I can change this setting so that when I click on SAVE, it saves and still remain in the same screen like many other window products so that I can make more changes if needed instead of re-entering the document again?
    I would appreciate if you can please let me know.
    Thanks
    Ram
    Edited by: Prasad Ram on May 1, 2010 10:02 PM

    hello,
    this is a standard SAP process which follows VA02...
    it is possible if this is really needed by modifying standard SAP program, but I would not suggest because the program has flow and it is not advisable to break that!
    thanks

  • How to save va01,va02 transaction code

    Hello Every one,
    When creating sales order in VA01, at last screen as soon i save a message box to be appeared and when editing details in VA02 as soon enter details and save a message box to be appered please let me know the userexit and releavent code tobe written......
    Regards
    Martin

    Hi,
    U can do it in MV45AFZZ ,inside this include use the userexit USEREXIT_SAVE_DOCUMENT.
    Regards,
    nagaraj

  • Enhancement on SAVE button in CRM CIC

    Hi,
    We have a requirement to call the SAP IS-U code when clicked SAVE button on CIC0 in CRM (not one on the standard tool bar), under tab IBase, after entering a new PoD or change PoD.
    I am new to CRM and not sure how to find the enhancement for this, how to customise the class. Not sure how to use CRMV_EVENT.
    Please could someone help me out in this.
    Many Thanks,
    Anand

    Hi All,
    Sorry for the delay . I am quite new to CRM. I was just looking for the enhancement options and I found that I could add-in the custom code in SAP standard FM.
    In the FM you can create enhancement space where you can code and which will be called in runtime.So i put the code in their and it worked as I wanted it.
    Please refer implicit enhancements.
    http://help.sap.com/saphelp_nw04s/helpdata/en/13/ca944160b8ac5fe10000000a1550b0/frameset.htm
    Thanks,
    Anand

  • Enhancement on Sales Order SAVE

    Dear All,
    I want to update and then Close the Service Order, when the Sales Order Line Item rejected.
    I have used the BDC - CALL TRANSACTION on IW32 for Closing the service Order. I have written that in one of the BADI on Sales Order SAVE in VA02.
    Now, the problem I am facing is, BDC is successful; but, at the last COMMIT in Sales Order old data is rewritten in the Service Order and evn if it shoing the Status CLSD, it is in changable Mode.
    So, please suggest me the way to overcome this.
    1. Service Order Data (OPERATIONS COMPONENTS) should not be overwritten.
    2. Once Closed, Service Order should be in non-chnagable Mode only.
    Please help me in this topic ASAP.
    Thnaks in advance.
    Kind Regards,
    Prasad

    Can anyone gives something about this?
    Thanks a lot.
    Best Regards,
    Prasad

  • CALL TRANSACTION at Sales Order SAVE

    Dear All,
    I want to update and then Close the Service Order, when the Sales Order Line Item rejected.
    I have used the BDC - CALL TRANSACTION on IW32 for Closing the service Order. I have written that in one of the BADI on Sales Order SAVE in VA02.
    Now, the problem I am facing is, BDC is successful; but, at the last COMMIT in Sales Order old data is rewritten in the Service Order and evn if it shoing the Status CLSD, it is in changable Mode.
    So, please suggest me the way to overcome this.
    1. Service Order Data (OPERATIONS COMPONENTS) should not be overwritten.
    2. Once Closed, Service Order should be in non-chnagable Mode only.
    Please help me in this topic ASAP.
    Thnaks in advance.
    Kind Regards,
    Prasad

    hi,
    Youcan use TAP, TAN for sub it Level pricing anf at main item level pricing you can use TAQ,TANN.
    AND CHECK IN TAP AND TAQ  That is there structure scope and application  in the BOM section is configured.
    and configure the sub item  sales item category as
    for pricing at sub item level
    sales document type-item category group(lump)-usage-higher item category[TAP]- TAN
    pricing at main item level
    sales document type-item category group(lump)-usage-higher item category[TAQ]- TANN
    you will get this in sales order
    go to Or  add the main material 1 you will get material 2 and material 3 as a subitem to item
    and check the pricing whether it applies to main item or sub item
    gajanan
    Edited by: Rudrag on Feb 10, 2010 8:48 AM

  • Enhancement spot is not triggered in Custom Program.

    Dear Experts,
    After saving the sales order i would like to view the print preview.
    For this I found one implicit enhancement spot and i called the print Program for sales order. Then i am able to view the Sales order print preview in VA01 Transaction code. I wrote my logic in the Below mentioned Enhancement implementation.
    Main Program : SAPMV45A
    Include : MV45AF0B_BELEG_SICHERN
    Form : beleg_sichern
    At the endform I am calling the Print program of Sales order so that after saving the sales order i am able to view the print preview of the Sales order.
    The requirement is i have created the Custom program in that i am using the "CALL TRANSACTION 'VA01'". In the custom program i am not able to view the Sales order print preview. The Enhancement spot is not getting triggered.
    Could you please help me to solve this issue.
    Thanks & Regards,
    Ashok.

    Like I said, you must use the parameter RA_COMMIT from BDC_OPTIONS. Like this:
    DATA: bdc_options TYPE ctu_params.
    bdc_options-ra_commit = ' X' .
    bdc_options-dismode = ' N'.
    CALL TRANSACTION 'VA01' OPTIONS FROM bdc_options.
    Everytime you use a CALL TRANSACTION, the called transaction will stop when a COMMIT WORK is found, and you have to pass the parameter RA_COMMIT with 'X' to make the transaction execute any code after COMMIT WORK. This only happens when you call a transaction via CALL TRANSACTION, it will not happen if the user access a transaction directly.
    For further explanation you can use the link from documentation that I posted on my first reply.
    Regards,
    Mauricio

  • Use of enhancement to add field in screen

    please explain me how to add fields in standard transaction screen by using enhancement 6 in version 6.0 ?

    SAP provides standard transactions to enter data into database. But a client may want to maintain some additional information in SAP other than what is provided.
    To make provisions for this, additional screens have to be provided and additional fields must be added into appropriate database table.
    To pave way for this, SAP has provided the option for screen exits. Usually, SAP provides the following:
    An append structure in the database table with the new fields.
    A subscreen area into the standard screen u2013 where the programmer can attach his subscreen of his own program with the new fields.
    A function group under which the new subscreen has to be created with the new fields.
    Function exits to synchronize the PBO and PAI of the standard SAP program with the PBO and PAI of the subscreen u2013 so that data can flow back and forth between the standard SAP program and the program written by the developer for the subscreen. These function modules also exist in the same function group under which the subscreen will have to be developed.
    Finally, a linkage has to be done between the subscreen area of standard SAP screen with the custom subscreen constructed by the developer.
    Typically, SAP provides an enhancement in which the developer can create an append structure, use the function exits to synchronize the PBO and PAI of the standard SAP program and the custom subscreen program, and make the necessary linking( as mentioned above in step 4. But, again, this is not a hard and fast rule. Linking in some case, is also done by configurations.) SAP also usually provides the name of the function group under which the subscreen has to be developed.
    Necessary guidance about implementing a screen exit development is usually available in the Documentation section of the enhancement ( can be availed by transaction SMOD).
    Pre-Requisites
    The developer to work on screen exit should have essential knowledge on the following:
    DDIC concepts, including the knowledge of append structure.
    Concept of SAP Enhancements and implementing them using Projects.
    Concept of function exits.
    Knowledge on Module Pool u2013 including subscreens, Tabstrip controls etc.
    Steps
    Guidelines
    So, a developer can follow the guidelines mentioned below to implement a screen exit to a standard SAP transaction, as and when required:
    Find out the Required Enhancements
    Go to SMOD. Press F4 in the Enhancement field. In the next popup window, click pushbutton u2018SAP Applicationsu2019. A list will appear that contains information on all the enhancements, categorized under functional areas. Developer must search for the enhancements relevant to his functional area of interest u2013 for e.g., Purchasing, Asset Accounting, etc.
    Note down the enhancements. Then, come to the initial screen of SMOD and view the documentation of each enhancement to find out which one is required for your development.
    Utilize the Enhancement in a Project
    After you have found one, do as directed in the documentation. Generally, the steps are as follows:
    Create a project using CMOD including your enhancement.
    Create the append structure with new fields.
    Go to the desired function group and create a subscreen with the new fields. Write PBO and PAI for the subscreen, if required.
    Use the function exits in the enhancement to link the PBO and PAI of the subscreen with that of the main SAP program supporting the SAP transaction.
    Maintain necessary linkage between the subscreen area of standard SAP program with the custom subscreen developed along with the custom program name. This can be done in the project (developed by CMOD including the enhancement) or outside as a part of configuration.
    Activate the project.
    Test to ensure that required functionality are met.
    Case Study 1
    Add three new custom fields for Asset master and maintain information for them
    Requirement
    Three fields in the legacy system have to be maintained in Asset master. These fields are:
    Original Asset number u2013 20 characters
    Location 2 u2013 15 Characters.
    Model no u2013 20 characters
    Location 2 should start with u2018Lu2019.
    Pre-Analysis
    Finding out the Enhancement
    As described above, the enhancement is determined. It was found, that enhancement AIST0002 will serve the purpose. It contains the following components (can be viewed by transaction SMOD):
    Exit Type Description EXIT_SAPL1022_001 Function Exit Check of User-Defined Fields when Using Create and Change BAPI EXIT_SAPLAIST_002 Function Exit Transfer Data for User Subscreens in PBO. EXIT_SAPLAIST_003 Function Exit Transfer of User-Defined Fields to SAP Master Data Transactions CI_ANLU Customizing Include Include structure to add new fields
    Studying the Function Exits
    The function module level documentation for the function exits are then viewed from transaction SE37. The documentation clearly laid out for the purpose for their use:
    EXIT_SAPLAIST_002
    Function module Level Documentation
    This function module is called by asset master data maintenance at the start of the dialog. (When changing, it is called after reading of the data from the database; when creating it is called after the transfer of the default values from the asset class and reference asset.) The purpose of the function module is to enable this function group to recognize the master data. For interpreting or controlling master data fields that are important for user fields, it is possible to transfer to global variables at this point, so that they can be recognized when the user subscreens are processed.
    Import Parameters
    Understanding
    This function module is called at the PBO to pass the information retrieved from the database to pass them to the custom subscreen and its underlying program. Import parameter : I_ANLU will be populated with the values for user-defined fields which will be passed to the subscreen program. So, there must be some sort of variable assignment from I_ANLU.
    EXIT_SAPLAIST_003
    Function module Documentation: This function module is called by SAP asset master data maintenance after the screens are processed, but before saving. The purpose of the function module is to transfer fields entered on user sub-screens of SAP asset data maintenance to the database for updating. The export parameter for this function module is:
    Understanding
    This function module will be used to transfer the user entered data in the subscreen fields to the main SAP program, which will then be saved into the database.
    Studying the Documentation of the Enhancement
    The enhancement documentation (as is viewed from the initial screen of SMOD] also supports the idea. Moreover, it informs that we need to develop a subscreen under function group XAIS. This is the function group under which the two function exit modules also exist. So, if the custom subscreen refers to the global data of the function group XAIS, then those values will also be available to these function exits as well.
    Going to SE80 and viewing the function group XAIS helps us to inform that there are three DDIC tables declared for it:
    Deciding the Final course of Action
    After making all the investigations, the final course of action was determined.
    SrlNo Step Justification
    A project has to be created using transaction CMOD where the enhancement AIST0002 will be included.
    Customizing include CI_ANLU has to be created with the custom fields demanded When CI_ANLU will be developed, the custom fields will get appended to the database table ANLU. Also, these fields will be used to create screen fields in the new subscreen.
    A custom subscreen, say, 9000 will be developed under function group XAIS. The screen group for the screen will be u2018CUSTu2019 (or any name). The three custom fields added to table ANLU (by creating CI_ANLU) will be used to create new fields in the screen.
    In the PAI of the subscreen, validation for Location to start with u2018Lu2019 will be added. The subscreen with three new fields has to be developed so that it can be attached to a subscreen area of the asset master screens.
    In the custom include of the function exit module u2018EXIT_SAPLAIST_002u2019, the following code will be written:-
    ANLU = I_ANLU. I_ANLU is the import parameter of this FM. The value is assigned to the global variable ANLU, referring which the three new subscreen fields are developed. So, data retrieved from database table ANLU will be passed to this FM as I_ANLU by the standard SAP main program. The value will be taken and passed to the global variable of the function group XAIS, so that the three custom fields (referring to ANLU of XAIS) get populated.
    In the custom include of the function exit module u2018EXIT_SAPLAIST_003u2019, the following code will be written:-
    E_ANLU = ANLU. The changed values in the subscreen fields exist in global variable ANLU for the function group XAIS. This function exit module will pass the data back to the SAP main program as E_ANLU.
    Proper linkage/configuration has to be done so that the new subscreens get linked to the appropriate subscreen area of the Asset master screen. This has to be done u2013 otherwise, the new custom subscreen will not be displayed in the Asset master screens.
    Development
    Creating a Project to include the enhancement
    Go to transaction CMOD and create a project.
    Enter a description for the project. Then, click on the pushbutton u2018Enhancement Assignmentsu2019 in the Application Toolbar.
    Enter the name of the enhancement and Save.
    Go to u2018Componentsu2019.
    Creating Custom Include for ANLU
    The screen shown below will appear, showing all the enhancement components under the assignment AIST0002. Double-click on the name of the Include Structure to create it.
    Create the include structure with three new fields, as required. Then, save and activate it.
    Develop the subscreen and the program
    Go to transaction SE80. For the function group XAIS, create a new subscreen 9000.
    Create it as subscreen.
    Then, go to the Layout of the screen and create three new fields from Database table ANLU.
    Drag the fields in the screen body and place them.
    Then, save and activate the screen and come back to screen flow editor.
    Create the PAI module to add validation for field u201CLocation 2u201D, as required .
    Activate the whole function group and come out.
    Write code in the Function Exits to synchronize the programs
    Now, code has to be written in the function modules EXIT_SAPLAIST_002 and EXIT_SAPLAIST_003 so that data flows to and fro between the main SAP program and custom subscreen program. For that, go back to transaction CMOD and change the function exits.
    Write code in the function module EXIT_SAPLAIST_002 called once at the beginning of the transaction:
    Write code in EXIT_SAPLAIST_003 to pass the data from the subscreen to SAP main program.
    Then, activate everything u2013 the whole project and come out.
    Complete the configuration to link the subscreen
    The development portion is complete. Now, linking of the subscreen has to be done with the subscreen area of the main program. In most of the cases, this linking can be done in the enhancement itself. But, here, requirement is a bit different. It is done by configuration using SPRO.
    Assets are created under Asset class. And for each asset class, there is a layout assigned to it. For a layout, there are multiple tab pages assigned to it. And, for each tab page, there are multiple screen groups/field groups assigned.
    Here, the requirement is to create these three custom fields in the tab page u2018Generalu2019 of asset master screen ( AS01/AS02/AS03/AS91).
    Determine the Layout
    To achieve this, first of all, we need to find out which layout is assigned to asset class 1000.For that, go to transaction AOLK( information has to be obtained from functional consultant).Select the Asset Class u20181000u2019 and click on folder u2018General Assignment of Layoutu2019.
    Here, for Asset class 1000, for all the user groups, tab layout SAP is assigned. Since layout u2018SAPu2019 cannot be changed, it has to be copied and manipulated to include our screen group. Later, the new layout has to be assigned over here.
    Create new tab layout
    Go to transaction AOLA. Copy the tab layout u2018SAPu2019 to create another layout, say, YSUB.
    System will copy all the settings and will inform you about that.
    Select your newly created layout and double-click on the folder u2018Tab page titlesu2019.
    You want to put your custom fields in the tab page u201CGeneralu201D. So, select this tab page entry and double-click on the folder "Position of Groups".
    Here, all the field groups currently residing in the tab-page u201CGeneralu201D are shown. Add an entry for your newly created fields.
    Select the group box from the list. An entry will come with u201CUu201D padded with the custom subscreen prepared by you.
    Then, save and come out.
    Assign the new Layout to Asset Class
    Now, go to tcode AOLK and assign tab layout YSUB for asset class 1000.
    Save and come out.
    Test the Exit
    Everything is over. Now, go to transaction code AS01/02/03 or AS91 to deal with an asset of asset class 1000. You will see your new fields added to the screen. Add values to themu2026save. Then, enter into the tcodes again to see whether the values entered by you are being displayed or not.
    I hope you read it all
    Thanks and Regards
    Santosh K.

  • Code for SAVE functionality in FPM_OIF_COMPONENT

    Hi Experts,
    I have enhanced the component DPR_DET_DATA_PROJECT_O. The SAVE functionality for this component exists in FPM_OIF_COMPONENT.
    I have to raise error message depending on the custom fields added in  DPR_DET_DATA_PROJECT_O when I click on 'SAVE' button.
    Please share if any ideas where to write the code for SAVE functionality for the custom fields added on DPR_DET_DATA_PROJECT_O.
    Regards,
    Rafi

    Hi Rafi,
    These similar discussions might provide some assistance:
    BAdI or enhancement on SAVE of Cproject
    which badi triggers while saving cproject
    Code to call for saving the data in WDC - DPR_PROJECT_VIEW
    Cheers,
    Amy

  • ENH-with VA02

    Hi,
    i am working with an enhancement in the  transaction va02.
    i need to copy the partner function address to next tab text to the text id Z005( final destination) in text object VBBP.i am not getting the tables associated with these fields.
    can anyone explain me how  to do this?
    if u want i can explain with screen shots ...please ....help me..
    regards
    pravee

    Hi,
    I searched in the main program of VA02 transaction.
    but i do not have any structure ot internal table with VBBP.
    i have got one more internal table ITHEAD .i hope is it correct one.
    here my requirement i have to the copy the partner function address to text id Z005 of the Text object VBBP.
    I hope there function module to write into the object.
    if u know please let me know,.
    regards
    pravee

  • Idocs - Enhancements!

    Hi Friends!
        Can any one pls tell what all the enhancements which u ve worked on IDOCS.
        Pls give step by step detail in Creation of segments & FM coding Please.
       Looking for your Help.
       Thanks In Advance.
        Rahul.

    Hi Rahul..
    These are the Steps for IDOC enhancement.
    IDOC EXTENSIONS
    SAP delivers Basic IDOC types such as DEBMAS02, MATMAS02.
    By extending the Basic IDOC type, you are actually creating a new IDOC type.
    You create a new segment with the additional fields. This new segment has to be associated with one of the existing Basic IDOC segments. Then you create a new extension type, which is associated with the Basic IDOC type. This results in a new IDOC type. In order for ALE function modules to relate to this new IDOC type, the IDOC type is linked to the corresponding message type.
    Note: that you should not add fields to existing segments but should create a new segment and associate it with an existing segment.
    In our example, the Basic IDOC type DEBMAS02 is used to communicate Customer Master data to the SAP Customer Master application. Even though the application has a screen to enter and store a contact personâs business address DEBMAS02 does not have a segment or fields that communicate the contact persons business address. If your business requires that this business address be communicated to the other system through the ALE interface for Customer Master, then you have to extend the DEBMAS02 IDOC type, and enhance the corresponding ALE function module.
    In DEBMAS02 the contact person fields are present in segment E1KNVKM and the business address of the contact person is stored on the SADR SAP table. You need to create a new segment, Z1SADRX, that is associated with E1KNVKM. This will be done in the process of creating an extension type ZDEBMASX. This extension type will then be associated with a new IDOC type, ZDEBMASZ. IDOC type ZDEBMASZ will be linked to message type DEBMAS for Customer Master. The final step in the IDOC extension process is to check the new objects. This check also verifies the structural integrity of the IDOC type. Letâs look at each of these steps in more detail.
    1. Create an Extension Type and a New Segment.
    Determine the fields on table SADR that you are going to provide for in the new segment Z1SADRX. You need fields for name, street, city, region, and country to give the business address of the contact person. You also need fields for the address number. ADRNR is a field in SAP tables such as SADR that uniquely identifies the address of an entity. This field is cross-referenced from other tables to the SADR table to obtain the full description of the address. Because this is an IDOC type for master data, the first field of the new segment will be MSGFN. The message function field informs the receiving system of the action to be taken for that particular segment. In the code that you write for populating the new segment, the value of the message function is the same as that of the parent segment E1KNVKM. In all, you will have 12 fields in segment Z1SADRX (see Table 1).
    To create an extension type and new segment:
    • Use transaction WE30 or from WEDI go to Development -> IDOC types.
    • Enter ZDEBMASX for Object Name.
    • Choose Extension Type.
    • Click on Create.
    • You will see a pop-up screen. Choose Create New, and enter a description. For version 4.x, enter DEBMAS02 in the Linked Basic Type field. Enter.
    • You will see a screen with ZDEBMASX and its description in the first line. Click on this line, and press Create. For version 4.x, expand the tree of segments, and place the cursor on E1KNVKM.
    • You will see a pop-up screen. Enter E1KNVKM as the reference segment. Enter.
    • For 4.x, press Create after placing the cursor on segment E1KNVKM.
    • You will see a line appear with E1KNVKM hierarchically below ZDEBMASX, with a description "Customer Master contact person (KNVK)."
    • Click on this line and press Create. You will receive a message indicating that the new segment being created will be a child segment of E1KNVKM. Enter. A pop-up box appears for the new segment.
    • Enter Z1SADRX as the segment type, 1 for Minimum, 1 for Maximum. Leave Mandatory segment unchecked. These entries imply that there is only one Z1SADRX segment for every occurrence of the E1KNVKM segment, and also that this segment is not mandatory. Note that if the parent segment is not mandatory, then the child segment should not be mandatory, because this could result in a syntax error during the creation or processing of the IDOC.
    • For 4.x, you must first create the IDOC segment Z1SADRX (Iâll explain why in a moment) from the menu path WEDI -> IDOC -> Development -> IDOC Segment.
    • Click on Segment Editor.
    • On the next screen, click on Create.
    • Enter a development class for the object. Enter.
    • This will take you to the screen for segment definition. Enter a description for the segment. Enter the field name, data element, and the data element documentation name. In most cases, all three fields may have the same values. If you are using a field in the segment that is not present in the ABAP/4 data dictionary, you must first create the domain, data element, field, and appropriate documentation before using it in the new segment.
    • Enter these three columns for all 12 fields. Save.
    • Click on Generate/Activate, F3 to step back.
    • From screen Maintain Segment, go to Segment Type -> Release. A checkbox now appears beside the segment definition Z1SADRX (see Figure 2). Check this box. Save.
    • Save again to store the descriptions of the segment, F3 to step back.
    • Save the extension type.
    It is possible to have several new segments with relevant Basic IDOC type parent segments in a single extension type. However, you can form only one IDOC type based on a single extension type.
    2. Create an IDOC Type.
    The next step is to create an IDOC type by associating the extension type that you created with the Basic IDOC type. This is a simple process:
    • From transaction WE30 or WEDI go to Development -> IDOC Types.
    • Enter ZDEBMASZ for Object Name.
    • Click on IDOC Type.
    • Click on Create.
    • Enter DEBMAS02 for Basic IDOC type.
    • Enter ZDEBMASX for extension type.
    • Enter a description.
    • Enter.
    • You will see a display of the composite IDOC type with all segments, including Z1SADRX (see Figure 3).
    It is possible to associate only one extension type with a Basic IDOC type for a given IDOC type. However, you can have multiple new segments in an extension type.
    3. Link IDOC Type to Message Type.
    The next step is to link the new IDOC type to its corresponding message type. This is important, because this relationship is referenced in the partner profile parameters where you specify the message type and IDOC type to be used for that particular representative system. To link the message type:
    • Use transaction WE82, or from WE30, go to Environment -> IDOC Type / Message Type, or from WEDI go to Development -> IDOC Type -> Environment Î IDOC Type / Message Type.
    • Click on Display <-> Change.
    • Click on New Entries.
    • Enter DEBMAS for message type.
    • Enter DEBMAS02 for Basic IDOC type.
    • Enter ZDEBMASX for extension type.
    • Enter your SAP R/3 release number for Release.
    • Save.
    This data is stored on the EDIMSG table and is accessed by several ALE processes to relate the message type to the IDOC type.
    4. Check the IDOC Type.
    Before checking the IDOC type for consistency, it is important to perform another step that releases the extension type to the IDOC type:
    • From WEDI go to Development -> IDOC Types -> Extras -> Release Type, or from transaction WE30 go to Extras -> Release Type.
    • For the Object Name ZDEBMASX and radio button Extension Type, click Yes.
    • The extension type has now been "released."
    You canât edit the extension type once itâs released. To cancel the release for further editing or deactivation, go to WE30 Î Extras Î Cancel release. The final step in the IDOC extension process is checking the validity of the IDOC type:
    • From transaction WE30 or WEDI go to Development -> IDOC types.
    • Enter ZDEBMASX for Object name.
    • Click on Extension Type.
    • From the Development Object menu select Check.
    • Repeat the operation for IDOC type ZDEBMASZ.
    ALE FUNCTION MODULE ENHANCEMENTS
    Having extended the IDOC type to contain additional fields for an inbound or outbound application, you now want to enhance ALE function modules for populating the additional segment on the outbound or applying the additional segment data on the inbound application.
    • For master data distribution, from SALE go to Extensions -> Master data distribution -> Setup additional data for message types. Search for message type DEBMAS in this example. You see an entry for DEBMAS associated with function module MASTERIDOC_CREATE_SMD_DEBMAS. This data is stored on table TBDME. The function module names for all master data message types follow this pattern: MASTERIDOC_CREATE_SMD_messagetype. This function module calls another function module of name MASTERIDOC_CREATE_DEBMAS or MASTERIDOC_CREATE_messagetype. Search for the words customer function, and you find several hits that can be used to add code to the function module.
    • From WEDI got to Control -> Inbound process codes -> Inbound with ALE service -> Processing by function module (transaction WE42), or from WEDI go to Control -> Outbound process codes -> Outbound with ALE service -> With function module (transaction WE41). There will be function modules associated with the process codes. For inbound, the function modules usually follow this pattern: IDOC_INPUT_messagetype: for example, IDOC_INPUT_CHRMAS for inbound characteristics master.
    • Use transaction WE57 or from WEDI go to Development -> Message/Application Object. The entries list the function module, Business Object, message type, and IDOC type that are used for inbound ALE/EDI interfaces.
    Customer functions are not specific only to ALE and EDI but also to all programs/modules in SAP R/3. Customer function is a SAP enhancement component; the other two types are menu and screen enhancements.
    All customer function exits are maintained in SAP enhancements and are found by using transaction SMOD. After executing transaction SMOD, pull down (F4) on the enhancement name field, and execute again. This provides you with a list of all SAP enhancements available. SAP enhancements are grouped by development class pertaining to an application area. Choose Application development R/3 SD master data distribution for development class VSV to lead to a screen that lists VSV00001 as an enhancement (see Figure 5). Press Component +/- to display its function exit components. There are four possible components listed, all of which are function exits (and are function modules) that are called from the ALE function modules in the form Call Customer Function Î001â. This is a special occurrence of the ABAP statement Call. Go to item Exit_SAPLVV01_ 001, which you need to enhance for the Customer Master outbound example of an IDOC extension. In the ALE-function module MASTERIDOC_CREATE_DEBMAS, the statement CALL Customer Function 001 is translated in the background to call component EXIT_SAPLVV01_001. Although this function exit can be edited using transaction SE37, you will use a simpler approach.
    When you use SAP enhancements and their components, you manage them with an SAP object known as a project, which is like an envelope containing the selected enhancements and their components. A project can be used to control the execution of components and to transport them to other clients and instances in SAP. Basically, the process involves creating a project, including enhancements and components that are to be enhanced, editing the components, and then activating the project. The following process creates a project for our example Customer Master IDOC extension:
    • Execute transaction CMOD.
    • Enter name of project, say CSTMAST1.
    • Click on Create.
    • Enter a description of the project.
    • Save.
    • Click on SAP Enhancements.
    • Enter VSV00001 for Enhancement.
    • Save.
    Once youâve created the project, edit the function exit components and activate the project. Remember that the code in the function exit enhancement will execute only if the project is activated.
    Outbound interfaces. In an outbound ALE interface you use function exits (customer functions) to populate additional segments created by an IDOC extension or to modify the existing IDOC data segments as per business requirements. Previously, you identified that enhancement VSV00001 has a component EXIT_SAPLVV01_001 (function exit), which can be used for populating the additional data segment Z1SADRX that you created in the IDOC extension ZDEBMASX (IDOC type ZDEBMASZ, based on Basic IDOC type DEBMAS02). You also learned that the ALE function module that calls this function exit is MASTERIDOC_CREATE_DEBMAS, which has a statement Call Customer Function 001.
    Browse the function module MASTERIDOC_CREATE_DEBMAS using transaction SE37. You will find that this customer function is invoked for every segment of IDOC type DEBMAS02. In fact, the function exit is called soon after the creation of an existing segment has been populated with data and appended to the IDOC data table (internal table). Also, the function exit is exporting the message type, IDOC type, and the segment name and is importing the IDOC extension type. It is also passing the IDOC data internal table. This indicates that the ALE function module is allowing you to populate additional segments for every existing segment and modify the existing segmentâs data.
    Letâs write ABAP/4 code to accomplish the task of populating IDOC segment Z1SADRX with a contact personâs business address:
    • From SE37, display function module MASTERIDOC_CREATE_ DEBMAS.
    • Find Customer Function 001.
    • Double-click on 001.
    • The function EXIT_SAPLVV01_001 will be displayed.
    • Double-click on INCLUDE ZXVSVU01.
    • You will be asked to create a new include object. Proceed as desired.
    • Enter code (as in Listing 1).
    • Be sure to perform a main program check (Function Module -> Check -> main program) and extended program check (Function module -> Check -> Extended check).
    Now that you have extended the IDOC and enhanced the ALE function module based on the requirements for the contact personâs business address on the Customer Master, letâs test the interface. You should create a logical system and define a port for this interface. You should also configure the Customer Distribution Model to indicate that message type DEBMAS is being distributed to this logical system. The only difference in configuration between a regular outbound ALE interface and an enhanced one is the partner profile definition. While maintaining the outbound parameters of the partner profile, make sure the IDOC type is ZDEBMASZ. The fields for Basic IDOC type and extension type are automatically populated with DEBMAS02 and ZDEBMASX, respectively.
    To maintain the contact personâs business address of a customer:
    • Use transaction BD12 or from BALE go to Master Data ->Customer -> Send and send that Customer Master record by executing the transaction after filling in the relevant fields such as customer number, message type, and logical system.
    • Use transaction WE02 or WE05 to verify the IDOC created. You should see the new segment Z1SADRX populated with the correct data.
    With SAP releases below 4.5B, you cannot capture changes to business address through change pointers because a change document object is not available for capturing business address changes, and also earlier releases have not been configured to write change documents for a contact personâs business address. If you would like this functionality, you can either create change document objects, generate function modules to create change documents, and perform ALE configuration to tie it in, or make a cosmetic change to the contact person screen data while changing the contact personâs business address so that it gets captured as a change to the Customer Master. Subsequently, the ALE enhancement that you performed captures the contact personâs business address.
    Inbound interfaces. The process for enhancing inbound ALE interfaces is similar for outbound, with a few exceptions; specifically in the coding of customer functions (function exits) for the ALE/EDI function modules.
    The first step is to create an IDOC extension for the specific Basic IDOC type by adding new segments at the appropriate hierarchy level: that is, associated to the relevant existing segment. Populate the data fields on the new segments with application data by the translator or external system/program before importing them into the R/3 System. Then, find the ALE function module that is invoked by the inbound processing. By browsing through the code or reading the documentation on the function exit enhancements using the SMOD transaction, identify the function exit in which you should place your code. The technique used in the code to post the additional or modified IDOC data to the application can vary based on the application rules and requirements, the data available at that point in processing, and the application function modules available to update the application tables. It is important to search first for application modules that process the data and see if they can be called within the function exit. If the additional data in the extended segments in specific to a custom table or resides in nonkey fields of a single or small set of tables, you may be able to update it directly by SQL statements in the function exit. This approach should be carefully evaluated and is certainly not highly recommended.
    Another option is to use Call Transaction from within the function exit to process the additional data. For example, in the case of message type WMMBXY for inbound goods movements from a warehouse management system, the standard interface creates batches for materials, but does not update its characteristics. In such a case, you can use Call Transaction MSC1 to create the batch and assign characteristic values to it from within the function exit provided.
    Reward if Helpful

  • User exit  vs customer exit

    Hi experts ,
    i am confusing user exit and customer exit plz give good diffrence and where we use these exits
    thanks and advance

    Hi,
    User exit - A user exit is a three character code that instructs the system to access a program during system processing.
    SXX: S is for standard exits that are delivered by SAP. XX represents the 2-digit exit number.
    UXX: U is for user exits that are defined by the user. XX represents the 2-digit exit number
    Customer exit - The R/3 enhancement concept allows you to add your own functionality to SAP’s standard business applications without having to modify the original applications. SAP creates customer exits for specific programs, screens, and menus within standard R/3 applications. These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang your own add-on functionality onto these hooks.
    The program for transaction VA01 Create salesorder is SAPMV45A
    If you search for CALL CUSTOMER-FUNCTION i program
    SAPMV45A you will find ( Among other user exits):
    CALL CUSTOMER-FUNCTION '003'
    exporting
    xvbak = vbak
    xvbuk = vbuk
    xkomk = tkomk
    importing
    lvf_subrc = lvf_subrc
    tables
    xvbfa = xvbfa
    xvbap = xvbap
    xvbup = xvbup.
    The exit calls function module EXIT_SAPMV45A_003
    Development
    Creating a Project to include the enhancement
    1. Go to transaction CMOD and create a project.
    2. Enter a description for the project. Then, click on the pushbutton ‘Enhancement Assignments’ in the Application Toolbar.
    3. Enter the name of the enhancement and Save.
    4. Go to ‘Components’.
    Creating Custom Include for ANLU
    The screen shown below will appear, showing all the enhancement components under the assignment AIST0002. Double-click on the name of the Include Structure to create it.
    Create the include structure with three new fields, as required. Then, save and activate it.
    Develop the subscreen and the program
    Go to transaction SE80. For the function group XAIS, create a new subscreen 9000.
    Create it as subscreen.
    Then, go to the Layout of the screen and create three new fields from Database table ANLU.
    Drag the fields in the screen body and place them.
    Then, save and activate the screen and come back to screen flow editor.
    Create the PAI module to add validation for field “Location 2”, as required .
    Activate the whole function group and come out.
    Write code in the Function Exits to synchronize the programs
    Now, code has to be written in the function modules EXIT_SAPLAIST_002 and EXIT_SAPLAIST_003 so that data flows to and fro between the main SAP program and custom subscreen program. For that, go back to transaction CMOD and change the function exits.
    Write code in the function module EXIT_SAPLAIST_002 called once at the beginning of the transaction:
    Write code in EXIT_SAPLAIST_003 to pass the data from the subscreen to SAP main program.
    Then, activate everything – the whole project and come out.
    Complete the configuration to link the subscreen
    The development portion is complete. Now, linking of the subscreen has to be done with the subscreen area of the main program. In most of the cases, this linking can be done in the enhancement itself. But, here, requirement is a bit different. It is done by configuration using SPRO.
    Assets are created under Asset class. And for each asset class, there is a layout assigned to it. For a layout, there are multiple tab pages assigned to it. And, for each tab page, there are multiple screen groups/field groups assigned.
    Here, the requirement is to create these three custom fields in the tab page ‘General’ of asset master screen ( AS01/AS02/AS03/AS91).
    Determine the Layout
    To achieve this, first of all, we need to find out which layout is assigned to asset class 1000.For that, go to transaction AOLK( information has to be obtained from functional consultant).Select the Asset Class ‘1000’ and click on folder ‘General Assignment of Layout’.
    Here, for Asset class 1000, for all the user groups, tab layout SAP is assigned. Since layout ‘SAP’ cannot be changed, it has to be copied and manipulated to include our screen group. Later, the new layout has to be assigned over here.
    Create new tab layout
    Go to transaction AOLA. Copy the tab layout ‘SAP’ to create another layout, say, YSUB.
    System will copy all the settings and will inform you about that.
    Select your newly created layout and double-click on the folder ‘Tab page titles’.
    You want to put your custom fields in the tab page “General”. So, select this tab page entry and double-click on the folder "Position of Groups".
    Here, all the field groups currently residing in the tab-page “General” are shown. Add an entry for your newly created fields.
    Select the group box from the list. An entry will come with “U” padded with the custom subscreen prepared by you.
    Then, save and come out.
    Assign the new Layout to Asset Class
    Now, go to tcode AOLK and assign tab layout YSUB for asset class 1000.
    Save and come out.
    Test the Exit
    Everything is over. Now, go to transaction code AS01/02/03 or AS91 to deal with an asset of asset class 1000. You will see your new fields added to the screen. Add values to them…save. Then, enter into the tcodes again to see whether the values entered by you are being displayed or not.
    Please check these links for more information.
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/content.htm
    http://www.sapdevelopment.co.uk/enhance/enhancehome.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    Customer exit and User Exit
    User Exit Vs Customer Exit
    Regards,
    Priyanka.

Maybe you are looking for