Skip to Content
0

Using deep entity for both GET and CREATE

Jan 18 at 10:05 AM

88

avatar image
Former Member

Just had a couple of days experience with Gateway service development, so apologies if this is a question that just goes against everything Gateway stands for ;)

Using manuals and blogs online, I've managed to create a service that will accept a deep entity (three simple fields and a table), convert that to the format the RFC function will accept and call the function. That works, awesome.

Now I would like to use the exact same deep entity to retrieve information from the backend system. So once again I redefine several methods in the DPC_EXT and MPC_EXT classes to get the deep entity populated. That works, but the result in the Gateway client only shows the simple fields. I assume this is because I cannot define the table in the entity properties, only the simple elements. Therefore the table doesn't get mapped and is lost in translation.

Of course there is Associations and the $expand option to combine Header and Item entities, but that seems like the long way around and will only work for GET_ENTITYSET. For CREATE, I haven't been able to find a solution, seems you can only create one record at a time. Can't imagine that's the way to go.

Am I on the right path here? Is it possible to re-use a deep entity for both GET and CREATE? Thanks in advance for the help!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member Jan 22 at 06:42 AM
0

Yes you can use the Deep Entity method for both Get and Create,if you want the output in Get in the same format as you were sending for Create. Add a flag variable.Set it to X when you have to do a Get operation and blank when you need it for Create functionality.

Here,you will have to use the concept of batch for fetching more than one record. Redefine the methods: /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN and /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_END with blank implementation.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for the reply! So in theory it is possible, although this still feels like hacking your way through the system, not using it like it was designed to be used. A flag to differentiate between GET and CREATE... but hey it's worth a shot and worst case I'll learn more about the inner workings of the gateway :)

0
Former Member

You may or may not use a flag,that depends on the scenario. By flag here,I mean a distinguishing factor that you'll require between the GET and POST call.

0
Ankit Maskara
Jan 30 at 06:01 PM
0

Hi Egbert,

The appraoch you are following is not recommended.

You can use the same model - Same Parent Entity with Child entity for both Deep Create and $expand fetch but the GW framework has provided separate methods(Sepratation of concerns principle) for both these HTTP operations. Please have a look into <>GET_EXPANDED_ENTITYSET/<>GET_ENTITYSET or <>GET_EXPANDED_ENTITY/<>GET_ENTITY depending on your $expand use case. For Deep create there is only one method - <>_CREATE_DEEP_ENTITY.

Share
10 |10000 characters needed characters left characters exceeded