cancel
Showing results for 
Search instead for 
Did you mean: 

Warning message at CRMD_ORDER

Former Member
0 Kudos

Hi,

I would like to show warning message at CRMD_ORDER when user saves a quotation.

Thus, I tried to call FM 'CRM_MESSAGE_COLLECT' in the BAdI ORDER_SAVE method 'IF_EX_ORDER_SAVE~CHECK_BEFORE_SAVE', with parameter iv_msgty='W'.

However, the message cannot be shown, unless I change the parameter iv_msgty = 'E'.

How can I show the warning message in CRMD_ORDER when a quotation is saved?

Regards,

Tony

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try ds BADI ORDER_SAVE-BADI CRM Order Save

DATA : header TYPE crmt_object_guid_tab,

t_product TYPE crmt_product_i_wrkt,

t_pricing TYPE crmt_pricing_i_wrkt,

l_pricing LIKE LINE OF t_pricing,

t_orderadm TYPE crmt_orderadm_h_wrkt,

l_orderadm LIKE LINE OF t_orderadm,

v_its TYPE c VALUE IS INITIAL.

DATA: it_sales TYPE CRMT_SALES_WRKT ,

it_pricing TYPE CRMT_PRICING_WRKT ,

it_orgman TYPE CRMT_ORGMAN_WRKT ,

it_partner TYPE CRMT_PARTNER_EXTERNAL_WRKT .

DATA: wa_sales LIKE LINE OF it_sales ,

wa_pricing LIKE LINE OF it_pricing ,

wa_orgman LIKE LINE OF it_orgman ,

wa_partner LIKE LINE OF it_partner .

CONSTANTS: c_vend TYPE CRMT_PARTNER_FCT VALUE '00000035',

c_emp TYPE CRMT_PARTNER_FCT VALUE '00000014',

c_kind TYPE CRMT_OBJECT_KIND VALUE 'A' .

CALL FUNCTION 'GUI_IS_AVAILABLE'

IMPORTING

return = v_its.

IF v_its <> 'X'.

ELSE.

CLEAR : header.

APPEND iv_guid TO header.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_header_guid = header

IMPORTING

et_orderadm_h = t_orderadm

et_product_i = t_product

et_pricing_i = t_pricing

et_orgman = it_orgman

et_pricing = it_pricing

et_sales = it_sales

et_partner = it_partner

EXCEPTIONS

document_not_found = 1

error_occurred = 2

document_locked = 3

no_change_authority = 4

no_display_authority = 5

no_change_allowed = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE e001(z01).

"RAISING do_not_save..

ENDIF.

LOOP AT t_orderadm INTO l_orderadm.

IF l_orderadm-process_type EQ 'ZVOR' OR l_orderadm-process_type EQ 'ZFOR'

OR l_orderadm-process_type EQ 'ZOOS' OR l_orderadm-process_type EQ 'ZFQT'

OR l_orderadm-process_type EQ 'ZVQT' OR l_orderadm-process_type EQ 'ZOQS'

OR l_orderadm-process_type EQ 'ZVIL'.

LOOP AT it_orgman INTO wa_orgman.

IF wa_orgman-sales_org_resp_short IS INITIAL.

MESSAGE w003(z01). " Please input organization unit

ENDIF.

IF wa_orgman-sales_org_short IS INITIAL.

MESSAGE w004(z01). " Please input sales organization

ENDIF.

IF wa_orgman-dis_channel IS INITIAL.

MESSAGE e005(z01). " Please input distribution channel.

ENDIF.

IF wa_orgman-division IS INITIAL.

MESSAGE e006(z01). " Please input division

ENDIF.

IF wa_orgman-sales_office_short IS INITIAL.

MESSAGE e007(z01). " Please input sales office

ENDIF.

ENDLOOP.

LOOP AT it_pricing INTO wa_pricing.

IF wa_pricing-currency IS INITIAL.

MESSAGE e010(z01). " Please enter currency

ENDIF.

ENDLOOP.

READ TABLE it_partner INTO wa_partner WITH KEY ref_partner_fct = c_emp ref_kind = c_kind.

IF SY-SUBRC NE 0.

MESSAGE e011(z01). " Please enter employee number

ELSE.

IF wa_partner-ref_partner_no IS INITIAL.

MESSAGE e011(z01). " Please enter employee number

ENDIF.

