cancel
Showing results for 
Search instead for 
Did you mean: 

script print problem

Former Member
0 Kudos

hi experts,

im my main program i have the print pushbutton.

when i give only one order to print the form output is fine..

but wheni give a range and select a few of them the last order that is selcted that gets printed for all the selcted orders..

can anyone tell me whats can be the sloution this..

its urgent..

rewrads will be given.

thnaks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you are using the grid display alv you have to call this under the buutton fct code.

Case sy-ucomm.

when 'PRINT'.

CALL METHOD g_grid->get_selected_rows

IMPORTING

et_index_rows = i_rows.

CALL METHOD cl_gui_cfw=>flush.

LOOP AT i_rows

INTO i_selected_line_s.

lf_row_index = i_selected_line_s-index.

CLEAR <fs_final>.

READ TABLE i_final

INTO <fs_final>

INDEX lf_row_index.

IF sy-subrc EQ 0.

MOVE c_x TO <fs_final>-check.

MODIFY i_final INDEX sy-tabix FROM <fs_final>

TRANSPORTING check .

ENDIF.

ENDLOOP.

-> If you are useing normal report do as follows

if your internal table is itab.

At user-command.

case sy-ucomm.

when 'PRINT'.

DO.

READ LINE sy-index FIELD VALUE itab INTO wa.

IF sy-subrc <> 0.

EXIT.

ELSEIF flag = 'X'.

append wa into itab1.

ENDIF.

ENDDO.

-> now you will get the data which is selected now loop itab1 and call the smartform inside the loop.

Thanks,

NN.

Former Member
0 Kudos

thanks for the reply..

the thing is that i am alredy populating the orders which i have selcted in an internal table

and looping at that table and have called my form(script) inside it,but even after that

its taking the last order that i have selected on the screen and printing the same data

for all the orders that are selected.

what can be done?