Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

Com partilhar 0 mais Próximo blog» Criar um blog Login

SAP CRM
Powered by Acorel, SAP experts

Wednesday, May 30, 2012 Subscribe

Reading messages and exceptions after calling CRM Subscribe


order maintain
Within SAP CRM the function module “CRM_ORDER_MAINTAIN” is used to create and change
an Order. Although it has some exceptions implemented, the function module will not return
the messages and exceptions within the Order itself. Instead it only tells if the maintain was
Search
executed correctly or not. It might be necessary to read the messages and exceptions
afterwards, for instance to return them to a portal. This blog contains an overview of the Search
steps that need to be executed.

Scenario Follow by mail


Within the CRM Webclient we entered an invalid Sold-To-Party. We’ll use this scenario to
Email address... Submit
show how to get this exception message after calling function module
“CRM_ORDER_MAINTAIN”.

Links
Acorel

Acorel on Facebook
blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 1/6
2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

Step 1 : Get log handles Acorel on Twitter


After calling function module “CRM_ORDER_MAINTAIN” we first need to determine the
currently existing log handles. Function module “CRM_MESSAGES_GET_LOG_HANDLES” can
be used to read these log handles.

DATA:
lt_log_handle TYPE bal_t_logh.

* Get Log Handle(s)


CALL FUNCTION 'CRM_MESSAGES_GET_LOG_HANDLES'
IMPORTING
et_log_handle = lt_log_handle. Total Pageviews

Step 2 : Get messages and exceptions 284,795


Once we have determined the log handles, we can search for messages and exceptions
within these log handles, using function module “CRM_MESSAGES_GET_EXCEPTIONS”.

The code below reads the exceptions for the log handles, determined in step 1.
Followers

Join this site


w ith Google Friend Connect
DATA:
lt_exception TYPE crmt_exception_t. Members (86) More »

FIELD-SYMBOLS:
<lfs_log_handle> TYPE balloghndl.

* Get Exception(s)
LOOP AT lt_log_handle ASSIGNING <lfs_log_handle>.
CALL FUNCTION 'CRM_MESSAGES_GET_EXCEPTIONS'
EXPORTING
iv_log_handle = <lfs_log_handle>
iv_from_regmsg = abap_true
IMPORTING Already a member? Sign in
et_exception = lt_exception

blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 2/6
2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

EXCEPTIONS
parameter_error = 1
not_found =2 Subscribe To
OTHERS = 3.
ENDLOOP. Posts

Comments

Step 3 : Get message


Within step 2 we determined the exception messages within a log handle. Once we have
Blog Archive
the exceptions, we can read the corresponding messages using function module
“CRM_MESSAGES_GET_MSG_INFO”.
► 2013 (7)

The code below processes all exceptions, determined in step 2. ▼ 2012 (52)
► December (4)
► November (4)
DATA:
ls_msg TYPE bal_s_msg.
► October (5)
► September (4)
FIELD-SYMBOLS:
<lfs_exception> TYPE crmt_exception. ► August (5)
► July (4)
* Get Exception Message(s)
LOOP AT lt_exception ASSIGNING <lfs_exception>. ► June (4)
CLEAR ▼ May (5)
ls_msg.
Reading
CALL FUNCTION 'CRM_MESSAGES_GET_MSG_INFO' messages and
EXPORTING exceptions
is_msg_handle = <lfs_exception>-msg_handle after calling
IMPORTING CRM ...
es_msg = ls_msg Using
EXCEPTIONS webservices
not_found =1 and document
wrong_context_structure = 2 templates to
data_error =3 genera...
OTHERS = 4.
Disable change
ENDLOOP.
documents for
tables created
blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 3/6
2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

The actual message and it’s attributes are stored in structure “LS_MSG”. using ...
Guide to SAP
Netweaver
Gateway
OData &
Sybase Unwi...
Display specific
actions as
buttons in the
CRM Web...

► April (4)
► March (4)
► February (5)
► January (4)

► 2011 (52)
► 2010 (24)

Conclusion Contributors
Although standard function module “CRM_ORDER_MAINTAIN” doesn’t return functional Martijn de Jong
messages and exceptions, it is quite easy to read them.
Emiel Truijen
Posted by Edwin - Acorel at 12:00 PM

Recommend this on Google Daan - Acorel

Labels: CRM Order, CRM_MESSAGES_GET_EXCEPTIONS, Robbert van der Ploeg


CRM_MESSAGES_GET_LOG_HANDLES, CRM_MESSAGES_GET_MSG_INFO,
CRM_ORDER_MAINTAIN, Exceptions, Messages, SAP, SAP CRM Pieter - Acorel

Aart Troost
No comments:
Mark Peeters
Post a Comment
blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 4/6
2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

Enter your comment... Guus Dorenbos

Chantal Witt-Kuenen

Pieter - Acorel

Edwin - Acorel

Ralph Bonink - Acorel


Comment as: Google Account
Wilco - Acorel
Publish Preview

Roel Rutten

Jeroen Rikhof

Newer Post Home Older Post Pieter Breunesse

Olaf Pohlmann
Subscribe to: Post Comments (Atom)
Aik Leemreize

Nick Acorel

Sander van Dillen

Gert-Jan Stolmeijer

Pieter Rijlaarsdam

blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 5/6
2/18/13 SAP CRM: Reading messages and exceptions after calling CRM order maintain

Contact me

Acorel - SAP CRM

pow ered by

Awesome Inc. template. Powered by Blogger.

blog.acorel.nl/2012/05/reading-messages-and-exceptions-after.html 6/6

You might also like