ENDIF.

READ TABLE it_partner INTO wa_partner WITH KEY ref_partner_fct = c_vend ref_kind = c_kind.

IF SY-SUBRC NE 0.

MESSAGE e012(z01). " Please enter vendor number

ELSE.

IF wa_partner-ref_partner_no IS INITIAL.

MESSAGE e012(z01). " Please enter vendor number

ENDIF.

ENDIF.

IF t_product IS INITIAL. "Check Product

MESSAGE w001(z01).

"RAISING do_not_save.

ENDIF.

IF t_pricing IS INITIAL. "Check Price

MESSAGE W002(z01).

ENDIF.

LOOP AT t_pricing INTO l_pricing. "Check Price rate if equals 0

IF l_pricing-net_value EQ 0.

MESSAGE e002(z01).

ENDIF.

ENDLOOP.

ENDIF.

ENDLOOP.

ENDIF.

ENDMETHOD.

Create Message class from Z.

Regards,

Mehul

Former Member
0 Kudos

Hi Mehul,

Thanks for your help.

I've tried your code to put the warning message with statement


message w192(ztony).

However, this warning message is shown at the bottom of the screen. Such kind of message will be gone when user changes the tab or trigger any action in the screen.

Is it possible to show the warning message at the Application Log just under the toolbar?

Regards,

Tony

Former Member
0 Kudos

Hi Tony,

The FM CRM_MESSAGE_COLLECT, throws warning messages only along with Error Messages. If it has to throw an individual warning message, it doesn't work. But, it is possible to throw a Individual Error Message using it.

The solution for this would be to code in Component Work Bench (BSP_WD_CMPWB).

Goto that particular Component to which SAVE button belongs, and in the Implementation class you would find the EH_ONSAVE method.

In that method try using the method ADD_MESSAGE.

For example:

add_message( iv_msg_type = 'I'

iv_msg_id = 'ZPREETHA'

iv_msg_number = '000'

iv_msg_v1 = lv_msgv1

iv_msg_v2 = lv_msgv2 ).

By this, you can get warning message in Web UI.

Regards,

Preetha

Former Member
0 Kudos

Hi,

The solution I provided is BSP(Business Server Pages) based. It will work only in Web UI of CRM and not in SAP GUI. This solution will help you, if you are working with the latest version of CRM having the New Web UI.

For SAP GUI, I don't think a solution exists. Please post the solution if you find any.

Regards,

Preetha

Former Member
0 Kudos

The Function Module CRM_MESSAGE_COLLECT would throw an Error or warning Message, when an exception

" Raise DO_NOT_SAVE" is used after calling the Function Module.

Former Member
0 Kudos

Hi,

We have similar requirements.

We want to issue a warning message to the user when some validations fail, at the same time allow the user to save the transaction.

We tried the option of putting the code in BADI- order_save, but in this BADI the only options that works is adding a raise do_not_save after FM CRM_MESSAGE_COLLECT as suggested in the previous post.

Is there any other BADI where we can do some validations on Item dates.

We are using CRM Service Order BSP and CRM 5.0 SP09.

The scenario we want to have is

1) If the item dates validation fails when the user presses save or End , default the dates to system date

2) Give a warning message to the user that the dates have been defaulted and allow the save to happen.

Please let me know if there is anyway of achieving this .

Regards

Hemant

Former Member
0 Kudos

What was the solution for this one?

Answers (1)

Answers (1)

shivalingesh
Explorer
0 Kudos

hi tony i am not even able to show error message there;

i am also calling the same

CALL FUNCTION 'CRM_MESSAGE_COLLECT'

     EXPORTING

       iv_caller_name = gc_object_name-orderadm_h

       iv_ref_object  = iv_header_guid

       iv_ref_kind    = gc_object_kind-orderadm_h

       iv_msgno       = iv_msgno

       iv_msgid       = iv_msgid

       iv_msgty       = iv_msgty

       iv_msgv1       = iv_msgv1

       iv_msgv2       = iv_msgv2

       iv_msgv3       = iv_msgv3

       iv_msgv4       = iv_msgv4

       iv_msglevel    = '1'

       iv_cumulate    = iv_cumulate

     EXCEPTIONS

       not_found      = 1

       appl_log_error = 2

       OTHERS         = 3.

in a API from check_before_save


but error message is not appearing but the saving process will be stopped.