KEMBAR78
Steps To Implement A Deep Entity in An OData Service | PDF
0% found this document useful (0 votes)
690 views17 pages

Steps To Implement A Deep Entity in An OData Service

The document discusses the SAP Gateway Service Builder, detailing its functionalities for service implementation and maintenance. It includes code snippets for defining entity types, methods for handling sales orders, and the structure for HTTP requests and responses. The content appears to be technical in nature, aimed at developers working with SAP OData services.

Uploaded by

rbharathisap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
690 views17 pages

Steps To Implement A Deep Entity in An OData Service

The document discusses the SAP Gateway Service Builder, detailing its functionalities for service implementation and maintenance. It includes code snippets for defining entity types, methods for handling sales orders, and the structure for HTTP requests and responses. The content appears to be technical in nature, aimed at developers working with SAP OData services.

Uploaded by

rbharathisap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 17
TTR ZCAWT SO DPC ERT @ [TRL ECLAWTSO_MPC [TRE] ZC AVY T_ODATRDE_OLOPCEIT RG (TR2] 2° 1 O0A_DEO! x ea (you) @ ]}<81e@@ 5a oF SAP Gateway Service Builder Cesta) el SIlele fea >) (=) =) Be ee |) [ene bef leosonncs - Prepares eee B Name Key Edm T...Prec. Scale May... Unit Pr...Cree..Updl..Sort..Nul.. Fits Label Las Comp.... ABAP ... &.. Seman. 7 [Dalasi Yeh oy eims.0 0 10 DZ @ Om Ses. [a \eaN ~ Epentty Tose et ) Eims.0 0 4 vim Ow Se uae S= HEADER 0 a a8 wag > sins.0 04 Do MO Shs. [x] veers [a] 1p | vig cena 002 Wov ww Om. fe) \TWES| veo mennon | gat ems.0 0 2 Qo BO OM r] SAAT =e Birk) Eims.0 0 20 DM O|M Set. [x] > (Be tssocations ture eims.0 9 wo YY MO w sede. [F] > Bentny sets, » Bs accion Sate Service Implementation (Baunune arcacts + Deserce Mantenance SAP Gateway Service Builder DBA Hele) GS) CBS) i=) ey) Blasio) emt) e[e fens) ate eyyT_ovaTA_PE_OL B Name Key Edm T...Prec, Scale Mex... Unit Pr...Crez.Upcl. Sort..Mull. Flt, Label LabComp... ABAP .. A... Seman. Smolen Sa ea Sn a no oe ar = fees To pa Cerne ee eae | em 2 SE HEADER Naty = Eums.0 0 4 D2 BO) @ was [s) _ vamr =r [elim ed as 3 a eS oes — re tet + BENsvgation Prose ae rae fa ae a [aunuina artacts + [severe nantenance (ves) @ vl« ee Anion SAP Gateway Service Builder DG) tmkebel ole l= fele) aL Lsle eal) orn : a Mp DVT_gpaa bE aL Name Key Edn T...Prec, Scde Max. Unit Pr...Crea, Sort..Nul. Fit, Label Labi ABAP .. A... Semen, ares ee re =e ss a Sens boo eee SHS Pew. Q Bins.0 0 a0 OO 0/0 O Gate [e) _part= some fe Sens tooo SS et pacts ee eee ae sa ee pars cae Assocaten Sete 9 Bsonice tnpirrentaton » Brunt artacts Di serice Mantenarce iweu | =) «Eiee SAP Gateway Service Builder Fees) mel) orri (al 2xVT_ODATA DFO Name .Princid Enoty meat pa + Benwty Types HeaderToParmer |HEADER i — oo rea + Bsorace manterarce en #514) [a] 26 [5 2) = > senses) raoal Ena Ca DapandantEnuty Dependant. Label 2 cre N 3 BARTER ven | @ sje @G An of SAP Gateway Service Builder Be fee) (ee) De) SI) Navigation Peres <1 DVT obama OF 01 ss Name Reletonehip Kare BAP Fel Nare Label cece Pan reat PARNER Entity Types Items HeaderTertem CTEM = SHEDS » a pooertes MEI ee Co ef] ere + Barner yr » Sm PARTNER *Basacatere » Benny sets » Di association Sets setice implementation tuntme arts + aSenice Maintenance Lab del Provider Cas xe Name Bese Gass Name 2 Generate csses xe Name Bese Gass Name “Technica Het Nae etl Vetson| ‘Technica sotvce Nave serves Ween Lawrie ome oe | (oie es) (pss ser oni o1 DRE St (SeveeRecbton [piv ovata peo YoU f ml > Q ZELZYVTODATA DE OLMPCEXT » a-fdasg ZcL_ZzvVI_ODATA_DE_@1_MPC_EXT definition 2 public 3 inheriting from ZCL_ZY¥T_ODATA_DE_@1_HPC 4 create public . © public section. 7 8 TYPES: BEGIN OF it_so, 9 Vbeln TYPE VBELN_VA, 18 AUART type AUART, aa VKORG type VKORG, 2 VIWEG type VIHEG, 13 SPART type SPART, 4 BSTNK type BSTNK, 15 KUNHIR type KUNAG, 16 items TYPE TABLE OF TS_ITEMS with DEFAULT KEY, a7 PARTNER TYPE TABLE OF TS_PARTNER WITH DEFAULT KEY, 1g FHD OF it_so. 18 20 data: ty_it_so TYPE it_so. 21 22 protected section. 23 private section. 24 25 JFADCASS - > @ ZC_ZVTODADEM_DPC_ET > isclass ZCL_ZYVT_ODATA_DE_@1_DPC_EXT definition 2 public inheriting from ZCL_ZYVT_ODATA_DE_@1 DPC create public ~ 4 public section. METHODS /iubep/if_mgu_sppl_srv_runtine-creste deep entity REDEFINITION. b protected section MeTHODS headersat_get_antitysat REDEFINITION . METHODS itemsset_get_entityset REDEFINITION « private section. METHODS call_bapi 3 IMPORTING Lt_sales_order type 2CL_ZYVI_ODATA_DE 01 MPC_OX exporting Ly_vbeln type vbeln Lv_message type bapi_nsg. 26 ENDCLASS. 1D ZEL_2WT_ODATADE_OL_DPC_EXT 30°ELRES ZCL_ZYVT_ODATA_DE_@1_DPC_EXT IMPLEMENTATION. 33° METHOD /IMBEP/TF_MGA_APPL_SRY_RUNTIME~CREATE_DEEP_ENTITY. 35 data: Is_data type ZCL_2¥¥T_ODATA_DE_@1_MPC_EXT=>it so, 36 1s_ybeln type vbeln_va. data: Emessage type bapi_nsg. jo_date_provider->resd_entry_date( IMPORTING es_data = 1s_data call METHOD call_bapi 46 EXPORTING a7 Lt_sales_order = 1s_data IMPORTING “9 Ly_vbeln Is_ybeln Lvlmessage = Enessage if ls_vbeln is initial. RAISE EXCEPTION TYPE /inbep/ex_mgu_busi_exception 35 EXPORTING 6 textid = /iubep/cx_mgy_busi_exceptior message = ‘Sales Order Not Created". business error 9 ZCLAWT_ODATADEGIDPCEXT » © HEADERSET.SETENTITYSET > TaxtLa = /LAvep/cx_MgW_bus1_excaption=20usiness_error message = ‘Seles Order flot Created’ ELSE. 1s_data-vbeln = Ls_vbeln. copy_data_to_ref( EXPORTING is_date = 1s_date CHANGING crdata = er_deep_entity ENDIF. ENDMETHOD. METHOD coll_bapi- DATA: LvybLn TYPE vbeLn_va. He «DATA: 1t_order_header TYPE bapisdhdi, " Sales Order Header Table : Is_erder_header TYPE bapisdhdt, " work are. Itlerder items TYPE TABLE OF bapisditm, "Sales Ordan Items 23 Is_order_items TYPE bapisditm, ‘able » © ZCLZWT_ODATA DE_D1_DPC_EXT » > HEADERSET GET ENTITVSET Leorder items |Pe IAULE Ur bapisditm, ~ Sales Urc=* able Is_order_itens TYPE bapisditn, Le partner TYPE TABLE OF bapiparnr, Is_partner TrPE bapiparnn, Le peturn TYPE TABLE OF bapiret2, " SAPI return messag. Is_peturn TYPE bapiret2. CLEAR 1s_order_headen. LT_order_headerdec_type = Lt_sales_order-auart. L1_orden_header-sales_org = 1t_sales_ordar-vkorg. LTlordersheader-distrochan = 1¢ sales_erdar-vtnes. It_order_header-division = 1t_sales_order-spart. LT order “header-req_date h = Sy-datin. CLEAR Ls_order_itens. LooP AT 1t sales order-items INTO DATA(Ls data). Ls ordan Steme-itm number = 1s data-posnr iol = Ls Ts_ordar_itens-targat_qty CONW dzmeng( 1s_data-kwmang )- APPEND Is_ordar_items TO Lt_order items CLEAR 1s_order_itens. ENDLoGP. LOOP AT 1t_seles_orden-partnen INTO DATA(Ls_pandata). » OZCLZWTODATADEOLOPC EXT » @ CALL BAP! 2 LOOP AT 1t_sales_ordan-partner INTO DATA(Ls_pardata). Ls_partner-partn_nunb = 1s_pardata-part_num. Ls_partner-partn_role = 1s_pardata-part_roll- Ls_partner-name = 1s_pardata-part_nama. Ls_partner-country — 1s _pardate-country. APPEND 1s_partner TO 1t_pantner. CLEAR Is_partner. ENDLOGP . TRY. CALL FUNCTION *BAPI_SALESORDER_CREATEFROMDAT2* EXPORTING SALESDOCUMENTIN = Ly_vbL order_header_in = 1t_order_header ORDER_HEADER_INK = SEND - JARY_RELATIONSH x INT _MUMUER_855 EGRHEN - * BEHAVE_WHEN_ERROR - * Logic Sarre = * TESTRUN, ONE! IMPORTING 3a sslesdocument = Ly_vbln 35 TABLES, 036 return Lt_peturn (© 2CL_2AVT_ODATADEOL_DPC_ET > & CALLBAPI » try INT_NUMBER_ASSTGHMENT EEHAVE_WHEN_ERRO - TESTRUN - CONVERT - IMPORTING selesdocument = 1y_vbln TABLES, return = ltreturn erder_items in = lt order items (ORDER _LTEMS_INK order partners = lt_partner " BAPIPARNR READ TALE Lt_return INTO Le_return WITH KEY type: IF sy-subre = 9. Ly_message = 1s_return message. ROLLBACK WORK. ELSE. Ly_vbeln = Ly_ybLa. COMMIT WORK. ENDIF. ERIE ox root. eT. vor", "0 123", raooo01", foo neeeeng"s "00" "i vbaeGieme"! "Tovesn" > 1 sap cutaway clent Esk Gok Metalsta Spste Hop 9 <8eee HA ies SAP Gateway Client eecue Ssekct [Beerwce admnstraton Srserace imolementaton —Bowech user slo entry set Ak ade UR Ooton HITPMttod —_Ooer @post Ore Onarc OMeRSs Ona STE OHEAD Request uml [fanjopiocit/sp(2¥WT DATA DE_D1_Siy)MEADERGEt (ee nes Proto aHTTe OHTTES fate Test cae V7 SE) He ese Jeo ie [Groat aplrer)) [GR] [4PRagneree nm Browser] [Serer Log [PHT TP Heater] (LiUse as Request] @rOata Ember] HTTP Request "po 123", roooo1am, ln scol 19 HTTP Response - Processing Time = 1110 ms Hesder Name alee sststiscole 20 sstatunearon rested -<2xmnl varsion="1. UTF-8°2> ~ Sentry xmins:d="http://schemas.microsoft.com /ado/2007 /08/dataservices’ xmins'm="http:/ /schemas.microsoft.com/ado/2007/08/dataservices/metndata" "http:/ /www.w3.org/2005/ Atom” xml:base="http://ZMU-T ine.com:8001 /sap/opu/adata/sap/Z¥VT_ODATA_DE_01_SRV/"> 2021.z0ttamine.com:8001/sap/opu/odata/sap/ZYVT_ODATA_DE_O1_SRV/HEADERS¢t('97") ” -cutle type="text” >» HEADERSet('97") Supdated>2025-04-07703:53:112. ‘Seategory sche term. ‘http: / /schemas.microsoft.com /ado/2007/08/dataservices/scheme" "ZYVT_ODATA_DE_01_SRV.HEADER"/~ HEADER" rela"self” href=" HEADERS@t('97")"/> application/atom*+xml;type=teed’ (97°)/Partner'> = feed xmi:base="http://ZML-TRA- ay sap caraway clent ede Goto Hetadsta System Hp of -J«aieee I ‘inom SAP Gateway Client Peers ds Qsebct > Pserace acrmnetraton service mslamentatien — swich user — 3 Mhuacet: POR, * wkosg": 70904", 5 ruceeg ‘ rapere 5 rose ~ content type="application /xml! > 5 euene “cmzproperties> 3b t EaiVbein’ 97 OR 0001 04 O4 cd:Bstnk>PO 123-/d:Bstnk> ed:kunars. 13) “Emeng": "100" ¥ co Ln 6cal 19 < [= Tile esiy Et gota o Settings Utites()ayterment System Ep « eae SAR HHH AF oF Data Browser: Table VBAK Select Entries a & EM OW SSR AT chock tow, Displayed Fields: 10 of 22 peer Ja) tise nian o2sa [Client] Sales Dosiment|created on|Tine [treated By |volid Peon) valid To |oosunent Oate| Document Cat, | Teareact.Group Sales Ube. Type| Onder Reason) Varcanty Stare| Collective No,

You might also like