Application Development 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: 

running a DOS program before an ABAP program

Former Member
0 Kudos

Hello

we have Z_Order  ABAP program which load order to SAP, we need to run a DOS program to get file to the correct folder.

Is it possible to run this DOS program every time user run Z_Order program

Thanks

1 REPLY 1

stefan_schnell
Active Contributor
0 Kudos

Hello Mohsen,

welcome in the SAP community.

  1. If you don't have the possibility to change your ABAP report Z_Order you can do this:
    Download the COM Connector from here. Look at example 0108_ABAPReport.vbs. It is a VBScript to implement and execute and ABAP Report via VBScript. Change the report inside the VBScript like this:

    Dim ABAP(2)
    ABAP(0) = "Report z_myreport Line-Size 256."
    ABAP(1) = "Submit Z_Order."

    Now write a batch file like this:

    MyDOSProg.exe
    wscript.exe 0108_ABAPReport.vbs

    In the first step your DOS program is executed and in the second step the VBScript implements and executes the ABAP program to run your Z_Order report. You can start your batch file from your presentation server. But you need one the one hand rights for RFC connection and on the other hand a developer key.

  2. Another way is to go to your developer and talk to him about a RFC function module, which calls the report Z_Order via Submit. Now you can call this RFC function module as in the CCo example 0103_Ping.vbs as I described above. Here you need only the rights for RFC connection.
  3. If you have the possibility to change your ABAP report, you can do that:

    Call Method cl_gui_frontend_services=>execute
      Exporting
        DOCUMENT = 'cmd MyDOSProg.exe'
        SYNCHRONOUS = 'X'
      Exceptions
        Others = 1.

    Call the method execute in front of all other commands inside your Z_Order report.

Cheers

Stefan