Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_INSPOPER_RECORDRESULTS - How to Reset the Result?

Former Member
0 Kudos
3,023

Hi,

I use BAPI_INSPOPER_RECORDRESULTS to record results for inspection lots.

To do this I populate MEAN_VALUE and set CLOSED = 'X'. And this works fine.

Question: How do I reset the value (blank the value out)? In QE51N, if you blank out the value, it automatically resets the results and put the inspection characteristic back to open.

What fields do I need to fillout and pass to the BAPI to reset the result?

Or is there another BAPI to do this?

Thanks.

Giscard

PS

I am calling the BAPI from Web Dynpro Program

14 REPLIES 14
Read only

Former Member
0 Kudos
2,359

Hi,

I am also looking for the same. Please help us if you know the process.

Thanks & Regards,

BCD Prasad

Read only

0 Kudos
2,359

FM BAPI_INSPOPER_RECORDRESULTS as it is cannot reset results.  If you pass a blank value in the result (MEAN_VALUE), the BAPI ignores it and does not do anything.  To make this work I implemented an implicit enhancement at the end of FM QEEM_INT_FEATURE_RECORDING to force the BAPI to reset the result if the value passed to the BAPI is initial.  However, you have to put in logic so that it only does this if called from some specific application so that it does not conflict with all other standard program that's calling FM QEEM_INT_FEATURE_RECORDING (for us we had to do this I'm not sure if you also need this check as well).  Below is the code of the implicit enhancement I implemented.  Hope this helps.  Let me know if you have further questions.

Giscard

Enhancement to Reset Characteristic Result (implemented in
QEEM_INT_FEATURE_RECORDING)

  FIELD-SYMBOLS <fs_allow_reset>.

 
FIELD-SYMBOLS <fs_qamktab> TYPE QAMKR.


* Read G_ALLOW_RESULT_RESET variable from FGrp ZQ_RESULTSRECORDING to ensure that this Enhancement is only
* executed when the Results Recording Tool is being used.

 
ASSIGN ('(SAPLZQ_RESULTSRECORDING)G_ALLOW_RESULT_RESET') TO <fs_allow_reset>.

 
CHECK sy-subrc = 0.

 
CHECK <fs_allow_reset> = 'X'.



 
CHECK L_UPD_RC = 0.

 
CHECK PAGEBEGIN_QAMKTAB IS NOT INITIAL.



 
IF I_QAIMR-SATZART = 'Q71' AND

     I_QAIMR-RUECKMELNR
IS NOT INITIAL AND

     I_QAIMR-INPPROC_READY =
'X' AND

     I_QAIMR-MITTELWERT
IS INITIAL AND

     I_QAIMR-ANZWERTG =
'0'.



   
CLEAR QAMKR-MITTELWNI.

   
CLEAR QAMKR-MITTELWERT.

   
CLEAR QAMKR-ORIGINAL_INPUT.

   
CLEAR QAMKR-DBEWERTG.        "Valuation of the Characteristic for Dynamic Modification

   
CLEAR QAMKR-MBEWERTG.        "Inspection Result Valuation

   
CLEAR QAMKR-ISTSTPUMF.       "Number of Recorded Sample Units

   
CLEAR QAMKR-ANZWERTG.        "Number of Inspected Sample Units



   
READ TABLE QAMKTAB ASSIGNING <fs_qamktab>

     
INDEX PAGEBEGIN_QAMKTAB.   "Index used in subroutine AENDERN_QAMKTAB

   
IF sy-subrc = 0.

     
CLEAR <fs_qamktab>-MITTELWNI.

     
CLEAR <fs_qamktab>-MITTELWERT.

     
CLEAR <fs_qamktab>-ORIGINAL_INPUT.

     
CLEAR <fs_qamktab>-DBEWERTG.

     
CLEAR <fs_qamktab>-MBEWERTG.

     
CLEAR <fs_qamktab>-ISTSTPUMF.

     
CLEAR <fs_qamktab>-ANZWERTG.

   
ENDIF.



 
ENDIF.

Read only

0 Kudos
2,359

Hi Giscard,

Thanks for your help....

I tried to implement the same to reset the values but unsuccessful.

Actually i am calling the Bapi from Wed Dynpro application and i am getting dirty value as initial in FM QIBP_INSPCHAR_SETRESULT :


So, please guide me, what information need to pass in char_results and sample_results table for Qualitative or Quantitative MICs in Bapi  BAPI_INSPOPER_RECORDRESULTS to reset the result.


Thanks in Advance for your valuable help.

Read only

0 Kudos
2,359

Try to pass the value ! (exclamation mark) to CLOSED field like below:

CHAR_RESULT-CLOSED = '!'

Read only

0 Kudos
2,359

Hi Giscard,

Thank you for advise! That helped me to reset inspection char result!

Maybe it is possible to reset sample evaluation in some way?

Best Regards,

Vitaliy

Read only

0 Kudos
2,359

Hi Vitaliy,

Yes it is possible to reset sample evaluation to by doing implicit enhancement at the end of FM QEEM_INT_SAMPLE_RECORDING same as Giscard explained.

@Giscard: Thanks for your suggestions !!!! It helped me to reset the sample results.

Read only

0 Kudos
2,359

It's good to know that it worked for you guys.

But if you find another way to do it let me know as well 🙂

Giscard

Read only

0 Kudos
2,359

Hi Giscard,

Is it possible to reset sample evaluation by passing exclamintaion mark to

SAMPLE_RESULT-CLOSED of BAPI_INSPOPER_RECORDRESULTS?

In SE37 I see that this parameters can close inspection char and the whole sample. I tried to pass '!' to SAMPLE_RESULT-CLOSED, but it gave no result.

