Call external program in background mode

Hi,
I am creating a PO using bapi BAPI_PO_CREATE1 in exit USEREXIT_SAVE_DOCUMENT_PREPARE.
I dont want to write the code in my exit. Instead I want to write the code in a Z program and call it in my exit.
My Problem.
How do I call my z program in my exit so that I can pass internal tables from my exit to the z program. Also I want to schedule the call of my external program for background processing.
I am trying with SUBMIT ZPROG AND RETURN. But not able to pass an internal table.
I tried PERFORM BAPI_PO_CREATE IN PRGRAM ZPROG, but in this case not able to schedule it in background.
Please advise.
Regards,
Shobhit

Hi Rich,
Im setting runtime error:
My Code in Exit: (xvbfa is the table which i wanna pass)
concatenate 'SERVICEPO' sy-datum into l_key.
export xvbfa = xvbfa
              to shared buffer indx(st) id l_key.
My Code in the called program ZMM_SERVICE_PO
Runtime Errors         CONNE_IMPORT_WRONG_OBJECT_TYPE
Exceptn                CX_SY_IMPORT_MISMATCH_ERROR
Date and Time          05.12.2005 21:41:54
ShrtText
     Error when attempting to IMPORT object "XVBFA".
What happened?
     Error in ABAP application program.
     The current ABAP program "ZMM_SERVICE_PO" had to be terminated because one of
      the
     statements could not be executed.
     This is probably due to an error in the ABAP program.
     When importing the object "XVBFA", the object in the
     dataset had a different type from the target object in the program
     "ZMM_SERVICE_PO" (object types: field, field string/structure, table).
     table).
Error analysis
     An exception occurred. This exception will be dealt with in more detail
     below. The exception, assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was
      not caught, which
      led to a runtime error. The reason for this exception is:
     The object "XVBFA" has a different object type in the dataset from
     that in the target program "ZMM_SERVICE_PO". (Object types: Field, flat
      structure,
     deep structure, flat table, deep table).
Missing Handling of System Exception
    Program                                 ZMM_SERVICE_PO
Trigger Location of Exception
    Program                                 ZMM_SERVICE_PO
    Include                                 ZMM_SERVICE_PO
    Row                                     43
    Module Name                             START-OF-SELECTION
Source Code Extract
Line  SourceCde
REPORT  ZMM_SERVICE_PO.
DATA: l_poheader      LIKE bapimepoheader.
DATA: l_poheaderx     LIKE bapimepoheaderx.
DATA: l_poitem        LIKE bapimepoitem     OCCURS 0 WITH HEADER LINE.
DATA: l_poitemx       LIKE bapimepoitemx    OCCURS 0 WITH HEADER LINE.
DATA: l_cond          LIKE BAPIMEPOCOND     OCCURS 0 WITH HEADER LINE.
DATA: l_condx         LIKE BAPIMEPOCONDX    OCCURS 0 WITH HEADER LINE.
DATA: l_poschedule    LIKE bapimeposchedule OCCURS 0 WITH HEADER LINE.
DATA: l_poschedulex   LIKE bapimeposchedulx OCCURS 0 WITH HEADER LINE.
DATA: l_purchaseorder LIKE bapimepoheader-po_number.
DATA: l_return        TYPE BAPIRET2 OCCURS 0.
DATA: l_error_found   TYPE c.
DATA: l_show_messages TYPE c.
DATA: l_eindt(10)     TYPE c.
DATA: l_answer        TYPE c.
DATA: l_VBAK          TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
DATA: l_VBFA          TYPE STANDARD TABLE OF VBFA WITH HEADER LINE.
DATA: xlips           TYPE STANDARD TABLE OF LIPS WITH HEADER LINE.
*DATA: xvbfa           TYPE STANDARD TABLE OF vbfa WITH HEADER LINE.
DATA xvbfa like vbfa.
DATA: l_key(60) type c.
      concatenate 'SERVICEPO' sy-datum into l_key.
>>>>> import xvbfa = xvbfa
                  from shared buffer indx(st) id l_key.
      delete from shared buffer indx(st) id l_key.
Could you help.
Regads,
Shobhit

