SAP-samples / abap-platform-rap-opensap

Samples for the openSAP course "Building Apps with the ABAP RESTful Application Programming model (RAP)."
https://open.sap.com/courses/cp13
Apache License 2.0
431 stars 232 forks source link

Week 5, Unit 6: shortdump when leaving field with tab #30

Open AndreaBorgia-Abo opened 3 years ago

AndreaBorgia-Abo commented 3 years ago

A shortdump is created if I enter a partial agency code (say, 9) in the Agency field and then leave the field with tab key. Using the search help as shown in the exercise is fine, of course.

The text of the dump shows this as root cause: Unmanaged query API violation: Requested response not set via method IF_RAP_QUERY_RESPONSE~SET_TOTAL_NUMBER_OF_RECORDS

Debugging ZCL_CE_RAP_AGENCY_xxxx I see that filter_factory->create_by_range in get_agencies is throwing an exception, which means the request_count call later isn't performed and there we have the dump.

I have patched it with the following code, right before get_agencies:

IF io_request->is_total_numb_of_rec_requested(  ).  
  io_response->set_total_number_of_records( 0 ).  
ENDIF.

This way, a default value is provided and there is no dump when the range creation fails.