Can you please share the Payload, Navigation Property and the Deep Structure defined inside the method ?
Re: Error / Return Handling in Create Deep Entity Set
Re: Error / Return Handling in Create Deep Entity Set
Hi Ashwin,
The payload is
<?xml version="1.0" encoding="utf-8"?>
<entry 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">
<content type="application/xml">
<m:properties>
<d:ORDERID>%00000000001</d:ORDERID>
<d:ORDER_TYPE>ZRR1</d:ORDER_TYPE>
<d:PLANPLANT>1110</d:PLANPLANT>
<d:MN_WK_CTR>24/7</d:MN_WK_CTR>
<d:PMACTTYPE>R05</d:PMACTTYPE>
<d:PLANGROUP>003</d:PLANGROUP>
<d:FUNCT_LOC>000003/0001/001</d:FUNCT_LOC>
<d:SHORT_TEXT>First Test from Deep Entity</d:SHORT_TEXT>
<d:START_DATE>2016-08-04T00:00:00</d:START_DATE>
<d:FINISH_DATE>2016-08-05T00:00:00</d:FINISH_DATE>
</m:properties>
</content>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PMOrderOperationsSet" type="application/atom+xml;type=feed" title="ZPMORDERS1_SRV.PMOrderHeaderOperationsAssociation">
<m:inline>
<feed>
<entry>
<content type="application/xml">
<m:properties>
<d:ORDERID>%00000000001</d:ORDERID>
<d:ACTIVITY>0010</d:ACTIVITY>
<d:CONTROL_KEY>ZINT</d:CONTROL_KEY>
<d:WORK_CNTR>24/7</d:WORK_CNTR>
<d:PLANT>1110</d:PLANT>
<d:DESCRIPTION>test1op</d:DESCRIPTION>
<d:QUANTITY>1.000</d:QUANTITY>
<d:BASE_UOM/>
<d:ACTTYPE>ZSERV</d:ACTTYPE>
</m:properties>
</content>
</entry>
<entry>
<content type="application/xml">
<m:properties>
<d:ORDERID>%00000000001</d:ORDERID>
<d:ACTIVITY>0020</d:ACTIVITY>
<d:CONTROL_KEY>ZEXT</d:CONTROL_KEY>
<d:WORK_CNTR>24/7</d:WORK_CNTR>
<d:PLANT>1110</d:PLANT>
<d:DESCRIPTION>oP2 EXT</d:DESCRIPTION>
<d:QUANTITY>2.000</d:QUANTITY>
<d:PRICE>0.00</d:PRICE>
<d:PURCH_ORG>1000</d:PURCH_ORG>
<d:PUR_GROUP>Z01</d:PUR_GROUP>
<d:ACTTYPE>ZSERV</d:ACTTYPE>
<d:VENDOR_NO>2000000410</d:VENDOR_NO>
<d:MATL_GROUP>46171604</d:MATL_GROUP>
</m:properties>
</content>
</entry>
</feed>
</m:inline>
</link>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PMOperationServicesSet" type="application/atom+xml;type=feed" title="ZPMORDERS1_SRV.PMOperationServicesAssociation">
<m:inline>
<feed>
<entry>
<content type="application/xml">
<m:properties>
<d:ORDERID>%00000000001</d:ORDERID>
<d:ACTIVITY>0010</d:ACTIVITY>
<d:OUTLINE>0000000001</d:OUTLINE>
<d:SRV_LINE>0000000010</d:SRV_LINE>
<d:SERVICE>L010001LC-Z0100900</d:SERVICE>
<d:SHORT_TEXT>ELECREP</d:SHORT_TEXT>
<d:SSC_SRV_TYPE>L01</d:SSC_SRV_TYPE>
<d:QUANTITY>4.000</d:QUANTITY>
<d:UOM>EA</d:UOM>
<d:OVF_UNLIM>X</d:OVF_UNLIM>
<d:GROSS_PRICE>10.00</d:GROSS_PRICE>
<d:CURRENCY>GBP</d:CURRENCY>
</m:properties>
</content>
</entry>
<entry>
<content type="application/xml">
<m:properties>
<d:ORDERID>%00000000001</d:ORDERID>
<d:ACTIVITY>0020</d:ACTIVITY>
<d:OUTLINE>0000000001</d:OUTLINE>
<d:SRV_LINE>0000000010</d:SRV_LINE>
<d:SERVICE>L010001LC-Z0100900</d:SERVICE>
<d:SHORT_TEXT>ELECREP</d:SHORT_TEXT>
<d:SSC_SRV_TYPE>L01</d:SSC_SRV_TYPE>
<d:QUANTITY>3.000</d:QUANTITY>
<d:UOM>EA</d:UOM>
<d:OVF_UNLIM>X</d:OVF_UNLIM>
<d:GROSS_PRICE>200.00</d:GROSS_PRICE>
<d:CURRENCY>GBP</d:CURRENCY>
</m:properties>
</content>
</entry>
</feed>
</m:inline>
</link>
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/PMOrderCreateNumbersSet" type="application/atom+xml;type=feed" title="ZPMORDERS1_SRV.PMOrderCreateNumberAssociation">
<feed>
<entry>
<content type="application/xml">
<m:properties>
</m:properties>
</content>
</entry>
</feed>
</link>
</entry>
Navigation Property
Deep Entity Structure
types:
begin of ts_deep_entity,
orderid type aufnr,
funct_loc type tplnr,
equipment type equnr,
short_text type auftext,
pmacttype type ila,
long_text_content type zde_ca_long_text,
pmorderoperationsset type standard table of ts_pmorderoperations with default key,
pmoperationservicesset type standard table of ts_pmoperationservices with default key,
pmordercreatenumbersset type ts_pmordercreatenumbers,
end of ts_deep_entity .
Re: Error / Return Handling in Create Deep Entity Set
Use the below JSON Payload which i have created ( please note that i have not added all the fields in the payload ). Use this and check.
Pass Content-Type as 'application/json' .
{
"ORDERID":"00000000001",
"ORDER_TYPE":"ZRR1",
"PMOrderOperationsSet":[{"ORDERID":"00000000001","ACTIVITY":"0010"},{"ORDERID":"00000000001","ACTIVITY":"0020"}],
"PMOperationServicesSet":[{"ORDERID":"00000000001","ACTIVITY":"0010"},{"ORDERID":"00000000001","ACTIVITY":"0020"}],
"PMOrderCreateNumbersSet":[{}]
}
Re: Error / Return Handling in Create Deep Entity Set
Hi Ashwin,
Can you please guide me with XML payload. I won't be able to use JSON Upload.
Regards,
Manu
Re: Connect gateway with non-SAP application
Hi Ozlem,
We too have a similar kind of requirement using a central hub deployment to consume external restful services. Could you please let me know how you people progressed for this requirement design?
Regards
Phani Poorna
Re: Error / Return Handling in Create Deep Entity Set
Hi,
First of all you don't need to create an extra entity to return error messages.
Use the code below to issue an error message in the CREATE_DEEP_ENTITY method.
(in method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY of your DPC_EXT class)
DATA: lo_exception TYPE REF TO /iwbep/cx_mgw_tech_exception.
" Create exception object
CREATE OBJECT lo_exception.
" Add messages to container & instantiate container
lo_exception->get_msg_container( )->add_messages_from_bapi( it_bapi_messages = lt_return ).
" Raise exception
RAISE EXCEPTION lo_exception.
After BAPI execution, read the return table and check if it is a success message, if so get the ID and fill this id into the empty ID field of your imported (deep) structure.
Then use the code below to simply return the same request body but with the new ID filled in.
(in method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY of your DPC_EXT class)
... Get the request body
io_data_provider->read_entry_data(
IMPORTING
es_data = ls_deep ).
... call bapi and add logic to determine if error or not.
... return the request as response in the same or altered way
copy_data_to_ref(
EXPORTING
is_data = ls_deep
CHANGING
cr_data = er_deep_entity ).
*Sample Code screenshot*
I hope this was helpfull.
Jonathan B.
Re: Error / Return Handling in Create Deep Entity Set
JSON Date Format
Hi,
We have a Gateway service with some date fields (ABAP datatype DATS converted to Edm.DateTime or Edm.DateTimeOffset).
When service is called with output format JSON, date values are represented in MicrosoftDateFormat format (e.g. "/Date(1448841600000)/").
In contrary, when output format is XML, dates are in ISO-8601 format: YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00).
Is there any way to change the JSON date format, either in field level or system level?
Re: JSON Date Format
Hello Shai,
Current formats which you are getting are the standard ones.
If at all you want to send back the Date value in some other format, then you will have to use Edm.String in GW level and send back the date value with the desired format from DPC.
Regards,
Ashwn
$Batch Operation, Chageset_process method missing
Dear Gurus,
I have developed a batch Odata in a client and using Cofiles and datafiles I have imported the developments into another client. Now the problem is when I activate the SEGW project it gives an error that the method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS does not exist. On further research I found SAP help document.
I assumed this has something to do with Gateway version it was SPS 08 and after my request the Basis consultant upgraded it to SPS 15. But still it says the method does not exist, I tried reimporting the cofiles and datafiles it does not help.
FYI, the architecture is kind of like a HUB, the gateway is on one client and the SEGW projects is on another. The basis has upgraded the Gateway client to sps15.
Can someone help me what to do now, because I can't change the Odata.
Here is the screenshot of the Gateway client status
Here is the screen shot of the client where (SEGW) projects are developed
Please advice.
Re: How to set header “Content-Type” and “slug" values for ZIP files during post command
Confugaration/steps needed when consuming external Restful service from Fiori front end server
Hi All,
I have deployed a custom UI5 app ( using external REST ful services--> service hosted in another Java stack system) in the front end server.
I used Ajax to call the service directly with the URL as shown below. This app has run successfully when i use "proxy" in local host(eclipse).
So i replaced proxy with target url while deploying in front end. (http ://xxx.xxx:port)
When running from front end server i got cross origin error as shown below.
After enabling CORS plugin in chrome i got unauthorised error as shown below.
I got the above errors initially while running from localhost.After that i used proxy and it got solved.
I just deployed the app in front end server and ran it directly. I haven't done any other configurations.
Do i need to do any extra configurations for consuming these external services or kindly suggest any other suggestions.
Important info:
*Able to call external service from localhost(eclipse--> used proxy here) but not able to call service from front end server.
*Front end architecture: Central hub deployment and connected to SRM,HR and CRM back ends currently.
Regards
Phani Poorna
XML Deep entity parsing problem
Hello, experts.
I have been trying to implement the deep insert operation by following this guide:
Step by Step development for CREATE_DEEP_ENTITY operation
I have created all the required entities in SEGW and all the methods in the REST webservice classes but i'm now stuck on a problem.
<?xml version='1.0' encoding='UTF-8'?><ns1:entry xmlns:ns1="http://www.w3.org/2005/Atom" xmlns:ns3="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:ns2="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <ns1:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/MasterToPartnerData"> <ns2:inline> <ns1:feed> <ns1:entry> <ns1:content type="application/xml"> <ns2:properties> <ns3:Adrnr>10000</ns3:Adrnr> <ns3:Kunnr>100</ns3:Kunnr> <ns3:Parvw>AG</ns3:Parvw> </ns2:properties> </ns1:content> </ns1:entry> </ns1:feed> </ns2:inline> </ns1:link> <ns1:content type="application/xml"> <ns2:properties><ns3:Kunnr>100</ns3:Kunnr> </ns2:properties> </ns1:content></ns1:entry>
This payload is correctly accepted by the framework, but when it reaches the method (CUSTOM_CREATE_ENTITY) it is parsed like this:
Can you please provide a solution or tips?
Thank you.
Re: Read excel data from frontend using SAP ODATA into Ztable
Thanks Ekansh for the reply.
Do you mean that there is not functionality in SAP UI5 to upload the excel and read the data from the front end.
Is there no other option to stick to excel itself and read the data to backend?
Regards
Ujwal
Re: Error 500 while exposing XSJS (consuming CDS)
At least the line with "result.close()" has to be removed, cause the result variable is not result set object which has to be closed.
If the importEntity method works depends on the structure of your CDS file. If "ar2" is the CDS file name and aka the name of the root context and "dev.gls" is the package than it is fine.
Because you are importing a CDS View you need to a define a key when you import the entity. This can be done like following:
var ProductOverview = xsds.$importEntity("dev.gls","ar2.ProductOverview", {
PRODUCT_ID: { $key: true }
});
Regards,
Florian
PS: By the way, this post should be moved to the SAP HANA Dev Center space, cause it is not really related to SAP Gateway.
How to pass input parameter in ODATA based on Bex Query
Hello Friends,
I have created a ODATA SERVICES based on easy Query.But whenI run the URL for metadata. It gives runtime error because it needs to pass Input parameter.
I dont know how to pass Input parameter in odata created based on Query. My Bex Query has 1 Input variable which needs to be passed at run time.
Please help to resolve this Issue.
Thanks,
Priyanka
Re: How to pass input parameter in ODATA based on Bex Query
Hi Priyanka,
For fetching the metadata you do not need any input parameter.
Service Document URL and Metadata Url should work properly if your service is created successfully.
What is the runtime error that you are getting while fetching metadata?
Thanks & Regards,
Mohan
Re: Multiple single values to a parameter in ODATA bex query
Hi Samyuktha,
Can you please guide how to pass Input parameter for ODATA created on Bex Query?
Re: Read excel data from frontend using SAP ODATA into Ztable
Hi Ujwal,
As much as I know, SAPUI5 doesn't have this functionality out of the box in its library. CSV is a valid option if you want to convert it server-side.
If you want to convert it on client-side, you can check this project GitHub - SheetJS/js-xlsx: XLSX / XLSM / XLSB / XLS / SpreadsheetML (Excel Spreadsheet) / ODS parser and writer .
I have not tested this so can't comment much on this. However reading a large excel file at client-side would not be recommended as it might cause serious memory issue specially on the mobile/tablet devices. You can check this thread for more info on using this library Read contents of Excel file into Sapui5 table | SCN
Regards,
Ekansh
Re: How to pass input parameter in ODATA based on Bex Query
Hi Mohan,
Yes,the service was created successfully.This query has one input variable.Not sure how to pass value for this.
At run time it says that you need to pass Input parameter for 'ZDATE1(this is the name of variable)'.
After metadata when I am running url for entity set.