C Program call in ABAP

Advertisement
November 30

Hello,
Can anybody tell me the syntax to call a 'C' Program in an ABAP program. How it can be done, and where can I get some information on it?
Regards,
Kunal

Advertisement

Replay

Hi, I tested function SXPG_COMMAND_EXECUTE on a Windows server and it worked well.  Here's an example of my ABAP code.
Mark
REPORT Z_TEST3.
The function SXPG_COMMAND_EXECUTE allows you to perform an
external operating system command from within an ABAP program.
The export parameter COMMANDNAME is defined in txn SM69.
ZCMD is defined as 'cmd /c'.
start-of-selection.
  perform exe.
FORM EXE.
data: t_exec_protocol like btcxpm occurs 0 with header line.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
  EXPORTING
   COMMANDNAME            = 'ZCMD'
   ADDITIONAL_PARAMETERS  = 'dir \usr\sap\interface\*.txt'
    OPERATINGSYSTEM       = SY-OPSYS
  TARGETSYSTEM                        = SY-HOST
  DESTINATION                         =
  STDOUT                              = 'X'
  STDERR                              = 'X'
  TERMINATIONWAIT                     = 'X'
  TRACE                               =
IMPORTING
  STATUS                              =
  EXITCODE                            =
  TABLES
    EXEC_PROTOCOL                       = t_exec_protocol
EXCEPTIONS
  NO_PERMISSION                       = 1
  COMMAND_NOT_FOUND                   = 2
  PARAMETERS_TOO_LONG                 = 3
  SECURITY_RISK                       = 4
  WRONG_CHECK_CALL_INTERFACE          = 5
  PROGRAM_START_ERROR                 = 6
  PROGRAM_TERMINATION_ERROR           = 7
  X_ERROR                             = 8
  PARAMETER_EXPECTED                  = 9
  TOO_MANY_PARAMETERS                 = 10
  ILLEGAL_COMMAND                     = 11
  WRONG_ASYNCHRONOUS_PARAMETERS       = 12
  CANT_ENQ_TBTCO_ENTRY                = 13
  JOBCOUNT_GENERATION_ERROR           = 14
  OTHERS                              = 15
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at t_exec_protocol.
  write: / t_exec_protocol-message.
endloop.
ENDFORM.

View 5 Replies

Tags:

  1. my ipod wont turn on
  2. hp 2000-2313tu clean install os
  3. file: C:UsersHPDesktopmemeo.txt
  4. H8N4
  5. I2S6
  6. 4Z1A
  7. itunes download 10.5
  8. clearlyyza
  9. studyingnwy
  10. duringweu
Copyrights 2019 Fcffair BigData Resource, All rights reserved