Similar Messages

  • Call transaction KB21N processed by a program in background mode

    Hi to all,
    I call transaction KB21N using BDCDATA in a custom program. If I process this program in foreground mode all it's OK, but if I process the program in background mode, I have a runtime error with DUMP: RAISE EXCEPTION with exception condition CNTL_ERROR. This program has to be executed in background so a bapi exist to use instead of call transaction or something else?
    Thank you very much,
    regards
    Antonio

    HI Antonio,
    The transaction you are dealing with is an SAP Enjoy transaction and for such transactions it is not recommended to do a BDC. YOu should search for  a BAPI for the same as you have already identified. Basically the enjoy transactions uses GUI controls which cannot be handled by BDC.
    BAPI_ACC_ACTIVITY_ALLOC_POST may serve your purpose.
    Regards,
    ravi
    Message was edited by:
            Ravi Kanth Talagana

  • How to set the BDC Call transaction Program in Background

    Hi All,
            I have a requirement. If i execute a BDC Call Transaction Program in Background it is showing 0 seconds means it is not executing. Normally it is working properly. If execute in background it is not executing. But my client wnats to execute in background. How can i overcome this could you please suggest me?
    Thanks in Advance

    hi
    To schedule the processing of session in backgroud you can use report RSBDCSUB.
    You can do in two ways -
    Ist Method
    Define a batch job in SM36 with two steps -
    First Step - Your Custom Program ( with a variant )
    Second Step - RSBDCSUB ( With a variant having
    the session name ).
    2nd Method
    In your program after BDC_CLOSE_GROUP add a line.
    SUBMIT RSBDCSUB WITH MAPPE EQ <SESSION_NAME>.
    Scedule you program as a batch job in SM36 ( Single Step ). ( You can also test the program by running in online mode . After your programs executes , go and see in SM35. You will see that your session created in being processed or has been processed in background).
    In Both ways the session created by BDC_OPEN_GROUP will be processed in background
    You would have to create a job on the fly to do this. This example shows how to kick off a background job via an ABAP program.
    report zrich_0004 .
    data:   sdate type sy-datum,
            stime type sy-uzeit,
            l_valid,
            ls_params like pri_params,
            l_jobcount like tbtcjob-jobcount,
            l_jobname  like tbtcjob-jobname.
    start-of-selection.
    Get Print Parameters
      call function 'GET_PRINT_PARAMETERS'
           exporting
                no_dialog      = 'X'
           importing
                valid          = l_valid
                out_parameters = ls_params.
    Open Job
      l_jobname = 'ZRICH_0005'.
      call function 'JOB_OPEN'
           exporting
                jobname  = l_jobname
           importing
                jobcount = l_jobcount.
    Submit report to job
      submit zrich_0005   
           via job     l_jobname
               number  l_jobcount
           to sap-spool without spool dynpro
               spool parameters ls_params
                  and return.
    Schedule and close job.
      call function 'JOB_CLOSE'
           exporting
                jobcount  = l_jobcount
                jobname   = l_jobname
                strtimmed = 'X.
    regards
    Satish

  • How to call external programs?

    I have seen people call external programs through LabVIEW and was curious what functions you could use to do this.
    I'm pretty sure its using one of the ActiveX functions  or maybe 'open application reference .vi'.
    Can anyone tell me (or show me) a quick example of how to open an external program (ie excel,  notepad, etc) programatically
    Cory K
    Solved!
    Go to Solution.

    Cory K wrote:
    Where did they get this:
    Kudos for going from "I don't know to start" to "Let's stump Ben" with only the second post to this thread.
    I either copy it from an example or try to browse to it.
    NOTE:
    If you plan to work with MS ActiveX objects, I found it very helpful to do a custom install of Office and make sure the help files for VBA are loaded. These will at the least give you an idea of what the methods are and what parameters go with each.
    Ben
    Message Edited by Ben on 12-31-2008 11:09 AM
    Message Edited by Ben on 12-31-2008 11:13 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Browse.PNG ‏24 KB

  • To call external program

    I would like to know if exists a way of to call external program in windows ce. I'm using cvm J9.

    I don't know how is configured Windows CE, but Windows ME is MIDP 2.0, and formRequest(URL) do it (but work only since MIDP 2.0).
    It's work, but in my case, i try to add arguments, and it doesn't work with : URL = "/Program Files/MyProg/myProg.exe arg1 arg2". If somebody have found a solution...

  • Is there any way to run signcode.exe program under background mode

    Hi everyone,
    I am finding the solutions to build the project automatically but the situation is still unchanged. When building the project i have use the signcode tool to sign my .cab files therefore the system shows me the "Enter Private Key Password" dialog and ask me to enter my password into the Password field.
    If all you guy have any ways for packing the project by the mechanism of the running signcode program under background mode. Below is my script.
    [b]signcode -spc ms.spc -v ms.pvk -n abc.cab -i URL -t http://timestamp.verisign.com/scripts/timstamp.dll abc.cab
    Thank you for your ideas and regards
    Tan

    Hi,
    you can use the tool signcode-pwd to automate the signing:
    http://www.stephan-brenner.com/blog/?page_id=9

  • Passing Variables Between Programs in Background Mode

    Hello,
    Can you pls. suggest how I can pass a variable from one program to the other while in the background mode.
    The Export and Import parameters do not work while in the background.
    Thanks.
    Amit

    Hi Amit,
    EXPORT/IMPORT works in Background mode provided the export & import both are done in background.
    Refer this program: it has export/import in background
    /people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job
    <b>*----
    Before the export, fill the data fields before CLUSTR
    </b>
      wa_index-aedat = sy-datum.
      wa_index-usera = sy-uname.
      EXPORT s_matnr
           TO DATABASE indx(st) FROM wa_index ID wa_index_key.
    <b>*----
    Before the import, fill the data fields before CLUSTR.
    </b>
      wa_index1-aedat = sy-datum.
      wa_index1-usera = sy-uname.
    To Import the selection screen data from Calling Program
      IMPORT i_mara
      FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
      FREE MEMORY ID wa_index_key1.
    Message was edited by:
            Prashant Patil

  • Language other than bash for calling external programs

    Hi,
    sorry for the unspecific title, I couldn't think of a better summary.
    The problem is this: I have written a script to encode a DVD to H264 and Vorbis. Since it basically just performs some (OK, by now: A lot of.) management and then calls a external programs, Bash was the obvious choice.
    However, the administrative stuff the script does (evaluating user input, calculations etc.) was already a nightmare to code in Bash (lack of arithmetic, lack of data types, proper functions, lack of c-like structs etc.), and I now want to make it even more flexible in what the user (me) can ask of it (it's also going to use a config file, which is another thing that gets ugly fast). Frankly, I can't stomach that.
    So the question is this: What language would be sensible for a program the most important function of which is calling other programs?
    Simply executing them from the main program isn't enough, unfortunately, because I want to make use of multicore system by for example simultaneously extracting streams and encoding them (right now that is done through named pipes), ideally I'd need a way to multithread not internal functions/routines but external programs (Through pipes or whatever).
    I'd prefer an interpreted language, but it's not a requirement.

    I second what peets said. Perl is definitely you're best option here, in my opinion anyways. It has the best (by which I mean easiest) system interface of any scripting langauge I've worked with, and if you want a simple configuration file reader, perl's regex'es are king. Perl also takes a lot of features from the shells, such as the file test operations. If the project get's really big and hairy though, it might be worth considering python as a cleaner, stricter alternative.
    Hope that helps!

  • Calling External Program

    Hi all,
    I’m currently doing a program that will trigger an external batch (.bat) program. I’m using WS_EXECUTE function module to trigger the external program. I need to know that whether ABAP will wait until the external bat program run completed then only will go back to the calling program and execute the rest of the ABAP code; or the WS_EXECUTE will just trigger the external program then continue the rest of the code in ABAP.
    Best regards,
    Patrick

    Hi Uma,
    FYI, I've run a thorough test, it will run synchronously though it calls an external program.
    I shall take note of the obsolete FM.
    Many thanks,
    Patrick

  • Calling external program on application server

    Hi, everyone. I'm trying to call an external program from ABAP by using SM69 and FM SXPG_COMMAND_EXECUTE
    MOVE 'zlong_bat' to ld_comline.         "Maintained using trans SM69
    * Execute external command, contained in 'ld_comline'
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = ld_comline
    *           additional_parameters   = ld_param  "Params passed to script
    *           operatingsystem               = 'UNIX'
           IMPORTING
                status                        = ld_status
           TABLES
                exec_protocol                 = ld_output
           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 NE 0.
      ENDIF.
    In the  sm69, I define zlong_bat with
        Operating system command: cmd
         Parameters for operating system command: /c remoteconn.bat
    It can run well if remoteconn.bat contain some simple command of dos like dir, md, mk... But when I call a program from remoteconn.bat, the abap program hang. I also cannot test in sm69 because it hang too.
    If I call direcly from sm 69 with
         Operating system command: cmd
         Parameters for operating system command: /c  psexec.exe
    localhost -u test -p 1234
    or
         Operating system command: C:\psexec.exe
         Parameters for operating system command: 
    localhost -u test -p 1234
    The SM69 also hang.
    Are there any method to call a program from sap without hanging
    of course the program is in its position on application server.
    Thank you in advance.
    Regards,
    Long
    Edited by: dragonking88 on Aug 25, 2010 12:54 PM

    Hi Long Le Hoang,
    I am running a shell script fromSM69 which call psexec.
    shell script runs fine but SM69 execution goes on hold.
    Can you please help me how to terminate SM69 execution.
    Alpa

  • Calling external programs using labview

    I have a LV program running to collect and display data, but also need to call an external program while doing this. I have a menu set up where one button launches my system control .vi, one launches my data display .vi, but there is another feature that is handled by a program a co-worker has written. Is there a way that whenever a button is pressed, LV can launch an external .exe file? Basically, I just need LV to call the executeable... the program that is called will be terminated by the user.
    Jim

    Try function palette -> Communication -> System Exec.vi
    George Zou
    http://gtoolbox.yeah.net
    George Zou
    http://webspace.webring.com/people/og/gtoolbox

  • AIR-Calling External Program

    hi, i am making an AIR application and i want to execute an external program through this, or suppose that i want to call a java program on client machine, i don't want to have any server to do this, is there any way to do that ?, plz let me know
    With Regards
    Amar Deep Singh

    I think your only option might Merapi, and that might only be for linking AIR and Java apps.
    http://merapiproject.net/
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance
    www.ChikaraDev.com
    Flex Development, Training, and Support Services

  • Call external program without intermediate step

    When I call an external program (Nik Color Efex) a window opens asking me wether I want to continue with the image having all Lr stpes applied etc. How can I circumvent this "annoying" step and directly call the external program without interruption?

    Thanks, I understand that before transferring the file you need to do these preparations, but then the window shows up asking me wether I want to transfer the copy or the original...  I am looking for a mechanism to supress that screen.

  • FMS 4 FCUnpublish call external program

    Is it possible with server-side scripting for FMS to call an external program once a stream has been unpublished? Any links would be appreciated. Thanks.

    I've used the File Class from http://help.adobe.com/en_US/flashmediaserver/ssaslr/flashmediaserver_4.5_sslr.pdf to create a file each time an unPublish event is thrown. Then use an external program to monitor a directory where these log files get stored.
    Where there is a will there is always a way

  • Calling external program from PL/SQL

    Does anyone know whether it's possible to call an external program living outside of Oracle from PL/SQl eg. a from a stored procedure?
    Specifically i want to call back into my java appserver (ejb server) when a trigger/stored proc. is executed.
    The call does not have to be synchronous, some sort of queue will do - eg JMS??
    Any help greatly appreciated.
    null

    Hi
    Which version of oracle you are using.
    If it 8i, you can use external procedures/libraries. REfer to ORacle PLSQL documentation.
    If you are using Oracle 7+ you can use dbms pipes to post your command string and a cron job to read the pipe and execute the string.
    An alternate ugly way is to write to a file and some process reading the file at a regular interval.
    HTH
    Arvind Balaraman

Maybe you are looking for