Skip to Content
0
Jul 25, 2014 at 08:47 AM

How to create a service with different input and output?

14 Views

Hi Experts,

I have created a service which has 2 entities.

DeliveryHeader

DeliveryItems

StatusOutput

Association has been defined for DeliveryHeader and DeliveryItems.

I am using deep insert option.

My input request message is:

{

"DN_No" : "123",

"ShipTo" : "CNZ",

"DeliveryItems" : [{

"DN_No": "123",

"Item_No": "1",

"Quantity": "10'

}]

}

I want my output to be different entity structure that is of StatusOutput.

{

"StatusOutput" : {

"Code": "100",

"Text" : "Successfully created DN"

}

}

But I am getting output same as input.

What I have to do to get the desired output? Please help!

In my create_deep_entity I have coded like this:

TYPES: BEGIN OF t_output.

TYPES: StatusOutput TYPE ycl_prj_create_dn_mpc_ext=>TS_STATUSOUTPUT,

END OF t_output.


x_output-StatusOutput-code = "100".

x_output-StatusOutput-text = "Successfully created DN".


copy_data_to_ref(

EXPORTING

is_data = x_output

CHANGING

cr_data = er_deep_entity ).

Thanks

Gopal