cancel
Showing results for 
Search instead for 
Did you mean: 

problem in fetching Binary Data from SAP to SUP

vivek_gaurav
Participant
0 Kudos

Hi All,

           I am facing problem in fetching Binary data from SAP to SUP(Sybase Unwired Platform 2.1.3) for getting Image . I had taken Big Binary data Type in SUP side.

            But each time it is returning some anonymous four character value in SUP Preview and giving error on IOS side.

            Kindly suggest solution ....

Thanks

Vivek

Accepted Solutions (0)

Answers (3)

Answers (3)

brenton_ocallaghan
Active Participant
0 Kudos

Hi Vivek,

Can you give us a bit more information about your errors, you mentioned an error on the iOS side - what was that error and can you provide a screen shot.

Also can you show us a screen shot of your MBO to ensure that the correct dataTypes are being set on your attribute.

Thanks,

Brenton.

vivek_gaurav
Participant
0 Kudos

Hi,

    Thanks for your reply

    I had created the MBO for saving image from iOS to SAP via SUP. I had created the operation and save image as a operation type OTHERS. I given generated code to iOS developer. But, they are not getting that method called "SaveImage".

Class File:  DisSAPImagePutImageSaveImageOperation

Kindly suggest which method/operation type we should follow to achieve for two way communication.

Thanks,

- Vivek

brenton_ocallaghan
Active Participant
0 Kudos

Hi Vivek,

If you are creating a new image on SAP through the MBO then I would expect your operation to be of the type CREATE when you are defining it in the SMP SDK.

Your operation parameters should for the most part be "fillFromAttribute" populated unless you require information that is not to be stored as part of the MBO.

Finally, if your iOS developer cannot see the operation you have created are you sure that the generated code outputted correctly? You can check this by opening the generated code header file for your MBO and you should be able to see a method defined there for your custom function.

For example, if your project is called "Apples", your MBO called "Oranges" and your custom operation called "banana" then you should look for the file "ApplesOranges.h" and then search to ensure the method "bananas" exists in that file.

Hope that helps,

Brenton.

vivek_gaurav
Participant
0 Kudos

Thanks for your reply

I had filled "FILL FROM ATTRIBUTE"

I have two input parameter 1.IV_FILENAME,2. IV_STRING and one output parameter as EV_FLAG

but in "PARAMETER" Tab "FILL FROM ATTRIBUTE" list I am getting output parameter EV_FLAG to link becs only EV_FLAG is came as attribute.

what should be done to get other two also as Attribute.

Thanks

Vivek

brenton_ocallaghan
Active Participant
0 Kudos

You would need parameters of your MBO that match the same datatype as your two importing parameters that you mentioned above. So I would have a parameter called fileName and a second called myString (although I would add a more meaningful name) and the data types should match your importing parameters.

Once that is done then you should be able to map them in the fillFromAttribute section.

Cheers,

Brenton.

vivek_gaurav
Participant
0 Kudos

Thanks for reply

shall I need to create those two parameter in SUP itself or i will create two same name input parameter in SAP RFC?

Kindly suggest.

Thanks

Vivek

vivek_gaurav
Participant
0 Kudos

Thanks for quick reply

I had created two dummy input parameter with same DataType and mapped via "FILL FROM ATRRIBUTE".

But When I am generating code,I am getting method without input parameter.

given below

 

- (void)SaveImage

{

self.isDirty = YES;

[self create];

}

Please suggest...

Thanks,

Vivek

brenton_ocallaghan
Active Participant
0 Kudos

Hi Vivek,


That would be correct - SUP will default in the correct values now, hence no importing parameters. As long as you have set the attribute on the MBO before you save it and as you say you have setup the "fill from attribute" then it will be passed to the back end function.

Cheers,

Brenton.

vivek_gaurav
Participant
0 Kudos

Hi Brenton,

                 Thanks for quick reply

IOS developer are calling "SAVEIMAGE" method.

since there are no input parameter in "SAVEIMAGE" Method. IOS Dev is using

 

- (void)setEV_STRING:(NSString*)newEV_STRING

DisSAPImagePutImageList *list = [DisSAPImagePutImage findAll];

for (DisSAPImagePutImage *obj in list) { NSData *img_data = UIImageJPEGRepresentation([UIImage imageNamed:@"GOOGLE2.jpeg"], 1.0);

NSString *img_string = [Base64 encodeBase64WithData:img_data];

NSLog(@"--%@", img_string);

[obj setEV_FILENAME:@"GOOGLE2.jpeg"]; [obj setEV_STRING:img_string]; [obj SaveImage]; NSLog(@"FLAG: %@", [obj EV_FLAG]);

}

but in SAP end ,i am not getting any value in those two input parameter inside RFC.

please advise me.

Thanks

Vivek

brenton_ocallaghan
Active Participant
0 Kudos

Aha ok now this is making more sense.

So when using RBS (please confirm that you are?) and trying to send binary data there is a sequence you need to follow when storing the raw data.

What is the type of the binary data (or rather the type of EV_STRING)? is it SUPBigBinary? If it is not it probably should be considering Strings are limited in length and cannot hold much (that would be type XString on the back end for the binary data).

