Skip to Content
0
Former Member
Nov 25, 2009 at 02:09 PM

Print dummy receipt from screen painter using application form + SAPscript

43 Views

Good morning, experts.

I have a requirement to allow a user to enter in information for a dummy receipt, but I'm not quite sure how to do it. I asked if it was to be done using smartforms or SAPscript, and was given the name of the application form and associated SAPscript. Also I was told that the development of the application form is near completion, but not yet.

The screen is accessible via a customer function at the cash desk in FPCJ and has 4 input fields, and the print receipt button, which was assigned the function code, but I'm not sure what I'm supposed to use in the PAI. Some googling led me to the function modules OPEN_FORM and CLOSE_FORM, but I don't think I'm using them right, because when I execute the program, nothing happens. This is what I have:

Note: ZSCR_01is the name of the SAPscript; ZPWB_01 is the name of the application form.

CASE tmp_okcode.
  WHEN 'PRINT'.
    CALL FUNCTION 'OPEN_FORM'
     EXPORTING
       DEVICE                            = 'PRINTER'
       DIALOG                            = 'X'
       FORM                              = 'ZSCR_01'
       LANGUAGE                          = SY-LANGU
     EXCEPTIONS
       CANCELED                          = 1
       DEVICE                            = 2
       FORM                              = 3
       OTHERS                            = 12
              .
    IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    CALL FUNCTION 'CLOSE_FORM'
*     IMPORTING
*       RESULT                         = ''
     EXCEPTIONS
       UNOPENED                       = 1
       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.

NOTE: I've tried replacing PRINTER with SCREEN with same result..

I've read about START_FORM, WRITE_FORM and others but am not sure how to use them.

Any help will be greatly appreciated.