cancel
Showing results for 
Search instead for 
Did you mean: 

Internal table in Script

Former Member
0 Kudos

Hi All,

I need to check whether an internal table is having data or not in script.

Can i use If Not &it_table& is Initial, just like we use in reports, but it is not working.

Pls advise me how to check whether the internal table is having data or not.

Thanks,

Priya

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Priya,

In SAP script you can not pass all the data to output layout.. Whenever we need to use the the data to be printed on output layout, we first populate that data in a print program.

First you need to populate your internal table in Print program only.. and to display this data ..

you need to put a loop on that internal table. pass all the fields into a structure.. and then you can use that structure in script editor. so that your layout can print it one by one..

You need to code like as below in your print program..

loop at i_tab.
 i_tab-f1 = w_display-f1.
 i_tab-f2 = w_display-f2.
 i_tab-f3 = w_display-f3.

* Call the wirte_form 

 call function 'WRITE_FORM'
    exporting
      element   = 'ELEMENT'
     window    = 'MAIN'
    exceptions
      element   = 1
      function  = 2
      type      = 3
      unopened  = 4
      unstarted = 5
      window    = 6
      others    = 7.
endloop.

Now in editor you can put like that:

*/E ELEMENT*
*PF &w_display-f1&,, &w_display-f2&,, &W_display-f3&*

Former Member
0 Kudos

HI,

FIrst thing is how can we get total internal table at once to script?

I am afride to say it is not possible to do that.

Regards and Best wishes.

Former Member
0 Kudos

Hi Priya,

We can not use the statement you mentioned in Script. It will not work.

You can not pass full internal table to Script. Rather you pass the corresponding work area.

and we can check if a work-area is initial.

/: IF &WORK_AREA-MATNR& = ZERO (or Space)

/: ENDIF

Hope it helps.

Thanks,

Daya.