cancel
Showing results for 
Search instead for 
Did you mean: 

Populating Error screens?

dsiva1225
Explorer
0 Kudos

Hi,

We are working on sybase 2.1 version everything is well and fine with creation of MBO,

Here are the few queries

1) how to populate error screens when there is no data after calling bapi / RFC ?

2)How to design customized UI Elements like button optimization(e.g size of button or color) we are geting default buttons and all other UI elements how can we customize those elements?

Hoping an earlier Response.

Thanks in advance.

Siva Reddy D.

Accepted Solutions (0)

Answers (4)

Answers (4)

midhun_vp
Active Contributor
0 Kudos

If you want to handle only the empty list from the output RFC you can make use of the below:

- Midhun VP

dsiva1225
Explorer
0 Kudos

Hi,

Actually Our Scenario is after calling any RFC/BAPI if there is any data it should be display

else an error message should be populated 'No Data Found' . After clicking button bapi is triggering in the same button properties default error screen is assigned with it_return screen , screen is calling well and fine but no message is populating in return screen.Did i miss any thing ???i mean personalisation  key is done for all input keys what to do now...is there any other way to populate error screen other than result checker in java.

Thanks in advance

Siva Reddy Dadi Reddy.

midhun_vp
Active Contributor
0 Kudos

I am assuming that your requirement is on HWC based application.

HWC apps are based on Javascript, HTML and CSS. For customization you can write your own code inside the file custom.js.

Best examples are given below:

http://scn.sap.com/community/mobile/blog/2013/02/20/develop-hwc-app-with-customized-list

http://scn.sap.com/community/mobile/blog/2013/07/07/sybase-unwired-platform-smp-custom-attachment-ic...

How to populate error screens when there is no data after calling bapi / RFC ?

That you can handle it in the RFC itself. If the RFC returns empty value in the case of a wrong input ( example ) keep a return message in the RFC ( with 'E' in the message )instead of doing nothing. Hence the app will through it as an error message in the device else the app will consider the RFC call as a success.

- Midhun VP

dsiva1225
Explorer
0 Kudos

Hi Midhun,

To populate error screen we handled error message in RFC through bapireturn but still we are facing same problem unable to display error message in the output screen, while debugging messages are populating to table return but unable to display message in error screen.

Thanks in advance.

david_brandow
Contributor
0 Kudos

Are the error keys present in the returned data and not displayed in the UI, or are the keys not present in the data?

midhun_vp
Active Contributor
0 Kudos

Got it, from the RFC what you need to do is if the output list is empty you keep it as an error with 'E' in the ABAP code. Hence the call from the app will not get a success response and it will through the error message coming from the RFC. Now what is happening is that the RFC call is considered as a success in the device, if it was an error the error message will be handled by HWC app.

I hope the above solution will solve your problem.

In the worst case what you ca do it you can completely customize the listview screen. Hence you will get more control over UI. Please refer this, http://scn.sap.com/community/mobile/blog/2013/02/20/develop-hwc-app-with-customized-list

In the given example I am getting the count of count of items ( var numOfItems = items.length; ). You can put an if condition below this line of code to check whether the numOfItems.

If it is 0 you can show an alert.

Found something interesting for error handling, you can use it for future use :

Overriding the showErrorFromNative Function

The generated JavaScript allows you to override the behavior of the showErrorFromNative function using the customBeforeReportErrorFromNative(errorString)and customAfterReportErrorFromNative(errorString) methods.

This shows an example of how to override or customize the error message based on the returned numeric error codes through customBeforeReportErrorFromNative.

Example 1

function customBeforeReportErrorFromNative(errorString) { var errorCode = getURLParamFromNativeError("errCode", errorString); // 500 and above are network errors if ( errorCode >= 500 ) { // Could check lang global variable if so desired //if ( lang == ... ) { // Show your own custom error message based on errorCode showAlertDialog("Do you have a network connection?", "My custom error"); // return false to by pass default behavior return false; } } return true; } 

Identified error scenarios include:

  • Any network related errors during an online (synchronous) request contain an error code of 500 or greater (check for >= 500)
  • public static final int UNKNOWN_ERROR = 1; // "unknown error"
  • public static final int ATTACHMENT_NOT_DOWNLOADED = 100; //"Attachment has not been downloaded"
  • public static final int UNKNOWN_MIME_TYPE = 101; //"Unknown MIME type"
  • public static final int FILENAME_NO_EXTENSION = 102; //"File name without extension"
  • public static final int REQUIRED_PARAMETER_NOT_AVAILABLE = 103; //"Required parameter is not available"
  • public static final int UNSUPPORTED_ATTACHMENT_TYPE = 105; //attachment type is not supported
  • public static final int SSOCERT_EXCEPTION = 106; //SSO Certificate manager exception
  • public static final int FAIL_TO_SAVE_CREDENTIAL = 107; //Fail to save credential
  • public static final int FAIL_TO_SAVE_CERTIFICATE = 108; //Fail to save certificate
  • public static final int DEVICE_NOT_CONNECTED = 109; //Device is not connected

- Midhun VP

dsiva1225
Explorer
0 Kudos

Hi David,

Actually Our Scenario is after calling any RFC/BAPI if there is any data it should be display

else an error message should be populated 'No Data Found' . After clicking button bapi is triggering in the same button properties default error screen is assigned with it_return screen , screen is calling well and fine but no message is populating in return screen.Did i miss any thing ???i mean personalisation  key is done for all input keys what to do now...

Thanks in advance

Siva Reddy Dadi Reddy.

former_member186566
Active Participant
0 Kudos

hi,

To Return Error message:

You should write ResultChecker and bind it with MBO. SUP provide a class "SAPResultChecker" implement it, and we can extract the real data, if its valid one return it, if its invalid or empty return "CheckReturnMapEntry" with error message.

Note: You should have core java knowledge to write Result checker.

http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01333.0210/doc/html/aba1274973463054...

To customize UI

To customize the error screen you can follow the Midhun VP's post. or just you want to change the color, size and other properties, goto the jquery.mobile-xxx.css files edit with your customzied properties.

If you are using theme "A" edit only theme "A", leave the other theming properties.

Regards

Yokesvaran.K

david_brandow
Contributor
0 Kudos

I'm unclear from your wording exactly what is happening.

- Is an error occuring on the backend, or is it succeeding but returning no rows?

- Is it displaying the error screen or the success screen?

- If you want it to display 'No Data Found' in the error screen, have you configured the error screen to do that (by, for example, adding a Label control to that screen)?

- If you want it to display 'No Data Found' in the success screen when there are no rows, have you configured the 'On Empty List' property of the listview on the success screen?

- If you examine the message returned by the online request, does it contain the information/data/keys that you need in order to display the appropriate message to the user?

david_brandow
Contributor
0 Kudos

Native app or hybrid app?  If native, which platform?  If hybrid, are you using the designer or writing the app by hand?