cancel
Showing results for 
Search instead for 
Did you mean: 

Reading ABAP internal table in JS with index

prabhu_s2
Active Contributor
0 Kudos

Hi

Please can anyone throw light on how to read internal table in JS? All i have is:

How to read table in js?

            for (var j=0; j<"<%= cols%>"; j++)

              {

                VAR actvty = 0;

              <% read table gt_bays into bays_wa index j.

                 if sy-subrc is INITIAL.

                   actvty = bays_wa-grc.

                 endif.

              %>;

in the above code i want to read the table based on the index 'J' from the JS for loop and also set the actvty variable in the JS? any pointers here please?

Accepted Solutions (0)

Answers (1)

Answers (1)

lisa_miller3
Participant
0 Kudos

try something like this:

     var grc;

     for (var j=0; ....

     {

          grc = document.getElementById('model_gt_bays[' + j + '].grc');

          if (grc.value == "")

               continue;

          else

               actvy = grc.value;

          ....

     }

prabhu_s2
Active Contributor
0 Kudos

Yeah already tired but didn't work. compiler throwing issues, 'j' not found kind of errors.

but i got this thought of using AJAX JSON to connect to server and get the data which i was able to do but not sure on how to get the data from server to a array. what i have is:

        $(document).ready(function()

        {

        var params = getURLParam().split('?');

        $.post("ConnServer.htm", { url: getURLParam() , params: params[1]})

         .done(function( data )

          {

           alert("req ok");

           var url = $.parseJSON(data);

          } );

        });

in server request i have:

CREATE OBJECT oref

  EXPORTING

    DATA = lt_planord.

oref->serialize( ).

retplanords = oref->get_data( ).

not sure on how to get the retplanords results in the client script. any inputs on this please?