I'd imagine it is so I would start by looking at this thread in which I have answered a similar question. Its really weird but you place the data in the attribute of the MBO AFTER the save or custom function all and BEFORE you call submitPending.

That should populate your data to the back end.

Cheers,

Brenton.

vivek_gaurav
Participant
0 Kudos

Hi Brenton,

Thanks for reply

I had created two dummy attribute EV_STRING and EV_NAME in SUP

and mapped in "FILL FROM ATTRIBUTE"

IV_STRING <-> EV_STRING

IV_FILENAME <-> EV_FILENAME

IOS Dev are sending value in EV_STRING and EV_FILENAME and coded same as you written but I am not getting Value in SAP in mapped parameter IV_STRING and IV_FILENAME at RFC debuge time.

is it any process to Check those value in SUP for EV_STRING and EV_FILENAME,to ensure data is coming from IOS to SUP. Is it SUP store these data some where.

Kindly advise why data is not coming in SAP input variable.

Thanks,

Vivek

brenton_ocallaghan
Active Participant
0 Kudos

Hi Vivek,

You could try setting the log level of the SUP server to Trace (ONLY do this for a very short period of time otherwise you will be looking at logs for the rest of your life and your server will grind to a slow halt).

This can be done in the SCC under your server node in the area called Logs and in the section settings. I would set the DataServices and Mobilink services to TRACE. This will literally print out everything that is being sent to the server so you can see if the data is even getting that far.

Cheers,

Brenton.

vivek_gaurav
Participant
0 Kudos

Thanks For Reply

I had mapped the IV_FILENAME with atteribute EV_FILENAME in parameter tab.

but when I m looking on Operation->DataSource->BindDataSource,

In Operation parameter step FIL FROM ATTRIBUTE is not showing. Also when i am mapping Argument with FILL FROM ATTRIBUTE ,and again if i open it,it becomes unmapped means not showing anything in FILL FROM ATTRIBUTE column. and also I am getting below warning message.

*No argument is mapped to client parameter 'PutImage->SaveImage()->IV_FILENAME'.

*Attribute 'PutImage->EV_FILENAME' has no mapped data source field and no propagated load argument.

kindly advise me ,why it is not mapping with attribute i had created in SUP called EV_STRING in Bind Data Source.

Thanks,

Vivek

vivek_gaurav
Participant
0 Kudos

Thanks For Reply

I had mapped the IV_FILENAME with atteribute EV_FILENAME in parameter tab.

but when I m looking on Operation->DataSource->BindDataSource,

In Operation parameter step FIL FROM ATTRIBUTE is not showing. Also when i am mapping Argument with FILL FROM ATTRIBUTE ,and again if i open it,it becomes unmapped means not showing anything in FILL FROM ATTRIBUTE column. and also I am getting below warning message.

*No argument is mapped to client parameter 'PutImage->SaveImage()->IV_FILENAME'.

*Attribute 'PutImage->EV_FILENAME' has no mapped data source field and no propagated load argument.

kindly advise me ,why it is not mapping with attribute i had created in SUP called EV_STRING in Bind Data Source.

Thanks,

Vivek

midhun_vp
Active Contributor
0 Kudos

Is the output field that carries the data have the datatype "XSTRING" in the RFC/FM?

1.Check the workflowclient log in the SUP server. If the binary data is reaching the unwired server you can see the data in the logs.

vivek_gaurav
Participant
0 Kudos

Hi Midhun,

                  Thanks for your quick reply.

                  in RFC ,i tried by Xstring and also by converting it into Binary.in both cases it is showing anonymous value

                Also in SCC ,log ,i am getting error saying anonymous value.

Thanks

Vivek

midhun_vp
Active Contributor
0 Kudos

The easiest way to figure out the issue is to look into the logs in the SUP server.

D:\Sybase\UnwiredPlatform\Servers\UnwiredServer\logs\WorkflowClient

Inside the folder WorkflowClient you can find a file with a name similar to ...__OBMO_WorkflowClient_user...... Where the user is the one you are registered in the SCC.

Do a preview of the MBO and check the logs.

In my case the field that contains the attachment is Expense_Attachment_LS_OUTPUTX_attribKey.

You can see the output from my logs.

In it the Expense_Attachment_LS_OUTPUTX_attribKey key have the string equivalen to the attachment. It will be very big string containing 100's of line (depending on image size).

