Using a Velocity Template in Java User Exit Custom Handler

I would have thought it would be possible to use a Velocity template in combination with a custom handler in a Java user exit, but I can't seem to figure out how  to do it, and I'm not finding an example of doing this anywhere in the GoldenGate docs.
For example, I can create a Velocity template and use it to output transactions in the desired format to a file by using a propeties file that looks something like this:
gg.handlerlist=myhandler
gg.handler.myhandler.mode=tx
gg.handler.myhandler.format=./dirprm/my_template.vm
gg.handler.myhandler.type=file
gg.handler.myhandler.file=my_output.txt
What I'm hoping to do is to have a custom handler, and some how  be able to get to the Velocity formatted transaction data in the "transactionCommit(DsEvent, DsTransaction)" method of my custom extension of AbstractHandler by having a properties file that looks like this (same as the above, except for the type, and no file property ... eg:
gg.handlerlist=myhandler
gg.handler.myhandler.mode=tx
gg.handler.myhandler.format=./dirprm/my_template.vm
gg.handler.myhandler.type=my.custom.GGHandler
I've verified that I have a valid DsEvent and a DsTransaction with the desired information in by custom handler's transactionCommit method ... and I can even pull out the required data and re-format it there to the desired format so that it looks just like the format that my Velocity template outputs when I'm outputting to a file (as shown in the first properties file).  But shouldn't I somehow  be able to access the Velocity transformation for my DsTransaction in my custom handler?
Thanks for any assistance / info provided.

I would have thought it would be possible to use a Velocity template in combination with a custom handler in a Java user exit, but I can't seem to figure out how  to do it, and I'm not finding an example of doing this anywhere in the GoldenGate docs.
For example, I can create a Velocity template and use it to output transactions in the desired format to a file by using a propeties file that looks something like this:
gg.handlerlist=myhandler
gg.handler.myhandler.mode=tx
gg.handler.myhandler.format=./dirprm/my_template.vm
gg.handler.myhandler.type=file
gg.handler.myhandler.file=my_output.txt
What I'm hoping to do is to have a custom handler, and some how  be able to get to the Velocity formatted transaction data in the "transactionCommit(DsEvent, DsTransaction)" method of my custom extension of AbstractHandler by having a properties file that looks like this (same as the above, except for the type, and no file property ... eg:
gg.handlerlist=myhandler
gg.handler.myhandler.mode=tx
gg.handler.myhandler.format=./dirprm/my_template.vm
gg.handler.myhandler.type=my.custom.GGHandler
I've verified that I have a valid DsEvent and a DsTransaction with the desired information in by custom handler's transactionCommit method ... and I can even pull out the required data and re-format it there to the desired format so that it looks just like the format that my Velocity template outputs when I'm outputting to a file (as shown in the first properties file).  But shouldn't I somehow  be able to access the Velocity transformation for my DsTransaction in my custom handler?
Thanks for any assistance / info provided.

