cancel
Showing results for 
Search instead for 
Did you mean: 

Counting # of records in Table

Former Member
0 Kudos

I have a Table which is being passed to my context in the ADOBE Form called t_data.  I need to be able to count the # of records in this table.  I don’t have to display the actual table in this case on the form, I just need the record count and then I will display the record count on the form.  If the table itself has  to be on the form in order to do this then perhaps I can have the table on the form but just make it invisible and then display the record count.  I know the easiest solution would be to do the count in SAP and pass this as a separate context element, but I am hoping to avoid this for other complicated reasons.

  And, I need to do this using JavaScript and I don’t know anything about Java.  Does someone know how to do this and can you give me an example that this non-java person (me) can understand?  thx

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Janice,

Instead of doing on the form using Javascript/Formcalc, perhaps do you want to do the checking on number of record in table, under form interface 's Initialize method ? I believed this will be a lot easier and simple.

Add a global variable under Global Data.

Add this code under Code Initialization

CLEAR gv_count.

DESCRIBE TABLE iv_itab LINES gv_count.

In your form, put this code under initialize event(Formcalc, Client script) of subform, that contains your table.

If ( $record.lv_count == 0 )then

   this.presence = "hidden"

endif

Hope this helps.

regards,

Xiang Li

Former Member
0 Kudos

Oh my gosh, this is SO much easier!  thank-you so much Xiang.

Former Member
0 Kudos

Hi Janice,

You are most welcome.

Happy to hear you have solved your issue.

Thanks for reward points given.

regards,

Xiang Li

Answers (0)