<M><H></H><S>Expense_Details</S><A>_S75fAELZEeKGztQmKHFOAA</A><VS><V k="Expense_List_TRIPNO_attribKey" t="T">0000000074</V><V k="_old.Expense_List.TRIPNO" t="T">0000000074</V><V k="Expense_List_EMPNO_attribKey" t="T">00999101</V><V k="_old.Expense_List.EMPNO" t="T">00999101</V><V k="_surrogateKey" t="T">420038</V><V k="Expense_Attachment_FILESIZE_attribKey" t="N">463082</V><V k="Expense_Attachment_FILENAME_attribKey" t="T">certified_mail_receipt.png</V><V k="Expense_Attachment_MIMETYPE_attribKey" t="T">image/png</V><V k="Expense_Attachment_PERNR_attribKey" t="T">00999101</V><V k="Expense_Attachment_LS_OUTPUTX_attribKey" t="T">iVBORw0KGgoAAAANSUhEUgAAAhAAAAHdCAIAAADD/NcpAAAC8WlDQ1BJQ0MgUHJvZmlsZQAAeAGFVE1oE0EY/RJbUrDopWoPKkMPRbQtiwVvFZo0LbUlhqSttSiymd00abe7y+wmavGkghfBHzx4tRYvKqIHrTcVQVA0h1q9FFEUBEUoFHqpJb7ZpNmk/k3Y3bffvO9775vJLFH9oGrbRpAROdwUib4wGz06xkLzFKIAeUPljt0djw/KF8ktRavvK+9K3Pl2Od/1NDRz+1H03tePx/etTnQdqGb+AW8WECQKNGCuabyEd0qcKmFF4pOu7YLTIzHPqBrwKHCbGEpEgM8DbxmvwqkqrOkOJ6pbBMfitkCduuvA3ZrDp5B7jWhTUPaMGIY7QHRwF2Kv/NiYQ3TnFtGOVj+2p5lo2xGiuU4/

Check whether you are able to get it.

If you are getting that there are binary to image converters in the internet. Provide the string from logs as an input in the converter and check whether you can see the image that you are passing from SAP.

vivek_gaurav
Participant
0 Kudos

Hi Mithun,

              I am not able to find any log respective to my project or user.there are logs for other project and user.I tried to convert xtring data to image inside the SAP,it is giving back image in  SAP.

one question more that is it mandatory to send image data in binary or after converting Xstring to string ,i can send data to IOS developer.

one more thing that when i sent Image data in string format,IOS developer are asking header information of image is missing.They need header information of image to convert data into image.

Thanks

Vivek

midhun_vp
Active Contributor
0 Kudos

I am using base64 string. Ie the output of the RFC is in the base64 format.

Please try it by using the same.

when you perform the query from the device you can get the base64 string right?

Use the below link for converting it to image of vise versa.

http://webcodertools.com/imagetobase64converter/Create

vivek_gaurav
Participant
0 Kudos

Hi Midhun,

                 Sorry for late reply and thanks for your advise.

I am using method

1. cl_mime_repository_api=>if_mr_api~get_api( )

    which takes image file from MIME and returns XSTRING Value

2.Then I am directly assigning XSTRING to STRING variable

3.Using below method i am converting STRING to BASE64

  cl_http_utility=>ENCODE_BASE64

In this way ,I am geting BASE64 string

I am providing base64 string but IOS dev are telling string is not correct.

Kindly suggest ,I am on right track or not.

I will get exactly same base64 string by this link

http://webcodertools.com/imagetobase64converter/Create

or it will differ what i am getting from

Thanks

vivek

midhun_vp
Active Contributor
0 Kudos

Yes the base64 string you are getting in the output of the RFC will be same as the one you are getting from the converter in the website.

But you can't see the complete string in the RFC xstring in GUI right? It can show only 256 char i guess.

Take a very small image and try. Also in the Ios code tell them to debug the code and get the string that you are passing and check it with the one you are getting in the website.

Contact me at midhunvp@gmail.com.

Also see the answer in the below link.

http://scn.sap.com/message/13836423#13836423

vivek_gaurav
Participant
0 Kudos

Thanks Midhun,

                       I tried with base64 with diffrent FM and we able to send image successfully to IOS From SAP MIME.

thanks once again

Thanks

Vivek

midhun_vp
Active Contributor
0 Kudos

So is your problem solved?

vivek_gaurav
Participant
0 Kudos

yes,I am able to send image file upto 5 MB.

Thanks for your help.

Now,i stucked in reverse process.

I am trying to get image from IOS to SAP via SUP using operation in Same MBO.

for that i had created seperate RFC.

but when IOS dev sending data, I am not getting any data from IOS but when i am doing test execute in SUP the image is creating in SAP.

is it something extra we need to do for operation in MBO.

Thanks

Vivek

brenton_ocallaghan
Active Participant
0 Kudos

Hi Vivek,

How is the data being added to the MBO? I have answered a similar question at the end of this thread showing how you transfer binary data.

Are you getting any error messages at the moment etc?

Cheers,

Brenton.

rakshit_doshi
Active Contributor
0 Kudos

Hi,

Can you show the screenshot of the preview when you take on MBO,

Since its a big binary it shows some rectangular boxes when you preview.

On the IOS side the code that I used to read the data was something of this sort

SUPQuery *query=[SUPQuery getInstance];

[query select:@"x.imageFile"];

[query from:@"MBONAME" :@"x"];

SUPQueryResultSet *qrs = [__________DB executeQuery:query];

if(qrs!=nil)

{

for (SUPDataValueList *result in qrs)

{

NSData *dat = [SUPDataValue getNullableBinary:[result item:0]];

[imageArray addObject:dat];

}

}

Read the value from image array and assign it to imageview.

Hope this helps,

Thanks,