cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass arguements to CREATE_STREAM?

former_member184739
Contributor
0 Kudos

Dear Experts,

I am now passing Files from browser to SAP Gateway via media resources. I am able to receive file content in the following argument.

     ls_doc-content = is_media_resource-value.

I am able to pass value only to this single parameter called "IV_SLUG".But I also want to pass parameters like File name, File type, File size to this method "/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_STREAM".


Can anyone help how to pass above values from frontend?


Regards

Prabaharan

Accepted Solutions (1)

Accepted Solutions (1)

former_member184739
Contributor
0 Kudos

Dear Experts,

Can anyone suggest on above question raised?

Regards

Prabaharan

former_member184867
Active Contributor
0 Kudos

You need to use the SLUG option to pass arguments..

You have to pass a header called 'slug' with the parameter in the request , you will receive it in the DPC

former_member184739
Contributor
0 Kudos

Atanu,

Thanks for your reply. I am aware of passing "SLUG" to DPC. But i am asking how to pass more than one paramter to DPC?

Regards

Prabaharan

former_member184867
Active Contributor
0 Kudos

I think There is no other option.

SLUG is a free text , you can pass all your parameters in the SLUG using some kind of separator.


In your use case what do you want to pass, which you think is not possible using SLUG ? 

former_member184739
Contributor
0 Kudos

Hi Atanu,

Thanks for your suggestion. I will implement it using only one param SLUG.

Regards

Prabaharan

AshwinDutt
Active Contributor
0 Kudos

Hello Prabaharan,

Keys should go in SLUG parameter only.

Send multiple inputs with a separator and extract those using SPLIT in DPC.

Regards,

Ashwin

former_member206574
Active Participant
0 Kudos

Hi Ashwin,


where can we extract  the Slug parameters? In DPC_EXT or in DPC class?

AshwinDutt
Active Contributor
0 Kudos

Hello Venu,

There is already an importing parameter with name IV_SLUG in the Create_Stream method.

Just Read the value inside IV_SLUG and use accordingly.

Regards,

Ashwin

former_member184867
Active Contributor
0 Kudos

As per the best practice in DPC_EXT you need to extract it.

former_member206574
Active Participant
0 Kudos

Thanks for the replies. and Former Member

Regards,

Venu

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Prabaharan,

I think the correct way to do this would be to post the extra properties to the entity, not the stream. If you need to have those properties stored as well, then the entity that the stream is related to can carry those properties. How would you be expecting to read them back? I'd expect them available by GET request, which is most easily done within an entity representation.

This is also much clearer and transparent for a service consumer; passing header values should be avoided unless they are required by the OData specification.

regards

Ron.

Former Member
0 Kudos

Hi Ron,

this would be nice approach, but how can I read the entity data during file upload, when I will get only stream and headers into create_stream during fileupload?

Thanks,

Peter

Former Member
0 Kudos

Hi Peter,

You won't get it that way - you are thinking in terms of one operation when you need two. You first post the entity to establish its existence on the backend. Within this entity you set any properties that you want it to have such as physical and logical IDs, "added by", etc.

Then you send the stream (as a PUT if I recall correctly) which, being part of the entity, will have the same key.

Cheers

Ron.