Similar Messages

  • ABEND in Java User Exit with RAW DataType

    I have a Java User Exit Extract running against a trail file that has been pumped to the GoldenGate instance in question.  The extract starts up without any issues, but gives the following error after I update a record that has a RAW datatype as the primary key:
    JAVAWRITER(javawriter.c:269) [ERROR]: Error occurred (Java exception): UEDataSource.createOperation:
    com.goldengate.atg.datasource.InvalidTransactionState: A new operation was received without first receiving a BEGIN transaction. This can happen when processing is resumed in the middle of a transaction, or when there are "before" images in the trail that are not being sent to the user exit (always include "GetUpdateBefores" in the user-exit parameter file).
    I have tried a number of things to try to resolve this, but I can't seem to make this work.  the params for this extract currently looks like this:
    extract uePump
    sourcedefs ./dirdef/my_defgen.def
    setenv (GGS_USEREXIT_CONF = "dirprm/javaue.properties")
    getupdatebefores
    cuserexit ./dirprm/libggjava_ue.so CUSEREXIT passthru includeupdatebefores
    table my_schema.B_PLN_DIR, fetchmodcols (PLN_DIR_ID, *);
    table my_schema.*;
    ... I've tried leaving off the "includeupdatebefores" argument to the cuserexit, leaving out the fetchmodcols handling for the table with the RAW PK field, but I still get the error shown above.
    Any help / pointers is much appreciated.

    includeupdatebefores (lowercase) doesn't work;  you must use the uppercase INCLUDEUPDATEBEFORES !!

  • Java User Exit - File header failed to parse tokens

    I'm getting an OGG-01389 ... File header failed to parse tokens.  File /u01/pump/aa000000, last offset 916, data: 0x   394: <256_char_alpha_num_omitted>
    The doc for OGG-01389 just has:
      Cause: There was an error while parsing the trail header.
      Action: Contact Oracle Support.
    In my log4j, I can see that javawriter.c finds all of the com.goldengate.atg.* classes and methods that it's looking for, with a "Loaded all classes for Java User Exit" log entry.  I also see the following entries from javawriter.c in the log, prior to any indication of error:
    Now loading callback methods
    Calling 'main' with JVM options: [blah, blah, blah]
    setProperty: key=JAVACHKPT, value=true
    Running in JAVA checkpointing mode
    Checking for checkpoint file
    Checkpoint file does not exist
    Java Writer Initialized
    ... then I get the following log output from javauserexit.c ... still looking good:
    (javauserexit.c:389)  [INFO]: Initialized User Exit
    (javauserexit.c:563)  [DEBUG]: User exit: EXIT_CALL_CHECKPOINT
    ... then back to output from javawriter.c :
    (javawriter.c:104)  [DEBUG]: get_current_time
    (javawriter.c:104)  [DEBUG]: get_current_time
    ... and then failure ... coming from javauserexit.c at the line indicated:
    (javauserexit.c:885)  [INFO]: User exit: EXIT_CALL_FATAL_ERROR.
    ... thinking it could have something to do with defaults being set for checkpointing, I tried the following in GGSCI prior to starting the extract in question:
    GGSCI > alter extract uePump, extseqno 0, extrba 0
    EXTRACT altered.
    GGSCI > start uePump
    EXTRACT UEPUMP starting
    ... but I get the same failure as above.
    Earlier in the log, I can see that all of the following goldengate properties are being set to defaults, since I have not specified values for them ... should I? :
    goldengate.userexit.rawchars               ... defaulting to false
    goldengate.userexit.buffertxs               ... defaulting to ops
    Checkpoint file prefix set to: userexit_
    goldengate.userexit.includebefores     ... defaulting to true
    goldengate.userexit.noignorerecs        ... defaulting to false
    goldengate.userexit.noop                    ... defaulting to false
    goldengate.userexit.nosend                 ... defaulting to false
    goldengate.userexit.nosendcols           ... defaulting to false
    Thanks for any info / advice.

    Nevermind.  I was "accidentally" working off "old" srcDb exttrail extract and resulting remote pump rmttrail extract.  Since the src was built by the default GG 11.2 format (because that's the version of GG running there on the DB server), the remote pump extract that my user exit was ingesting was  also the11.2 format.  Just added the "format release 11.1" to the exttrail of the source, and re-flushed everything and my OGG-0138 goes away.
    Sorry about the noise!

  • URGENT: user exit& customer exit

    hi every body,
                     pls let me know the difference between USER EXIT& CUSTOMER EXIT.and How& What Type of the TICKETS are received in realtime.is there any tool for receiving the tickets in SRM.
    Generally how many USERS are must for implementing the SRM project in real time.
    which implementation scenario is best for INDIA?&Why.
    i am requesting the GURUS please send me the detailed answers asap...............points will be rewarded soon.
    thanks
    warm regards
    rakhi

    Hi,
    For difference between USER EXIT& CUSTOMER EXIT,see this very good related thread:
    Re: user exit  vs customer exit
    BR,
    Disha.
    Do reward points for useful answers.

  • Version Change in User Exit , Customer Exit, Screen Exit

    Hi All,
    If Version change then whether the user exit, customer exit & screen exit will remain same? or what needs to be done for that?.
    Regards,
    Abhijit

    Hi,
    as per my knowledge there is no effect in the user exit ,in generally when version change the screens are chenges for particular transaction not the user exit .
    Regards,
    Madhu

  • Java User Exit for Variant Function logic in CRM

    Hello Experts,
    We have implemented Variant configuration in ECC with some variant functions / function modules.  Now we have to implement the corresponding Java class in CRM for the knowledge base & version to work. 
    Can anyone help me out to find the correct userexit where I need to implement this Java class consisting the variant function logic.
    Thank You
    Satish

    I don't have any CRM system at hand, but I'm sure there are some BAdI's for this. Look in SE18 for BP or BUS, and i'm sure  you will find something.
    One suggestion though: Before going for the BadI, try and see if CRM also uses change pointers for sending Idoc's . This case you wont need any user exits / badis, an probably no programming at all.
    Transaction
    BD50: Activate Change Ptrs for Mess. Type
    BD61: Activate Change Pointers - Generally
    and use report RBDMIDOC for triggering IDoc.

  • ABAP: SD user-exits - custom fields using from KNVV or VBAK

    Hi all,
    I have a technical question.
    I've created some custom fields in table KNVV. The values of these custom fields have to be used during Sales Order creation/modification for determining materials or princing, in sales order user-exits.
    My question is:
    During the Sales Order creation/modification, in the userexits:
    Is it preferable to get directly the values of the custom fields from KNVV?
    OR
    Is it preferable to transfer values of the custom fields from KNVV to VBAK (which was extended with the same custom fields like KNVV...) with transfer data, and then use only VBAK?
    Thanks in advance for your answers.
    Have a nice day!

    Anderton,
    I would prefer moving them to VBAK and then using it. Why?
    1. Once you have queried KNVV and moved it to VBAK you do not have to perform the select again.
    2. During SO change, you already have the data in VBAK so you do not have to fetch again from KNVV.
    3. Lets say the Z field was changed on KNVV after creation of SO and if your requirement is to use the Z field content when the SO was created, you cannot go back to KNVV since the data is changed. But if the same was stored in VBAK, you do not have that problem.
    Thanks,
    Vikram.M

  • User exit:Customer order-profit center

    Dear friends,
    While creating customer order, after ı fill customer and material SAP brings profit center automatically.
    I think this situation is related to user exit.. Can anyone please tell me which user exit it is?
    Regards,

    Hello,
    The Profit center is derived from material master plant view . the determination as described by you is from standard functionality.
    if you are using a WBS element, it would be derived from the WBS elements org parameters
    hope this helps
    Thanks
    Akasha

  • QQMA0011 - Notification Task User Exit / Custom Fields - Dependencies

    Dear All
    Please refer to my initial question:
    http://scn.sap.com/message/15149603
    Jogeswara Rao Kavala had a very nice input on that question.Now the next question is about building relationships between the fields that are using this custom screen. Assume that I will have two fields:
    Field 1 = Type of the Data
    Possible entries which should be picked up from a pick list are - Equipment/Functional Location/Material etc.
    Field 2= Data value - In this field, depending on the selection from field 1, I would like to select an equipment, FL, or a material. Therefore the search helps must work accordingly. And the data entry check must work accordingly too.
    Is this possible? I know that similar cases was developed for the SAP Standard new Web Dynpro Applications. But I am not sure whether this is something doable by using a user-exit?
    Regards
    GA

    Hi Goraj,
    Except for Dynamic search helps, I feel your requirements can be easily met by ABAPers. (Coding the PBO and PAI modules). But this query in the present form might not have better responses . Some work has to go on this at your end and then in case of hurdles, ABAP forum can be consulted.
    (Even dynamic search helps also possible, but through expert coding).
    Regards
    Jogeswara Rao K

  • SAPMV45A: User-Exit to handle sub item quantity

    Hello,
    In SD sales order (VA01) I create line item 10 with sub item 11 such as:
    10     89464988     1 M
    11     99912001     1 PC     10
    If I change the quantity of main item from 1 to e.g. 2 so the quantity of sub item will also be changed to 2.
    Now, Iu2019m looking for a possibility to hold the quantity of sub item to 1.
    In SAPMV45A I cannot find an appropriated user-exit for that.
    How can I set the quantity to 1 in sub item? What exit can be used for that?
    Thank your for your hints in advance.
    Regards,
    Kurt.

    Hello Kurt,
    in that case you could also try the USEREXIT_CHECK_VBEP. In XVEBP you get the number of the position, that you can read in table xvbap.
    Just but an breakpoint inside the exits and try, which is the best for your case.
    In general, in these old SAPMV45A-Exits you have access to all internal areas and tables that are defined in the program (XBAP, XBEP and so on). That makes it so easy to change - but also so dangerous.
    Regards Wolfgang

  • User exits ,customer exits

    anybody tell me difference between userexits and customer exits.

    Hi,
    These r the main differences between user exits and customer exits
    1) user exits r subroutines where as customer exits r function modules
    2) user exits r not upgraded where as customer exits r will upgrade
    3) customer exits r used for creating and additional fields or menu items to stadard tcode where as user exits r used for enabling or disabling the fields on the standrd screen or concatenating the key fields,it is not used adding an additional componenats to stadard tcode
    4) customer exits r reusable where as user exits r not reusable.
    Also:
    1. Customer exits: Implemented as Function Modules within z includes. Anybody can change it and no access key is required.
    2. User Exit: Implemented as subroutines within includes (any include except y or z includes). You need access for the specific include and then you can any subroutine (user exit) within that Include.
    BADIs are the enhanced version of user exits where the same logic is implemented via classes and object (OOP)
    Enchancement point is the latest once introduces with ECC6.0 . Not very sure about that but you can change it without any access key.
    Please go through the following link which will help you understand the exits in a much better way:
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/ec07a25db911d295ae0000e82de14a/content.htm
    http://www.sap-img.com/abap/what-is-the-difference-between-smod-and-cmod.htm
    http://sap.niraj.tripod.com/id21.html
    http://help.sap.com/saphelp_nw04/helpdata/en/c8/1975cc43b111d1896f0000e8322d00/frameset.htm
    http://www.sap-img.com/ab038.htm
    User Exits.
    http://www.erpgenie.com/sap/abap/code/abap26.htm
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sapgenie.com/abap/code/abap26.htm
    http://www.sap-img.com/abap/what-is-user-exits.htm
    http://wiki.ittoolbox.com/index.php/HOWTO:Implement_a_screen_exit_to_a_standard_SAP_transaction
    http://www.easymarketplace.de/userexit.php
    http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm
    http://www.sappoint.com/abap/userexit.pdfUser-Exit
    customer exits
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d
    Menu Exit.
    http://www.sappoint.com/abap/spmp.pdf
    http://www.sappoint.com/abap/userexit.pdf
    http://www.sapdevelopment.co.uk/enhance/mod_sapmenu.htm
    http://www.sapdevelopment.co.uk/enhance/enhancehome.htm
    1. Previously there were only user-exits.
    2. Then came the concept of customer-exits.
    3. user exits were nothing but subroutines
    FORM/PERFORM
    called from standard programs.
    4. The FORM defintion was placed inside
    an empty include file.
    5. So It was called EVERYTIME.
    and we need to MODIFY/REPAIR the
    standard include .
    6. Then it came with concept of customer-exit
    7. It consists of calling a FUNCTION MODULE,
    which is called only if
    the user-exit is ACTIVATED (other wise not called)
    In this case, the code in put inside
    a pre-defined Z include.
    8. Functionality of both is same, howerver
    we can note the following important differences
    a) Customer exit is called only if activated.
    (hence, it does not waste resources)
    b) in customer exit, REPAIR does not happen
    to the standard include.
    Exits are basically the hooks whcih SAP has provided to add your own code.
    User Exits: These are provided only SD module .
    They are Empty subroutines with naming like USEREXIT_.
    We need to have Access key to implement them.
    Customer Exits: These are enhancement techniques.
    There are defined in SMOD and implemented in CMOD.
    Types of Customer exits: Function exit, Screen Exit, Menu exit.
    User Exit and Customer Exit are same ,but SAP Exit and Customer exit are different...
    Customer Exit,
    Enables you to determine values for variables by means of Functional Module exit.The function module used is EXIT_SAPLRRSO_001.
    Create a project in CMOD by selecting the SAP Enhancement RSR00001 and assign this to the enhanced proj and activate it.
    Customer Exit
    SAP creates customer exits for specific programs, screens, and menus within standard 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.
    If you want to enhance the functionality of your SAP System, you should take advantage of the exits available in standard applications. There are two main reasons why you should use exits rather than modifying SAP software yourself. Add-ons attached to exits have the advantage that:
    • They do not affect standard SAP source code
    When you add new functionality to your SAP System using SAP’s exits, you do not alter the source code of standard SAP programs in any way. The code and screens you create are encapsulated as separate objects. These customer objects are linked to standard applications, but exist separately from SAP’s standard software package.
    • They do not affect software updates
    When you add new functionality to your SAP System using SAP’s exits, your objects (called customer objects) must adhere to strict naming conventions. When it comes time to upgrade a to a new software release, customer objects’ names ensure that they will not be affected by any changes or new additions to the standard software package.
    Customer exits are not available for all programs and screens found in the SAP System. You can only use customer exits if they already exist in the SAP System. You find find more information about locating applications with pre-defined exits in Locating Applications that have Exits
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm
    SAP EXIT:this processing type contained in variables that are delivered with SAP BW business content.
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/frameset.htm
    User Exits: allow you to add additional functions to the SAP standard.
    Programs with user exits contain subroutine calls at certain points in their syntax that are identified by the prefix USEREXIT. The actual user exits are located in an include that has been assigned to a module pool. This is where customers can include any changes (enhancements) that they want to make to the system. These includes are always processed during program flow.
    Advantage: In principle, customers can modify anything they want that is found in the include (tables, structures, and so forth).
    Disadvantage: SAP cannot check the individual enhancements themselves which often leads to errors
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • User Exit Custom Code

    Hi,
    I implemented a user exit and has implemented some codes on a particular form; after activating, the whole user exit has been grayed out from modification. How can I undo?
    Thanks.

    Hi,
    Go to the include inside user exit and switch off modification assistant by navigating following path
    EDIT->MODIFICATION OPERATIONS->SWITCH OFF ASSISTANT.
    Please let me know in case you face any more issues.
    KR Jaideep,

  • IPC  java user exit- pricing routines

    Hi experts,
    I am new to IPC  java pricing routines and i have a requirement like this,
    1. The user enters manually in Quote the new price. (say cond type ZNEW)
    2. The cond record for ZTKE is available with the price as well as Max price and Min Price.
    3. The Routine formula should validate with ZTKEcondition record with maximum and minimum price available.
    4. If the new price is within the max/min range then pass it. System will do nothing and accept the manual price entered.
    5. If the price is not within the range then issue error message u2018Price not within the rangeu2019. The system does not accept the manual entry of the new price.
    Please let me know how to approach for the solution of the above.
    I know how to raise the error messages ,my main concern is to check the new price of condition type with the other condition type min n max values.
    Please provide me some pointers on it.
    Thanks.

    Hi Faiq,
    I am facing the same problem as you.
    I tried to solve it via the following code sample:
    throw new PricingRuntimeException([MessageClass], [MessageNumber], [Attributes], [RootCauseException]);
    throw new PricingRuntimeException("ZTEST", 0, new String[] {"test2"}, null);
    But no error appeared.
    Another possibility can be the following method!?
    But I do not know how to use it:
    pricingItem.getUserExitDocument().setStatusMessage(new StatusEvent());
    Perhaps meanwhile you have found another solution.
    If yes it will be nice if you post it.
    Greets Ruben

  • CRM - Pricing User Exit in Java - BADI CRM_COND_COM_BADI

    Hi All
    I have to convert some user-exit from Abap to Java in order to work in CRM Pricing Scenario (I use VMC technology based on Web AS 7.00).
    In the manual attached to note 809820 (New userexit concept for pricing)
    I find this chapter but I don't understand how to work with BADI <b>CRM_COND_COM_BADI.</b>
    <b>My objective is to create Java user-exit using Custom Tables and Fileds.</b>
    <b>Passing additional information to pricing</b>
    To summarize, if the information used in a requirement is not depending on the current calculation result, then the information can be passed to the pricing engine. This is the best way to avoid e.g. DB or JCo calls from the user exits.
    Nearly all application scenarios using the pricing engine provide a way of filling additional attributes.
    1. Create a field catalogue entry for the additional attribute
    2. Program the filling of that attribute value
    The application calling the pricing engine and the way it is allowing customer code to fill or influence attributes is not part of this document. Here is only a short list of documentation to start with (also various notes exist):
    Application Description
    CRM Online Order Processing
    Implement BADI CRM_COND_COM_BADI. Note 850077
    Mobile Solutions Implement VBA user exit methods on SPCDOCHANDLER or SPCITEMHANDLER.Note 677314 and Note 934216
    Best regards
    Davide Ivanov
    [email protected]

    Hi davide,
    The BADI CRM_COND_COM_BADI is used for filling the pricing communication structure.
    If you have added any field at header level of the field catelog that will available in the changing parameter of the method HEADER_COMMUNICATION_STRUCTURE.
    If you have added any field at item level of the field catelog that will available in the changing parameter of the method ITEM_COMMUNICATION_STRUCTURE.
    Additional fields added at catelog can be filled with the values using this BADI.
    Thanks & Regards,
    Raghuram. K.R.

  • Is it safe/okay to use RSNAST00 program in a user-exit?

    Hi Experts,
    I got a business requirement and its:
    After SAVEing the sales order......by using the user-exit USEREXIT_SAVE_DOCUMENT I have to trigger custom IDOC (currently its in the system and using for some other application) outbound direction to XYZ logical system.
    But, the functional spec is asking me to to use RSNAST00 program in the above said user-exit.
    So pls clarify,
    1) Is it safe to use this RSNAST00 program in the user-exits?
    2) If so, Wht is the best/safest approach to use it? is it by using SUBMIT AND RETURN statement? or do we have any other?
    3) Actually, guess this is not good approach (achieving via ABAP workbench/triggering IDOC outbound by custom code of user-exit) to meet this functionality.......its a configuration task need to done by functional guy.

    Thank you Vinod.
    If thats the ONLY concern, then I can write a seperate FM, where in I will use SUBMIT RSNAST00 AND RETURN statements, and I will call this FM in a SEPERATE / BACKGROUND TASK, which works in a seperate LWU.
    Pls. shade some light
    Thank you

