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

Function Module For Executing

Former Member
0 Likes
727

Hi all,

I need a function module for executing .bat file in application server.

Regards

Sathish Kumar K.C

5 REPLIES 5
Read only

Former Member
0 Likes
624

Hello

Try doing a search in se37 for SXPG*.

SXPG_CALL_SYSTEM would be a place to start.

You may need to define an external command in sm69. (or get Basis to help)

Regards

Greg Kern

Read only

0 Likes
624

Hi ,

I specified all the parameters in SM69 .Since i cant execute my .bat file in server from local system.ICan you please help me?

Edited by: Sathish Kumar K.C on Jul 7, 2009 7:28 AM

Read only

venkat_o
Active Contributor
0 Likes
624

Hi Sathish kumar, You have to read application file like below whatever is the extension.

REPORT ztest_notepad.

DATA: BEGIN OF it_data OCCURS 0,
        data TYPE string,
      END OF it_data.
PARAMETERS: p_file TYPE char80 DEFAULT 'usr/sap/tmp/venkat.bat'.

START-OF-SELECTION.
  OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT. "This statement opens the application server file to read
  IF sy-subrc = 0.
    DO.                            "Loop the file using DO-ENDO 
      READ DATASET p_file INTO it_data-data. 
      IF sy-subrc = 0.
        APPEND it_data.
        CLEAR  it_data.
      ELSE.       "If there is no record exit the loop.
        EXIT.
      ENDIF.
    ENDDO.
  ENDIF.
  CLOSE DATASET p_file. "Close file 
Thanks Venkat.O

Read only

Former Member
0 Likes
624
CALL FUNCTION 'SXPG_STEP_COMMAND_START'
    EXPORTING
*     TARGET                           =
*     DESTINATION                      =
      COMMANDNAME                      = 'ZCOPY'
      ADDITIONAL_PARAMETERS            = AD_PAR
      OPERATINGSYSTEM                  = 'Windows NT'
      STDINCNTL                        = 'R'
      STDOUTCNTL                       = 'M'
      STDERRCNTL                       = 'M'
      TRACECNTL                        = '3'
      TERMCNTL                         = 'C'
*     TRACELEVEL                       = 0
*     BATCH                            =
*     LONG_PARAMS                      =
*     JOBNAME                          =
*     JOBCOUNT                         =
*     STEPCOUNT                        =
*     CONNCNTL                         = 'H'
*   IMPORTING
*     STRTSTAT                         =
*     XPGID                            =
*     CONVID                           =
*     EXITSTAT                         =
*     EXITCODE                         =
*     PARAMS                           =
*     LAST_PROC                        =
*     LAST_HOST                        =
*     LAST_PROC_NUM                    =
   TABLES
     LOG                              = LT_LOG
   EXCEPTIONS
     COMMAND_NOT_FOUND                = 1
     PARAMETER_EXPECTED               = 2
     PARAMETERS_TOO_LONG              = 3
     SECURITY_RISK                    = 4
     WRONG_CHECK_CALL_INTERFACE       = 5
     NO_PERMISSION                    = 6
     UNKNOWN_ERROR                    = 7
     COMMUNICATION_ERROR              = 8
     SYSTEM_ERROR                     = 9
     CANNOT_GET_RFC_DESTS             = 10
     JOB_UPDATE_FAILED                = 11
     JOB_DOES_NOT_EXIST               = 12
     OTHERS                           = 13
Read only

0 Likes
624

Hi all,

I need to know where i have to specify the path to be executed in SM69 , i got it thanks for your reply.

Thanks & Regards

Sathish Kumar K.C

Edited by: Sathish Kumar K.C on Jul 9, 2009 7:22 AM