on 02-20-2014 8:59 PM
Hi All,
I am trying to add custom method in *DPC_EXT class while activating they are in RED.. I want to define methods in Class which I am planning to use in standard methods of the class.. Can I define custom methods in *DPC_EXT class and it good approach..
Thanks
Rajesh
Hi Rajesh,
yes you can add custom method in DPC_EXT class. I added one method and called it from _GET_ENTITYSET standard method. There were no error while activation or while runtime generation.
so answer to your question is, Yes you can define custom methods in *DPC_EXT class.
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am calling custom method from *GET_ENTITY method..and trying to raise exception using following code and want to send my custom message. It works if i am raising it in *GET_ENTITY.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error
message_container = gv_message_container.
If process fails in custom method and I want raise the exception.. any how its going uncaught..
Regards,
Rajesh
Hi Krishna,
I have tried it.. but i have to exception handling for it in my standard methods GET_ENTITY or ENTITYSET.. I am looking to create custom method which will do exception handling and can raise standard exception - *business or *techincal. So if i can call custom method for any business logic can raise standard exception.. I am trying to condense and reuse the code..
Please advice any useful pointers..
Regards,
Rajesh
Here is the details what we are trying to achieve:
In standard *DPC_EXT class we have defined custom methods/attributes, so we can reuse the method in service. We also want to handle the exception here.. And raise exception as we do in GET_ENTITY or *ENTITYSET.
I have created a method and added standard exceptions to method:
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION
Also raising the exception in custom method as:
gv_message_container->add_messages_from_bapi(
it_bapi_messages = lt_return
iv_determine_leading_msg = /iwbep/if_message_container=>gcs_leading_msg_search_option-first
).
* RAISE
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error
message_container = gv_message_container.
ENDIF.
But "RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception" is giving error.. Our intention is to raise exception for custom class if some error occurred..
Following is the screen shot & signature of custom method
Regards
This has to do with the flag for class based exceptions.
See here.
Thanks Krishna,
I followed the link.. and set the class exception for method.. now its not giving compilation error.. But when i am raising exception it is giving following error:
I am passing error message.. which needs to be displayed..same thing work if I raise it within standard method *ENTITY/*ENTITYSET..
<?xml version="1.0" encoding="utf-8" ?>
</innererror>
</error>
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.