cancel
Showing results for 
Search instead for 
Did you mean: 

calling script from ALV report

Former Member
0 Kudos

there is button in my report(print) when click on this it needs to display the report output in a script (which is designed for this)

Please help me how to declare my itab variables in Script....

only the data and page number will change rest all text elments are constant for differnet pages.

the code in the USER_COMMAND of reuse_GRID_DISPLAY is

WHEN 'PRINT'.

i_itcpo-tdimmed = 'X'.

i_itcpo-tddelete = 'X'.

CALL FUNCTION 'START_FORM'

EXPORTING

  • ARCHIVE_INDEX =

form = 'ZSCRIPT'

language = 'SY-LANGU'

startpage = 'FIRST'

EXCEPTIONS

form = 1

format = 2

unended = 3

unopened = 4

unused = 5

spool_error = 6

OTHERS = 7.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

application = 'TX'

device = 'PRINTER'

dialog = 'X'

form = 'ZSCRIPT'

options = i_itcpo

language = sy-langu.

PERFORM print_data.

CALL FUNCTION 'CLOSE_FORM'.

MESSAGE s208(00) WITH ' Form Successfully Printed.'.

CALL FUNCTION 'END_FORM'.

THE PERFORM DETAILS................

*Left logo

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'LLOGO'

EXCEPTIONS

OTHERS = 1.

*script header

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'HEADER'

EXCEPTIONS

OTHERS = 1.

*standard text

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'TEXT'

EXCEPTIONS

OTHERS = 1.

*dispos detials

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'DISPOSI'

EXCEPTIONS

OTHERS = 1.

*ECN number

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'ECN'

EXCEPTIONS

OTHERS = 1.

*out_tab headings and data

LOOP AT it_rep_out INTO wa_rep_out.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'DETAIL_A'

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'MAIN'

EXCEPTIONS

element = 1

window = 2.

IF sy-subrc NE 0.

ENDIF.

ENDLOOP.

*Comments from selection screen

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'FOOTER'

EXCEPTIONS

OTHERS = 1.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member181962
Active Contributor
0 Kudos

Hi,

i think you don't need to use the start_form at all.

Also, for write_form fms, you need to pass the window name also.

Refer this program as an example: RSTXEXP1

Regards,

Ravi

Former Member
0 Kudos

Hi,

first store all the relevant data in internal table itab.

loop at itab.

call write form

endloop.

care should be taken that you write the itab in main window.

in script just add

&itab-var1& &itab-var2& and so on...

Regards,

sumit