cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a service with different input and output?

gopalkrishna_baliga
Participant
0 Kudos

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:

TYPESBEGIN 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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Gopal,


"What I have to do to get the desired output?"


Firstly, I think you are confusing Gateway with RFC, they are not the same thing. I suggest you learn OData before touching Gateway to avoid this confusion.


Asking that same question again, the answer is - nothing. You do not need anything like this "status output" in your model, just accept the HTTP response, which is doing what you want - telling you if it succeeded or failed.


Someone will probably point you at function imports, but that would be a wrong answer to the question


Regards


Ron.