cancel
Showing results for 
Search instead for 
Did you mean: 

Error message control for invoice w/o PO in SRM

former_member293881
Participant
0 Kudos

Hi,

Anyone know how to setup error message if invoice value limit is above e.g. 10000 USD? Invoice will be entered without PO.

There will be no PO but invoice will be created and user should get error message if total invoiced value is above 10000 USD.

We are in SRM_SERVER5.5 with SP 06.

If anyone came across during IMS setup, please help me on it.

Thanks in advance.

Regards,

Rahul Mandale

Accepted Solutions (1)

Accepted Solutions (1)

former_member195032
Active Contributor
0 Kudos

As mentioned above BADI BBP_DOC_CHANGE_BADI should be helpful in solving this issue.You can use method BBP_IV_CHANGE

In this method, parameters are available for changing invoices.

For more information, see the documentation for method BBP_IV_CHANGE.

BBP_DOC_CHANGE_BADI to make changes to the document, after user entry and before saving the document to the database. These changes are subject to the document-specific checks.

regards,nishant

please reward if it helps.

former_member293881
Participant
0 Kudos

Nishant

Thanks for your valuable help. I would like to ask one more question.

In Badi where can add the message to the document

as in the badi access only hedaer and Item data

but there is no field or place for updating the message base do validation??

Please let me know. Thanks

Rahul Mandale

Former Member
0 Kudos

Hi

For adding messages, Use the BBP_DOC_CHECK_BADI by creating an implementation of the same.

Let me know incase you need any help.

Pls reward suitable points.

Regards

- Atul

former_member293881
Participant
0 Kudos

Hi Atul,

I have implemented BADI for CHANGE but I am not getting any message in debug and test. I am not clear about adding messages in CHECK BADI.

Can you explain in detail? Please help for it.

Thanks in advance.

Rahul

Former Member
0 Kudos

Hi

Create an Implemenatation of the BBP_DOC_CHECK_BADI in the transaction <b>SE19</b>.

<b>The following sample code will serve you to go ahead.</b>

method IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK .

data         ls_message TYPE bbp_smessages_badi.


*--- 1st way to create  custom message
    clear ls_message.
    ls_message-msgty = 'E'.
    ls_message-msgid = 'ZBBP_DOC_MES'.
    ls_message-msgno = '005'.
    append ls_message to et_messages.

*--- 2nd way to create  custom message

  If sy-subrc <> 0.
*Report any errors
    loop at lt_mess_bbp into ls_mess_bbp where msgty = 'E'.
      CLEAR ls_message.
      ls_message-msgty   = ls_mess_bbp-msgty.
      ls_message-msgid   = ls_mess_bbp-msgid.
      ls_message-msgno   = ls_mess_bbp-msgno.
      ls_message-message = ls_mess_bbp-message.
      ls_message-msgv1   = ls_mess_bbp-msgv1.
      ls_message-msgv2   = ls_mess_bbp-msgv2.
      ls_message-msgv3   = ls_mess_bbp-msgv3.
      ls_message-msgv4   = ls_mess_bbp-msgv4.
      APPEND ls_message TO et_messages.
    endloop.
endif.

endmethod.

Hope this will help.

Please reward suitable points.

Regards

- Atul

former_member293881
Participant
0 Kudos

Hi Atul,

Thanks for your useful answer. I am getting error message while creation of invoice. But problem is that it is throwing message for all invocie, need to consider if condition of 'GROSS_AMOUNT >= 1000 USD. During creation of invoice, it should throw msg 001 (YIMS) which I have configured as my exception in IMS when fulfills the condition.

I am sending code for 'CHANGE' and "CHECK' BADI.

Can you check and suggest the correction? Where I need to put this conditon for pop up of error while gross_amount >= 1000 while creation and change of invoice??

Thanks in advance.

regards,

Rahul

******************************************************

<b>method IF_EX_BBP_DOC_CHANGE_BADI~BBP_IV_CHANGE.</b>

DATA: ls_header TYPE bbp_pds_inv_header_d,

lt_messages TYPE TABLE OF bbp_smessages_badi,

ls_message TYPE bbp_smessages_badi,

