Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Posting Multiple Records into DB Table Using Odata

$
0
0

Hello Experts ,

 

    I want to Insert Multiple Records into SAP DB Table Using Odata POST Method. For that I created an EntityType , Entity Set in a DataModel

and Generated Runtime Objects , Later Redefined the Create Method with the Logic as shown below and Implemented the service.

 

 

EntityType Properties :

ItemNum type Edm.String

PickQty   type Edm.String

ItemPosnn type Edm.String

 

Redefining Create Entity with the Following Logic .

 

   DATA : T_PICK TYPE STANDARD TABLE OF TY_PICK,

          W_PICK TYPE ZCL_ZSTR_PICK_INSERT_MPC=>TS_ZSTRPIC,

          ITEMNUM TYPE ZSTR_PIC-ITEM_NUM,"POSNR_VL,

          PICKQTY TYPE ZSTR_PIC-PICK_QTY, "BDC_FVAL,

          ITEMPOSNN TYPE ZSTR_PIC-ITEM_POSNN ."POSNR_VL.

 

   W_PICK-ITEM_NUM = ITEMNUM.

   W_PICK-PICK_QTY = PICKQTY.

   W_PICK-ITEM_POSNN = ITEMPOSNN.

   APPEND W_PICK TO T_PICK.

 

   INSERT ZSTR_PIC FROM TABLE T_PICK.

   COMMIT WORK.

 

Using The generated Odata service I tried to Post the Record into Table with the following XML Content.

 

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="<server>:<port>/sap/opu/odata/sap/ZSTR_PICK_INSERT_SRV/ZSTR_PIC/"

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">

<id>http://<server>:<port>/sap/opu/odata/sap/ZSTR_PICK_INSERT_SRV/ZSTR_PIC/</id>

<title type="text">ZSTR_PIC</title>

    <category term="/ZSTR_PICK_INSERT_SRV./zstr_pick_insert_srv" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

    <link href="ZSTR_PIC" rel="self" title="/ZSTR_PICK_INSERT_SRV"/>

    <content type="application/atom+xml">

    <m:properties>

<d:ItemNum>000070</d:ItemNum>

<d:PickQty>20.000</d:PickQty>

<d:ItemPosnn>000070</d:ItemPosnn>

</m:properties>

    </content>

    </entry>

 

Record Posting Into table was done with the Values '0' , but not with the Content I am Passing in XML .

 

Please Let me know whether the Approach I Followed is Correct or anything I missed.

 

 

   

Appreciate your help.

 

 

 

 

 

Thanks,

Uday.


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>