Skip to Content
0
Apr 01, 2009 at 06:16 AM

SAP script

29 Views

hi all,

i made a script for printing and i m calling it in driver program but problem is that while executing then after selecting printer 'LOCL' it is showing error 'WRITE_FORM is invalid and START_FORM is mising'.

can anyone please tell me the meaning of this error and how to remove it. while form is activated properly.

Driver program :

REPORT zpf_trust_print NO STANDARD PAGE HEADING LINE-SIZE 125.

TABLES : zprint, zpf_loan, zprev_emp, zpf_clos_bal, pa0001, pa0587, itcpo.

TYPE-POOLS : slis.

***********************************************************************

DATA : BEGIN OF itab OCCURS 0,

pernr LIKE zprint-pernr,

period LIKE zprint-period,

gjahr LIKE zprint-gjahr,

ename LIKE pa0001-ename,

kostl LIKE pa0001-kostl,

eepfn LIKE pa0587-eepfn,

END OF itab.

DATA : date TYPE d.

***********************************************************************

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : pernr FOR zprint-pernr,

period FOR zprint-period NO INTERVALS NO-EXTENSION,

gjahr FOR zprint-gjahr NO INTERVALS NO-EXTENSION.

SELECTION-SCREEN : END OF BLOCK b1.

***********************************************************************

AT SELECTION-SCREEN.

IF period-low LT '01' OR period-low GT '12'.

MESSAGE 'Please Enter Period Betveen 1 to 12' TYPE 'I'.

ENDIF.

START-OF-SELECTION.

PERFORM print_form.

&----


*& Form PRINT_FORM

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM print_form .

itcpo-tdimmed = 'X'.

itcpo-tddelete = 'X'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

device = 'PRINTER'

dialog = 'X'

form = 'ZPF_TRUST'

language = sy-langu.

SELECT pernr period gjahr FROM zprint INTO TABLE itab WHERE pernr IN pernr AND period IN period AND gjahr IN gjahr.

IF sy-subrc NE 0.

MESSAGE 'Data not found in ZPRINT table.' TYPE 'I'.

ENDIF.

SORT itab BY pernr.

LOOP AT itab.

date = sy-datum.

SELECT SINGLE ename kostl FROM pa0001 INTO (itab-ename , itab-kostl) WHERE pernr = itab-pernr.

SELECT SINGLE eepfn FROM pa0587 INTO itab-eepfn WHERE pernr = itab-pernr AND endda = '99991231'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

  • ELEMENT = ' '

function = 'SET'

type = 'BODY'

window = 'HEADER2'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

  • ELEMENT = ' '

function = 'SET'

type = 'BODY'

window = 'MAIN'.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

  • EXCEPTIONS

  • UNOPENED = 1

  • BAD_PAGEFORMAT_FOR_PRINT = 2

  • SEND_ERROR = 3

  • SPOOL_ERROR = 4

  • CODEPAGE = 5

  • OTHERS = 6

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " PRINT_FORM

regards saurabh.