No proper error messages returned when using case via BAPIs
[Bapi] [Case] [china proper] [Error] [input.] [Message] [nfs returned error] [proper] [proper boot device] [wrong]
- Adding option to read attributes from DB in case bapiSymptom Scenario is valid when using the BAPI’s. Once the case is opened , the attributes are read from DB and saved in buffer. If the attributes are changed other than by...
- Error Popup while storing/retrieving documentsSymptom You get an error message when storing/retrieving documents with the error text “Error Determining document properties…” Other terms Error determing document properties, error message Reason and Prerequisites This is due to...
- SM30: Selection Conditions ended with errorSymptom You have a maintenance view with some Selection Conditions pre-defined. These selection conditions are defined in ranges (using GT, GE, LE and LT options). The conditions are for non-CHAR fields. When...
Symptom
Meaningless error message returned from BAPIs for wrong input values,
For eg : user creates case using BAPI & passes wrong input values get the message: “Internal error: class CL_SCMG_CASE_API; method SAVE”.
Other terms
BAPI, case, error message, error, wrong input.
Reason and Prerequisites
When wrong input values are passed to BAPI’s and case is created from backend, no specific error was sent back by BAPIs though backend was sending messages to BAPIs. The save method called to save the case, returns a table of error message for all the wrong input values passed, which was not caught outside the method to display the messages.
This table is now caught outside the save method and all the error messages, returned by the method is now displayed.
Solution
Apply the note.
Please do the Manual Corrections before applying the Note.
Manual Correction for release 640:
Go to transaction SE80 and changes under Function Group:SCMG_BAPI_CASE.
Numbers to the left side of the code are the line numbers.
1. Subroutine SAVE_CASE:
***********Context Block:***********
346 FORM save_case USING
347 l_case TYPE REF TO if_scmg_case_api
348 new_version TYPE xfeld
349 CHANGING
350 return LIKE bapiret2
351 lt_error_message TYPE bapiret2_t.
1.1) ** Add Code**
Define local variables :
lt_error_messg TYPE TABLE OF scmg_attr_return_value,
ls_error_messg TYPE scmg_attr_return_value,
ls_error_message TYPE bapiret2.
***********Context Block: ***********
359 CALL METHOD l_case->save
360 EXPORTING
361 im_new_version = new_version
362 IMPORTING
363 ex_messages = lt_error_messg
364 EXCEPTIONS
365 OTHERS = 1.
366 IF sy-subrc <> 0.
1.2) **Add Code**
IF lt_error_messg IS NOT INITIAL.
LOOP AT lt_error_messg INTO ls_error_messg.
MOVE-CORRESPONDING ls_error_messg TO ls_error_message.
APPEND ls_error_message TO lt_error_message.
ENDLOOP.
ENDIF.
2. Function Module: BAPI_CASE_DELETEELEMENTS
***********Context Block:***********
14 DATA: l_case TYPE REF TO if_scmg_case_api,
15 return_line TYPE bapiret2.
**Add Code**
Define Local variable lt_error_message TYPE bapiret2_t,
ls_error_message TYPE bapiret2.
***********Context Block:***********
48 PERFORM save_case
49 USING
50 l_case
51 new_version
52 CHANGING
53 return_line.
2.1) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF return_line IS NOT INITIAL OR lt_error_message IS NOT INITIAL.
APPEND return_line TO return.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return.
ENDLOOP.
RETURN.
ENDIF.
3. Function Module: BAPI_CASE_CREATE
***********Context Block:***********
22 DATA: l_case TYPE REF TO if_scmg_case_api,
23 l_wf_template TYPE srmwfpthid,
24 return_line TYPE bapiret2.
3.1) **Add Code**
Define local variable: lt_error_message TYPE bapiret2_t,
ls_error_message TYPE bapiret2.
***********Context Block:***********
114 PERFORM save_case
115 USING
116 l_case
117 ”
118 CHANGING
119 return_line.
3.2) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF return_line IS NOT INITIAL OR lt_error_message IS NOT INITIAL.
APPEND return_line TO return.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return.
ENDLOOP.
RETURN.
ENDIF.
4. Function Module: BAPI_CASE_CHANGEATTRIBUTES
***********Context Block:***********
12 DATA: l_case TYPE REF TO if_scmg_case_api,
13 l_attr_name TYPE string,
14 l_attr_value TYPE string,
15 wa_attribute LIKE LINE OF case_attributes.
4.1) **Add Code**
Define local variable: lt_error_message TYPE bapiret2_t,
ls_error_message type bapiret2.
***********Context Block:***********
43 PERFORM save_case
44 USING
45 l_case
46 ”
47 CHANGING
48 return.
4.2) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF lt_error_message IS NOT INITIAL.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return_error.
ENDLOOP.
RETURN.
ENDIF.
5. Function Module: BAPI_CASE_CHANGE
***********Context Block:***********
22 DATA: l_case TYPE REF TO if_scmg_case_api,
23 return_line TYPE bapiret2.
5.1) **Add Code**
Define local variable: lt_error_message TYPE bapiret2_t,
ls_error_message type bapiret2.
***********Context Block:***********
120 PERFORM save_case
121 USING
122 l_case
123 new_version
124 CHANGING
125 return_line.
5.2) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF return_line IS NOT INITIAL OR lt_error_message IS NOT INITIAL.
APPEND return_line TO return.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return.
ENDLOOP.
RETURN.
ENDIF.
6. Function Module: BAPI_CASE_ADDNOTES
***********Context Block:***********
12 DATA: l_case TYPE REF TO if_scmg_case_api,
**Add Code**
Define local variable: lt_error_message TYPE bapiret2_t,
ls_error_message type bapiret2.
***********Context Block:***********
42 PERFORM save_case
43 USING
44 l_case
45 new_version
46 CHANGING
47 return.
6.1) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF lt_error_message IS NOT INITIAL.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return_error.
ENDLOOP.
RETURN.
ENDIF.
Now add the piece of code below the PERFORM save_case.
IF return_line IS NOT INITIAL OR lt_error_message IS NOT INITIAL.
APPEND return_line TO return.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return.
ENDLOOP.
RETURN.
ENDIF.
7. Function Module: BAPI_CASE_ADDELEMENTS
***********Context Block:***********
16 DATA: l_case TYPE REF TO if_scmg_case_api,
17 return_line TYPE bapiret2.
**Add Code**
Define local varibale: lt_error_message TYPE bapiret2_t,
ls_error_message type bapiret2.
***********Context Block:***********
51 PERFORM save_case
52 USING
53 l_case
54 new_version
55 CHANGING
56 return_line.
7.1) **Add Code**
Add following Changing Parameter to subroutine save_case below the parameter return_line:
lt_error_message.
Now add the piece of code below the PERFORM save_case.
IF return_line IS NOT INITIAL OR lt_error_message IS NOT INITIAL.
APPEND return_line TO return.
LOOP AT lt_error_message INTO ls_error_message.
APPEND ls_error_message TO return.
ENDLOOP.
RETURN.
ENDIF.
Manual Corrections for Release: 640, 700, 701, 710, 711:
Add Parameters to the following function modules:
1) Function Module: BAPI_CASE_ADDNOTES
1.1) Open the function module.
1.2) Go to the Tab Tables.
1.3) Add the following parameter: RETURN_ERROR LIKE BAPIRET2 as described below:
1.3.1) Add RETURN_ERROR under Parameter Name.
1.3.2) Add LIKE under Typing.
1.3.3) Add BAPIRET2 under Associated Type.
2) Function Module: BAPI_CASE_CHANGEATTRIBUTES
2.1) Open the function module.
2.2) Go to the Tab Tables.
2.3) Add the following parameter: RETURN_ERROR LIKE BAPIRET2 as described below:
2.3.1) Add RETURN_ERROR under Parameter Name.
2.3.2) Add LIKE under Typing.
2.3.3) Add BAPIRET2 under Associated Type.