cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot see or use create operation in my .h file. input parameter: BIGBINARY

Former Member
0 Kudos

Customer need to submit a picture file content from iPhone to SAP CRM.

They created a BAPI that has a XString input parameter.Input

parameters:

filename(string), file extention(string), objectid of

the

Complain(string

), and image content XString

When they generate the

MBO code they cannot use Database methods like create

or

update, they see only

findall and load

With BAPIs they only know one way is to call it: link the

load parameter

with synchronization parameter and assign needed synchronization params

in the code, the problem is I cannot create the

synchronization

parameter

as BIGBINARY , only BINARY with limit of 32KB

max

Basically the question can be summarize like this:

Why if I add a create() operation on MBO WhateverMBO, I cannot see it

in

WhateverMBO.h header file

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Fiston,

Its a little difficult to deal with BigBinary as an input to a MBO.

Creating a Synchronization Key of the type Binary and mapping it to the Argument of the MBO allows posting binary data having max size 32KB to the back end.

As a workaround you can try minimizing the resolution/size of the image below 32KB in the iOS Native Code, set the Synchronization Key and post it to the back end. It works.

If reducing the size is not feasible then you can try creating it as an operation on a MBO instead of a seperate MBO. In this case SUP streams the BigBinary data/image (no matter what the size is, also greater than 32KB) smoothly to the back end. This thing also works.

In your case regarding the missing .h header file, please check whether the Generate Code is happening properly. You can just delete the content below src folder under Generated Code node in your Workspace and regenerate. Check for problems in Error Logs as well.

Regards,

Dharmaraj

Former Member
0 Kudos

Hi Dharmaj thanks for the comment. Could you please check the below code and see if it will work:

I basically created MBO  addPicture out of BAPI, which has 4 parameters one of

it is

BIG BINARY,

Added FILE_NAME, FILE_EXT, FILE_CONTENT, OBJECTID attributes to MBO

  and mapped Load parameters to them. BIG BINARY FILE_CONTENT maps

to

IV_FILECONTENT load parameter, which is also BIG BINARY

I created a

create1() custom method that

  has same mapping MBO parameters - load

parameters

Cash policy for the method is Invalidate Cash

My plan

is:

FIaddPicture *newPicture = [[FIaddPicture alloc]

init];

newPicture.FILE_NAME=@"image01";

newPicture.FILE_EXT=@"jpeg";

newPicture.OBJECT_ID=self.ComplaintID;

NSData

camerafile;

[newPicture.FILE_CONTENT openForWrite :

camerafile.length];

[newPicture.FILE_CONTENT

write:camerafile];

[newPicture.FILE_CONTENT.flush];

[newPicture.FILE_CONTENT.close];

[newPicture

create1];  //create1 is a custom defined create() method

[newPicture

submitPending];

[FIFIDB synchronize:

@"FIaddPictureGroup"];

QUESTION: Will the code work if I call it

every time user submits a

picture?

How can I go without create()

method if I cannot use synchronization

parameter or maybe I can mix

FILE_NAME, FILE_EXT,  OBJECTID as

synchronization parameters mapped to load

parameters and FILE_CONTENT

parameter is assigned as MBO parameter and I can

every time call findAll() meth

od instead of create()?

midhun_vp
Active Contributor
0 Kudos

Create an MBO only with the create operation and generate the code. It should contain the class for create() method.

It is a workaround. But the actual solution for this is by writing the Objective C code in some way to manage it .Unfortunately I don't have that solution with me now.

Former Member
0 Kudos

Hi Fiston,

Let me make it simple and clear.

Solution 1: (As a MBO)

  1. Create a MBO out of the BAPI which you are using.
  2. It has 4 inputs (Load Arguments), so create 4 Synchronization Parameters and map them to the arguments.
  3. Make sure you map the BigBinary Argument to a Synchronization Parameter of the type Binary(15000).
  4. Now from the iOS native code you set values to all the Synchronization Parameters, save and synchronize.
  5. In case if your image has a size greater than the specified size above, try compressing it's size in your native code.

Solution 2: (As an operation)

  1. Create a simple BAPI/RFC which has one Import Parameter of any type and two Export Parameters - one of the type XSTRINGVAL and another one of the type INT(to be marked as primary key later in MBO).
  2. No need to write any code for this RFC/BAPI. If you want you can pass any value to the INT output.
  3. Create a MBO out of this simple RFC.
  4. Now, in this MBO you will have a Load Argument and twp Attributes (BigBinary/Int).
  5. Create a OPERATION on this MBO using your working/existing BAPI having 4 Inputs.
  6. Now, in the MBO for the BigBinary Field, in the Propagate To ... column, map it's value to the BigBinary Input Parameter of the Operation. And for the rest 3 you can have Client parameters.
  7. In your iOS native code, synchronize the MBO, get the values from the MBO (FindAll or FindBy...).
  8. Now set the Image Data as the value of the BigBinary output of the MBO.
  9. It will automatically get passed to the Input Parameter of the Operation at the run time.
  10. Set other 3 Client Parameters of the Operation as well, do a save, submitPending and Synchronize.
  11. Debug your back end RFC/BAPI to check if the image is getting posted or not.


Solution 3:

If you find any better solution please also let me know.

Regards,

Dharmaraj

 

Former Member
0 Kudos

Thanks Dhamaraj your answer. Let me try it and I will let you know how it goes.

Fiston