cancel
Showing results for 
Search instead for 
Did you mean: 

How to set values to MBO fields

Former Member
0 Kudos

Hi all,

          I have a requirement, i want to set the values to the attributes of the MBO.

I have a MBO with 2 input fields. In the WF screen i have only one button.

When the user click on the button, MBO has to call by passing the values to MBO dynamically.

i wrote the logic for the  2 fiels in customBeforeMenuitemclick( ). In custom.js

Now i want to set these values to MBO fields(attributes). Is it possible?

Thanks in advance.....

suresh

Accepted Solutions (1)

Accepted Solutions (1)

DoanManhQuynh
Active Contributor
0 Kudos

Hi suresh.

I dont realy understand what you trying to do. If you create a HWC application then in mobile workflow form editor you can create an input field for your input by mapping personalization key with your input field. I think maybe you just want to pass value to Mbo's input parameter without input filed...so you could try to make a standard HWC and look how they can pass data to input field .

Former Member
0 Kudos

Hi Quynh Doan Manh,

                    Thanks for the help.

Actually i am passing image to SAP.

I don't want to display image in HWC, i want to pass image to MBO input parameter

i called

customGetPictureDataFromCamera() in customBeforeMenuItemClick(screen, menuItem) of custom.js

in customGetPictureDataSuccess(fileName, imageData ) i want to set this image to MBO input paramete. how can i set....

Former Member
0 Kudos

Hi Suresh,

     Can you explain your requirement, because it is little unclear. If you want to take image from your camera and pass it via MBO parameters also. First you need to have attribute fields with image data type. After that you can use these fields to parse image(image will b stored in BIGINT binary ) once u got that image in your attribute you can use this binary data where ever you want.

Regards

Srinivas

david_brandow
Contributor
0 Kudos

This sample demonstrates the use of the camera:

https://cw.sdn.sap.com/cw/docs/DOC-151007

Former Member
0 Kudos

Hi Srinivas,

               Thanks for the help,

My requirement is save the image in sap. I created a RFC FM with one input parameter of Xstring.

In MBO i created a operation "create"

and in the WF  i mapped, input MBO with key21

and i called

customGetPictureDataFromCamera() in customBeforeMenuItemClick(screen, menuItem) of custom.js

function customGetPictureDataSuccess(fileName, imageData ){

          var pictureDataValue = new MessageValue();

          pictureDataValue.setKey("key21");                                                  // Must be set by the user.

          pictureDataValue.setValue(imageData);

          pictureDataValue.setType(MessageValueType.TEXT);

          var mvc = getWorkflowMessage().getValues();

          if( mvc ) {

                    mvc.add( pictureDataValue.getKey(), pictureDataValue );

Is anything wrong i did?

and

called customGetPictureDataFromCamera() in customBeforeMenuItemClick(screen, menuItem) of custom.js

in customGetPictureDataSuccess(fileName, imageData )

Now  i want to map imageData to a variable. How it is possible?

Thanks in advance..

Suresh

Former Member
0 Kudos

Hi Srinivas,

               Is my question clear?

Former Member
0 Kudos

Hi Suresh,

To send data to MBO you need to e a personalization Key, then Map It to Load Parameters( Import parameter of RFC) and if the data comes from a screen field(textbox) Map the personalization key to that text field as well

Regards,

Pratheek

Former Member
0 Kudos

Hi Suresh,

     I have mimic your requirement with sqlanywhere DB, What I have done please find bellow steps.

1.Created a table in SqlAnywhere with image column.

2.Created MBO with create operation table as Backend.

2.Created Menu (Save Image with CREATE Operation and type "ONLINE REQUEST" , in Menu Properties, Parameter Mappings, Create New KEY(Eg: KY_image) for image attribute and Save) in Workflow screen.

3.when you click on button it will call Custom.js (customGetPictureDataFromCamera()) in CustomBeforeMenuClick() as you mentioned.

4. Once you capture image and save(use in ipad) it, customGetPictureDataSuccess() will be called.

5. In customGetPictureDataSuccess() ,  pictureDataValue.setKey("KY_image");                

Now You can able to save picture in your BackEnd connected to your MBO.

Regards

Srinivas

Former Member
0 Kudos

HI Srinivas,

          I did the same.

Please see my earlier replay "Jun 4, 2013 5:41 PM"

Save Image with CREATE Operation. what is mean?

Still anything required to do?

Thanks

Suresh

Former Member
0 Kudos

Hi Pratheek,

          I think u already did a project on saving the image in sap.

http://scn.sap.com/thread/3364039

Please share your knowledge.

1. I think in the method customGetPictureDataSuccess(fileName, imageData )

imageData is base64 encoded string

is it correct?


Else, How to convert imageData to BASE64 encoded string

2. In sap bapi , i am using SSFC_BASE64_DECODE fm to decode imageData and saving in table.

My WF application calling BAPI, But IM_IMAGE is empty while calling MBO even-though i wrote below code.

(Please see Jun 4, 2013 5:41 PM replay for IM_IMAGE)

function customGetPictureDataSuccess(fileName, imageData ){

          var pictureDataValue = new MessageValue();

          pictureDataValue.setKey("key21");                                                  // Must be set by the user.

          pictureDataValue.setValue(imageData);

          pictureDataValue.setType(MessageValueType.TEXT);

          var mvc = getWorkflowMessage().getValues();


Thanks in advance.......

Suresh

Former Member
0 Kudos

Hi Suresh,

        What you have done is correct only, only difference I found is in your code you are using "KEY21" how you created this key?, to save image , please follow bellow steps.

1. Create a "Menu" option type Online Request.

2. In properties, "Parameter Mappings" , Add "Key"(don't use already created key here).

3. Use same key in

pictureDataValue.setKey() in custom.js file.

Regards

Srinivas

Former Member
0 Kudos

Hi Srinivas,

               Thanks a lot, for your  help,

Now i can able to save the image in sap. But it is taking more than 1.30 minute time to save the image in sap table. How to minimize the time ?

thanks in advance.

suresh

Former Member
0 Kudos

Hi Suresh,

     That's  good to hear.. we are also facing same issue. but it depends on net speed. if you find some solution, keep posting..

Regards

Srinivas

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suresh,

     your question is not clear, if your speaking about dynamic user inputs for your workflow fields, Please create personalisation keys for your MBO input fields which user has to enter values dynamically and Map them in your workflow screen. No need for any coding in custom.js to input values dynamically.

Regards

Srinivas.