cancel
Showing results for 
Search instead for 
Did you mean: 

Table values should come to batch operation

Former Member
0 Kudos

Hello expert,

According to my project I have a table which have values entered by user. And also I want to send these values to my batch for my abap project. But these values can not get from table to batch. Can you help me for this?

Here is my code:


              var batchChanges = [];

              var oEntry = [];

              var zCount = moModel.oData.clients.length;

              for (i = 0; i < zCount; i++) {       

//    

                oEntry.push({ 

               MATERIAL : oTable2.content[2].getValue(),

               BATCH : oTable2.content[4].getValue(),

             ENTRY_QNT : oTable2.content[6].getValue(),

                 ENTRY_UOM : oTable2.content[8].getValue(),

                 COSTCENTER : oTable2.content[10].getValue(),

                 MOVE_REAS : oTable2.content[12].getValue(),

             MOVE_TYPE : oTable2.content[14].getValue(),

          });

//          var oModel = sap.ui.getCore().getModel(); // ensure that you did not overwrite your

          // model locally!! with some JSON model for example

  //create an array of batch changes and save

            batchChanges.push(oModel.createBatchOperation("MATERIAL_POSTSet", "POST", oEntry[i]));

        };

            oModel.addBatchChangeOperations(batchChanges);

            //submit changes and refresh the table and display message

              oModel.submitBatch(function(data){

              oModel.refresh();

              sap.ui.commons.MessageBox.show(data.__batchResponses[0].__changeResponses.length

                + " contacts created", sap.ui.commons.MessageBox.Icon.SUCCESS,

              "Batch Save", sap.ui.commons.MessageBox.Action.OK);

And one more thing if i write following description these values are coming to my abap repository:


  oEntry.push({ 

               MATERIAL : "20002541"

               BATCH : "NEW"

             ENTRY_QNT : "1"

                 ENTRY_UOM : "000"

                 COSTCENTER : "1000"

                 MOVE_REAS : "desc"

             MOVE_TYPE : "10586"

          });

I just need table values instead of these values.

Thanks,

Ogulcan G.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

post table binding

Former Member
0 Kudos

Hello Maksim,

Thanks for reply,

But couldn't understand what do u mean, can you morely explain it pls?

Thank you,

Ogulcan G.

former_member182372
Active Contributor
0 Kudos

what are you trying to achieve and what exactly is not working

Former Member
0 Kudos

Hello,

I want to take all the values row by row for sending my batch operation. Thats why I have loop and this loop is working when I write like second example.

But on that example the values are written on the code. But I need table values for this.

In my opinion "MATERIAL : oTable2.content[2].getValue(), " This is not correct for take on the table from MATERIAL column value. I need this help.


Thank you,


Ogulcan G.


former_member182372
Active Contributor
0 Kudos

create a jsonmodel and bind it to the table, so you dont have to do any loops.

anme properties in the model object same as your odata service so you can pass it "as is"

Former Member
0 Kudos

I solved my problem with my this method:

MATERIAL : moModel.oData.clients[i].MATERIAL,

thank you!

agentry_src
Active Contributor
0 Kudos

Please mark this Discussion with a Correct Answer (closes, but does not lock the Discussion) and Helpful Answer where appropriate. See http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why   Even if you discovered the solution without any outside contributions, it helps others to understand what the solution turned out to be. 

Do not use Assumed Answered as it confuses anyone looking for the specific answer.  If you dig into the Getting Started link (top right of each SCN page), you are only instructed to mark Helpful or Correct Answers to Discussion responses. 

Thanks, Mike (Moderator)

SAP Technology RIG