Avalados por :

Problema con GET_ENTITYSET y CREATE_ENTITY: Solución al error de espera de elemento '{http://www.w3.org/2005/Atom}entry'

  • Creado 01/03/2024
  • Modificado 01/03/2024
  • 4 Vistas
0
Cargando...

Hola,

Veo que algunos de los mensajes están hablando sobre el mismo problema, pero he revisado la solución que discutieron y en realidad no me ayudó. He implementado GET_ENTITYSET para obtener mis campos y lo he utilizado como una solicitud para mi operación POST en el mismo EntitySet para probar mi lógica CREATE_ENTITY. Pero durante la solicitud, me encuentro con el problema de que el sistema espera el elemento '{http://www.w3.org/2005/Atom}entry'.

Aquí está mi solicitud XML pegada

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"

xml:base="******/">

<id>************</id>
<title type="text">TagPrintSet</title>
TagPrintSet" rel="self" title="TagPrintSet"/>
<entry>
<id>http://*******(Tanum='0000123455',Lgnum='811',Ldest='11M1',Zdetag='001')</id>
<title type="text">TagPrintSet(Tanum='0000123455',Lgnum='811',Ldest='11M1',Zdetag='001')</title>
<updated>2019-01-29T04:54:18Z</updated>
<category term="ZMWM_PICKLIST_SRV.TagPrint" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="TagPrintSet(Tanum='0000123455',Lgnum='811',Ldest='11M1',Zdetag='001')" rel="self" title="TagPrint"/>
<content type="application/xml">
<m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:Tanum>0000123455</d:Tanum>
<d:Lgnum>811</d:Lgnum>
<d:Ldest>11M1</d:Ldest>
<d:Zdetag>001</d:Zdetag>
</m:properties>
</content>
</entry>
</feed>

Gracias,

Karthik

Pedro Pascal
Se unió el 07/03/2018
Pinterest
Telegram
Linkedin
Whatsapp

4 Respuestas

0
Cargando...

El método CREATE_ENTITY solo crea un único elemento en el conjunto de entidades.

Por lo tanto, debes implementar el método GET_ENTITY para recuperar un único elemento y utilizarlo como entrada para tu solicitud POST.

Si una o más respuestas han respondido tu pregunta, por favor haz clic en "✓ Aceptar"

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

¿Puedo hacer una pregunta más? Si tengo una tabla interna (solo una tabla interna sin otros campos) como entrada a mi módulo de funciones, ¿es necesario utilizar DEEP_ENTITY_SET? Veo en el blog que todos los ejemplos de DEEP_ENTITY_SET hablan de asociación de encabezado/ítem. Pero aquí no tengo ningún encabezado/línea de ítem.

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

¡Increíble! Funciona. Gracias Fischer.

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hi Karthik,

This is because though you specified a filter that presumably contains all four key fields of your entity, you still perform a GET request on the resource /sap/opu/odata/SAP/ZMWM_SAMPLE/TagPrintSet.

As a result, the GET_ENTITYSET is called, and if being implemented, you would be able to retrieve the filter and search for the items for which the filter applies.

In order to get a single item, you have to specify the key in brackets as follows:

/sap/opu/odata/SAP/ZMWM_SAMPLE/TagPrintSet(f1='11111',f2='811',f3='11M1',f4='1')

In this case, the GET_ENTITY method will be called.

I suggest that you implement both, the GET_ENTITYSET as well as the GET_ENTITY method.

Then you can perform a GET request on the Entity set, get back a list, and select a single entry from the payload.

        https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderLineItemSet(SalesOrderID='0500000001',ItemPosition='0000000010')
    

Will deliver the following Response (a single entry)

While

        https://sapes5.sapdevcenter.com/sap/opu/odata/iwbep/GWSAMPLE_BASIC/SalesOrderLineItemSet?$filter=SalesOrderID%20eq%20'0500000001'%20and%20ItemPosition%20eq%20'0000000010'
    

Returns a list with just one entry, but a list (a feed in ATOM terms).

For more details on how to implement GET_ENTITY and GET_ENTITYSET, see my following blog:

https://blogs.sap.com/2016/05/31/odata-service-development-with-sap-gateway-code-based-service-devel...

Regards,

Andre

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019

contacto@primeinstitute.com

(+51) 1641 9379
(+57) 1489 6964

© 2024 Copyright. Todos los derechos reservados.

Desarrollado por Prime Institute

¡Hola! Soy Diana, asesora académica de Prime Institute, indícame en que curso estas interesado, saludos!
Hola ¿Puedo ayudarte?