Maybe you are looking for

  • Remotely control the ITunes on Windows 7 64 bit PC with the new IPad

    With the latest version of ITunes for both Win7 and the new IPad, I'm only able to use the new IPad to remotely control the ITunes on Windows 7 64 bit PC through wired connection  ( ethernet cable ) to the wireless router. As soon as I connect my PC

  • What is the processor family for an Intel T2080?

    Hi everyone, I'm compiling my own kernel and I'm stuck on the part regarding processor family. I got a weird sort of CPU. It's an intel pentium dual core T2080. It's not a Core 2 Duo or any of that. According to wikipedia, the model name is 'Yonah' a

  • Delete AUD$ table do not free space

    Hi, We have an Oracle 10g database (10.2.0.4) with the Oracle auditing feature on. Our problem is that I delete on regular basis the AUD$ rows, but the system do not free the space on the tablespace. The system free the space only after a truncate. T

  • How to solve LIBTUX_CAT:6031?

    enviroment:Digital Unix 4.0/Tuxedo 7.1/Sybase 12.0 I'v got the following errors at the end of a service while tpreturn and don't know how to deal with it: LIBTUX_CAT:6031: ERROR: Unable to pre-process buffer before tranmission. Error code(12/3841) 15

  • New to GB guitar recording - Need some noise tips

    Hello everyone, I've finally got my 20" iMac, and now of course, I wanna record some guitar. I have a Traynor YCV80 tube amp, and i've come out of its line out into the imac's line in. I've done all the preference settings in GB and in system prefs i