lf_dummy TYPE c,

lf_gross_amount TYPE BBP_IV_AMOUNT,

i_guid TYPE BBP_GUID .

  • get data of the invoice from guid

CALL FUNCTION 'BBP_PD_INV_GETDETAIL'

EXPORTING

i_guid = i_guid

IMPORTING

e_header = ls_header.

IF ls_header-GROSS_AMOUNT >= 1000.

CLEAR ls_message.

ls_message-msgty = 'E'.

ls_message-msgid = 'YIMS'.

ls_message-msgno = '001'.

APPEND ls_message to lt_messages.

EXIT.

ENDIF.

************************************************************************************

<b>method IF_EX_BBP_DOC_CHECK_BADI~BBP_DOC_CHECK.</b>

Data ls_message TYPE bbp_smessages_badi.

*To create custom message

clear ls_message.

ls_message-msgty = 'E'.

ls_message-msgid = 'YIMS'.

ls_message-msgno = '001'.

append ls_message to et_messages.

endmethod.

former_member293881
Participant
0 Kudos

Hi all,

Now I can see exception triggered while creation of Invoice. That exception now can be send to IMS successfully where in IMS it is as exception.

I appreciate all help contributed in forum.

regards,

Rahul Mandale

Former Member
0 Kudos

Hi

The code what you are using in BBP_DOC_CHANGE_BADI should come in the BBP_DOC_CHECK_BADI.

No need to put any code in BBP_DOC_CHANGE_BADI for the purpose of creating custom message.

<b>This will resolve the problem.

Please use the following code as a reference.</b>

METHOD if_ex_bbp_doc_check_badi~bbp_doc_check.

   Data :
       ls_message TYPE bbp_smessages_badi,
       ls_header         TYPE          bbp_pds_sc_header_d.

*- Check or order shopping cart situations
  IF iv_mode EQ 'T' OR
     iv_mode EQ 'U' OR
     iv_mode EQ 'C' OR
     iv_save EQ 'X'.

*- Get shopping cart details
    CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
      EXPORTING
        i_guid          = iv_doc_guid
        i_with_itemdata = 'X'
      IMPORTING
        e_header        = ls_header.

IF ls_header-GROSS_AMOUNT >= 1000.
*----Preparing the error message
CLEAR ls_message.
ls_message-msgty = 'E'.
ls_message-msgid = 'YIMS'.
ls_message-msgno = '001'.
ls_message-msgv1     = 'Creation of Invoice not Possible'.   " Your Custom Error message ->>> 
APPEND ls_message to lt_messages.
EXIT.
ENDIF.

ENDIF.

ENDMETHOD.

The code you are using in DOC_Change is for complete (Whole documnet, which may consist of several line items)

Please confirm this, whether, you are looking for each line item -> Gross_Amount OR

for a whole Invoice -> Gross_Amount.

Hope this will help.

Please reward suitable points.

Regards

- Atul

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rahul,

You can Implement the Check badi for the Invoice ( BUS2205). In which you can get the details of Invoice using GUIDn and then just check for the required validation then upo date the messages table.

Example.

You can get the " VALUE( IV_DOC_GUID ) TYPE BBP_GUID" from Import parameters.

tehn using teh functional module

CALL FUNCTION 'BBP_PD_INV_GETDETAIL'

EXPORTING

i_guid = iv_doc_guid

IMPORTING

e_header = ls_header

- - - - - -

-


-


.

You can get the details of invoice ./ tehn check for required validdations If it fails then update the message class like shown bellow.

CLEAR ls_message.

ls_message-msgty = ls_mess_bbp-type.

ls_message-msgid = ls_mess_bbp-id.

ls_message-msgno = ls_mess_bbp-number.

ls_message-message = ls_mess_bbp-message.

ls_message-msgv1 = ls_mess_bbp-message_v1.

ls_message-msgv2 = ls_mess_bbp-message_v2.

ls_message-msgv3 = ls_mess_bbp-message_v3.

ls_message-msgv4 = ls_mess_bbp-message_v4.

APPEND ls_message TO et_messages.

where 'et_messages' is en export table. which shows the message.

If you need more information call me oj 952 334 9990