Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP script driver program

Former Member
0 Likes
4,328

Hi SAP ABAP Technical consultants,

Have a doubt in SAP standard script. The SAP Script driver program name -


Y_J1IPRNTARE and its Script form name --- Y_J1_I_ARE1.

I would be converting the standard script into as per my client requirement. I have modified in the SAP Script and added new titles and headings.

I copied all these into separately and its driver program name -


Z_J1IPRNTARE, script form name -- Z_J1_I_ARE1.

For basically we required three kinds of functional modules in SAP Script. They are open_form, write_form and close_form

Then I have to changed in the form name in start_form FM .

That means

CALL 'open_form'

APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'Z_J1_I_ARE1'

LANGUAGE = SY-LANGU

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = element

function = fnction

type = 'BODY'

window = window

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

spool_error = 8

codepage = 9

OTHERS = 10

.

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 = RESULT

  • TABLES

  • OTFDATA =

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.

These are the functional modules i have used. And finally I have checked and activated. when executing the driver program it is not showing performing any action even it is not showing error message.

Why it is happening ? Can anyone help to me how to handle this?

Thanks

venkat

4 REPLIES 4
Read only

Former Member
0 Likes
1,694

CALL FUNCTION 'OPEN_FORM'
      EXPORTING
        form = 'Z_J1_I_ARE1'. 

 CALL FUNCTION 'START_FORM'
        EXPORTING
          form = 'Z_J1_I_ARE1'.

PERFORM write_form USING 'TEST' 'MAIN'.

FORM write_form USING element TYPE c wind TYPE c.

  CALL FUNCTION 'WRITE_FORM'
    EXPORTING
      element = element
      window  = wind.
ENDFORM.                    " write_form

only write as follow don't pass any parameter.


CALL FUNCTION 'CLOSE_FORM'.

Read only

Former Member
0 Likes
1,694

Have you assigned your print program (Z Print Program) and your Script ( Z script ) in NACE Transaction?

Regards

Ganesh Reddy

Read only

Former Member
0 Likes
1,694

Hi,

You can check the following code.You can get the idea.



  call function 'OPEN_FORM'
   exporting
   application                        = 'TX'
*   ARCHIVE_INDEX                     =
*   ARCHIVE_PARAMS                    =
   device                             = 'PRINTER'
   dialog                             = 'X'
     form                             = 'Zformname'
     language                         = sy-langu
*   OPTIONS                           =
*   MAIL_SENDER                       =
*   MAIL_RECIPIENT                    =
*   MAIL_APPL_OBJECT                  =
*   RAW_DATA_INTERFACE                = '*'
*   SPONUMIV                          =
* IMPORTING
*   LANGUAGE                          =
*   NEW_ARCHIVE_PARAMS                =
*   RESULT                            =
   exceptions
     canceled                          = 1
     device                            = 2
     form                              = 3
     options                           = 4
     unclosed                          = 5
     mail_options                      = 6
     archive_error                     = 7
     invalid_fax_number                = 8
     more_params_needed_in_batch       = 9
     spool_error                       = 10
     codepage                          = 11
     others                            = 12
            .
  if sy-subrc <> 0.
    message id sy-msgid type 'S' number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.                             


    call function 'WRITE_FORM'
     exporting
       element                        = 'DATA1'
       function                       = 'SET'
       type                           = 'BODY'
       window                         = 'MAIN'
* IMPORTING
*   PENDING_LINES                     =
     exceptions
       element                        = 1
       function                       = 2
       type                           = 3
       unopened                       = 4
       unstarted                      = 5
       window                         = 6
       bad_pageformat_for_print       = 7
       spool_error                    = 8
       codepage                       = 9
       others                         = 10
              .
    if sy-subrc <> 0.
      message id sy-msgid type 'S' number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.                            


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 'S' number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.                               

Read only

Former Member
0 Likes
1,694

Hi,

AM not understanding that why you copied the standard Driver program into Custom Driver Program.

You can enhance the Standard program by adding Subroutine statement in the Scripts.

Just think you are having many forms for one Standard T-codes.

At that time we are using the Start form . Means that which form needs to printed at that time.

With Regards,

Sumodh.P