So is it possible to reset sample evaluation in this way? If so, what params should I pass to SAMPLE_RESULT table?

Thanks in advance!

Best  Regards,

Vitaliy

Read only

0 Kudos
2,359

Hi Vitaliy,

I only had to reset characteristic results which is why my implicit enchancement is only in FM QEEM_INT_FEATURE_RECORDING.  But in your case if you want to reset sample results you also have to implement the enhancement in  QEEM_INT_SAMPLE_RECORDING just like what Manish suggested.

I assume it would be a copy of the same implicit enhancement with the structure and variable names changed respectively.

Hope this helps.

Read only

0 Kudos
2,359

Hi Vitaliy,

i acheived this by doing the implict enhancement in FM QEEM_INT_SAMPLE_RECORDING. Actually i am resetting both result as well as attribute value, Below is the code of the implicit enhancement I implemented.  Hope this helps.

CHECK l_upd_rc = 0.



CHECK pagebegin_qasptab IS NOT INITIAL.



IF i_qaisr-inpproc_ready eq abap_true.



   READ TABLE qasptab ASSIGNING <fs_qasptab>

                    INDEX pagebegin_qasptab.   "Index used in subroutine AENDERN_QASPTAB

    IF sy-subrc = 0.



      IF i_qaisr-code1 IS NOT INITIAL and i_qaisr-gruppe1 IS NOT INITIAL and i_qaisr-original_input IS INITIAL.

         CLEAR qaspr-code1.

         CLEAR qaspr-gruppe1.

         CLEAR qaspr-dbewertg.        "Valuation of the Characteristic for Dynamic Modification

         CLEAR qaspr-mbewertg.        "Inspection Result Valuation

         CLEAR qaspr-iststpumf.       "Number of Recorded Sample Units

         CLEAR qaspr-anzwertg.        "Number of Inspected Sample Units

         CLEAR qaspr-mittelwni.



         CLEAR <fs_qasptab>-code1.

         CLEAR <fs_qasptab>-gruppe1.

         CLEAR <fs_qasptab>-dbewertg.

         CLEAR <fs_qasptab>-mbewertg.

         CLEAR <fs_qasptab>-iststpumf.

         CLEAR <fs_qasptab>-anzwertg.

         CLEAR <fs_qasptab>-mittelwni.

      ENDIF.



      IF i_qaisr-mittelwert IS INITIAL.

         CLEAR qaspr-mittelwert.

         CLEAR qaspr-original_input.

         CLEAR qaspr-dbewertg.        "Valuation of the Characteristic for Dynamic Modification

         CLEAR qaspr-mbewertg.        "Inspection Result Valuation

         CLEAR qaspr-iststpumf.       "Number of Recorded Sample Units

         CLEAR qaspr-anzwertg.        "Number of Inspected Sample Units

         CLEAR qaspr-mittelwni.



         CLEAR <fs_qasptab>-mittelwert.

         CLEAR <fs_qasptab>-original_input.

         CLEAR <fs_qasptab>-dbewertg.

         CLEAR <fs_qasptab>-mbewertg.

         CLEAR <fs_qasptab>-iststpumf.

         CLEAR <fs_qasptab>-anzwertg.

         CLEAR <fs_qasptab>-mittelwni.

      ENDIF.



      IF i_qaisr-attribut IS INITIAL.

        CLEAR qaspr-attribut.

        CLEAR <fs_qasptab>-attribut.

      ENDIF.

    ENDIF.



ENDIF.

Read only

0 Kudos
2,359

Hi Manish,

Thank you a lot for provided information. I am implementing all this stuff via SAP MII, so I am unable to make enhancements to BAPIs.

Anyway, thank you again and I hope this will help another one who will face same or alike issue.

Best regards,

Vitaliy

Read only

tobuck
Discoverer
0 Kudos
2,164

I know this thread is very old, but it's the only help I found while I struggled with a similar issue. After a lot of debugging and trial&error I found a different solution, that works fine for our usecase.

Using the table parameters "char_results" and "sample_results", I filled the following fields of each line with an exclamation mark '!':

  • code_grp1
  • code1
  • [... maybe other code...-fields if in use]
  • evaluated
  • closed

Field "evaluation" of each line is blank/initial. Should work for "single_results" too, but we aren't using these.

Afterwards, the inspection operation isn't locked anymore and the codes of the results are empty. All without any enhancements or modifications (at least that I know of). That's exactly what we tried to archive. Maybe it helps someone coming across this thread.

.

Read only

0 Kudos
1,437

Hi 

I have a similar requirement where I have to either fill mean_value (Quantattive) or code_grp1/code1 (Qualitative), but this code always give  error that change not possible in current status which is '5'(Closed).

You have a very nice blog but I always gets error,Please help with sample code you have written.

Here is the sample code I have used:

APPEND INITIAL LINE TO lt_char_val_stat ASSIGNING FIELD-SYMBOL(<fs_char_val_stat>).

<fs_char_val_stat> = VALUE #( insplot = <fs_inspection>-inspectionlot
inspoper = <fs_inspection>-inspectionoperation
inspchar = <fs_inspection>-mic
*code_grp1 =  '!' 
mean_value =  '!' 
*code1 =  '!' 
evaluation = space
closed = '!'
evaluated = '!' ).

CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS'
EXPORTING
insplot = <fs_inspection>-inspectionlot
inspoper = <fs_inspection>-inspectionoperation
IMPORTING
return = ls_messages
TABLES
char_results = lt_char_val_upd_stat
returntable = lt_messages.

Read only

Abhishek49
Explorer
0 Kudos
1,298

This issue is resolved with SAP Note.

3293588 - How-to update blank result with BAPI_INSPOPER_RECORDRESULTS?