cancel
Showing results for 
Search instead for 
Did you mean: 

Single row MBO and bind the result manually

karim_mohamed2
Participant
0 Kudos

Hello gurus

i'm now working on a project that allow the user to provide a parameter to the BAPI and the BAPI returns only one row of data and when i started to create the HWC i wasn't able to bind the returned value directly to the screen i had to create a listview control and bind the cells to the MBO and in the details page i can view the data in the controls

is there is a way that i can skip the list view page and start the MBO from a menu or a button and bind the result to the controls manually

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Karim,

Please correct me if i am wrong.

You want to see "Detailed screen" (not LISTVIEW) as soon as you click on SUBMIT button/some menuitem. Right?

  1. Add a "custom Action" to the same screen (first screen e.g. start screen- where you are passing input). Give some name like GetDetailsCustomAction. Set all its properties as you would have done for menu/button.
  2. While selecting Default success Screen- make it to that DETAILED SCREEN(desired screen)
  3. Generate Hybrid app (Dont assign to any user)
  4. Go to custom.js, look for menuItemCallBackStartGetDetailsCustomAction();

          Where: Start : screen key where you have added a custom action

                    GetDetailsCustomAction: custom action name

          This custom Action acts a  menu item only but the difference is it wont crate any visible menuitems/buttons on the screen.

5. Look for customAfterNavigationForward menu in custom.js file

Add this code


hwc.customAfterNavigateForward = function(screenKey, destScreenKey) {

if (destScreenKey === "Start") {

menuItemCallbackStartGetDetailsCustomAction ();

return true;

} };

Rgrds,

Jitendra

karim_mohamed2
Participant
0 Kudos

Thank you jitendra kansal for your reply

but i found this method menuItemCallBackStartGetDetailsCustomAction(); in the workflow.js not in the custom.js is it ok or there must be this function in custom.js by the way i'm using version 2.2

and i had to place the custom action not in the start page because while it is in the start page it jumps straight to the details page i had to place it in the master page that contains the listview

but now another problem appeared in the details page i didnt get any data in this page i dont know is what i did wrong

thanks in advance

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

could be workflow.js (not sure, have to look once again )

I mentioned this example for understanding purpose. Depending on your requirement, you can set accordingly.

If you are not getting any data, make sure all the settings/mappings done properly, Please share what all you have done.maybe screenshots.

karim_mohamed2
Participant
0 Kudos

Ok

i created MBO based on BAPI that accepts the username and password then authenticate the user and returns the PERNR from HCM i created attributes manually and propagate them

then i created the HWC and added a button that will perform that action and navigate the user to the second page

and that is the complete workflow

and that is the details page

and below the two pieces of code.

thanks in advance

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos
  1. From MBO snapshot, make sure data length for "username" & "password" should be unique.

        (You can see that warning says "Argument data length is larger than that of attribute" )

2. From 1st screen where you are passing credentials, after pressing button, it should go to UserLoginDetails screen correct? If yes, then why are you keeping custom action at UserLoginMBO screen? Since Event has to call from 1st screen only.

(You would have dragged and dropped MBO to create these 2 defaults screen. Right?) I don't see "customAction" settings specially "General". Please share.

karim_mohamed2
Participant
0 Kudos

Thank you very much jitendra kansal for your time and effort but i managed to solve it by this code

function customConditionalNavigation(currentScreenKey,actionName, defaultNextScreen, conditionName, workflowMessage) {

  if ((currentScreenKey === 'Start') && (actionName ==='btn_Login')) {

  if (conditionName === 'One_Row') {

  var values = workflowMessage.getValues();

  var m = workflowMessage.serializeToString();

  var expenseTracking = values.getData("User_Login_MBO");

  var etList = expenseTracking.getValue();

  var count = etList.length;

  if (count == 1) {

  var etRow1 = etList[0];

  workflowMessage.updateValues(etRow1);

  return true;

  }

  }

  else if (conditionName === 'Two_Rows') {

  return false; // ie do the normal navigation which is to go to the

  // listview screen

  }

  }

}

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Great

Please close this thread if your query has resolved.

Rgrds,

Jitendra

Answers (0)