BDC issue background and foreground

Hiii
i have already write bdc code using batch input. The data is taken from an excel file . 
How the program work now is it create a session in SM35 and i can decide to execute the session either in background or foreground. 
The reson why i did batch input and not call transaction is because i am told that with call transaction you can't execute batch input program in background since the excel file will be loaded from the user desktop.  With call transaction and background execution the file need to be loaded on server first and then take the file from the server to BDC tcode.
My problem is I need my program to execute automatically without passing though the SM35.  I also need to give the option to user to either execute is in foreground or background.
BDC code look this:
Call function "OPEN_BDC"
group = "ztest"  “I use constant
keep = "X'
perform dynpro
perform fillfield
call fuction "CLOSE_BDC"
1)     I am told to use the FM file_open / file_submit / file_close but I don’t really know hat parameter to pass in those FM the file_submit is giving me exception error.
2)     I tried to use submit program RSBDCSUB .  it create a session in sm35 and have status background job but the session haven’t executed
3)     All the No1 and No2 is to execute the BDC in background then what about the solution if user what to execute in foreground.
Please i need precise answer??

Job_submit is not functioning plzzz ess sample code below because of      invalid_jobdata                   = 3
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobgroup               = ‘Ztest’ //Session name in SM35
      jobname                = v_jobname
   IMPORTING
     jobcount               = v_jobcount
   EXCEPTIONS
     cant_create_job        = 1
     invalid_job_data       = 2
     jobname_missing        = 3
     OTHERS                 = 4
  IF sy-subrc <> 0.
  ENDIF.
  CALL FUNCTION 'JOB_SUBMIT'
    EXPORTING
      authcknam                         = sy-uname
      jobcount                          = v_jobcount
      jobname                           = v_jobname
     language                           = sy-langu
     report                            = sy-repid
  VARIANT                           = ' '
IMPORTING
  STEP_NUMBER                       =
   EXCEPTIONS
     bad_priparams                     = 1
     bad_xpgflags                      = 2
     invalid_jobdata                   = 3
     jobname_missing                   = 4
     job_notex                         = 5
     job_submit_failed                 = 6
     lock_failed                       = 7
     program_missing                   = 8
     prog_abap_and_extpg_set           = 9
     OTHERS                            = 10
  IF sy-subrc <> 0.
  ENDIF.
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
      jobcount                          = v_jobcount
      jobname                           = v_jobname
   sdlstrtdt                         = sy-uzeit
   sdlstrttm                         = sy-datum
   EXCEPTIONS
     cant_start_immediate              = 1
     invalid_startdate                 = 2
     jobname_missing                   = 3
     job_close_failed                  = 4
     job_nosteps                       = 5
     job_notex                         = 6
     lock_failed                       = 7
     invalid_target                    = 8
     OTHERS                            = 9
  IF sy-subrc <> 0. 
ENDIF.

Similar Messages

  • Location Heuristics-diff of results in background and foreground

    Hi,
    We have this weekly bacth job of location heu.. just one program. nothing preceding  and succeeding it.
    I find the results in background and foreground different. This is partcularly wrt the receipts being created before the lead time of the loc-product. In the foreground when i delete the same receipts..and re-run the location heuristics, the receipts are correctly created . i.e obeying the lead time.
    Questions:
    - Why does this happen. I am doing this without anytime gap.
    -Are there some settings that are called only in background (e.g from SNP global profile) but not in foreground.
    Let me know if you need to know my SNP global profile settings.
    The imporant ones are
    HEU: Init short qty = Bakward scheduling
    HEU: Order Update =Complete mode
    In the location product master- NO horizons and time fences are maintained for SNP and PPDS.
    Regards,
    Loknath

    Hi Loknath,
    I will try to explain in with simple example.
    Consider there is product xyz which exist at two different locations A & Location B.
    Procurement type:
    at A is Inhouse production
    at B is external procurement from location A.
    Both the location have some forcast/ Demand for the Product suppose 100qty each.
    1. First Sequence:  Now first the Heuristics needs to run at Location B so that there are Destribution receipts planned created  at Location B, In other words, the Demand of Product XYZ will get transferred to Location A in form of Distributed demand Planned.
    Now if you take run on Location A,
    The Total demand  at Location A will be 100 qty (forecast)+ 100qty( Distri.Demand from B)= 200qty  and the Heuristics run will  plan for the total requirement 200 qty and create the planned orders for it.
    2. Second sequence:  if you take heuristics at Location A first & than location B.
    The planned orders generated will be only for Demand at A i.e 100 as Location A is not yet aware of the Distributed Demand which needs to be satisfied for Location B. as you have not taken the run  on location B yet hence the demand is not yet transferred to Location A.
    now if you take  run at location B, the Distri. demand are generated to Location A but not planned or not satisfied.
    Overall you see the wrong results of heuristic if you adapt second sequence.
    So, it become neccesary to determine the right sequence in which the heuristic is taken for different product at different location. to determine this system use SNP low level codes.
    I guess you are aware of low level code in BOM, As without exploding the Parent Material demand you cannot plan exact demand on Child material. similar principle works over here just it applies to Location Products.
    Hope this helps
    Regards
    Kumar

  • Background and foreground colors can be interchanged using which command

    hi
    background and foreground colors can be interchanged using which command

    <b>Background and foreground colors can be interchanged using the command Format Inverse.</b>

  • BDC processing for background and foreground execution

    Hi,
    I've come accross a situation where in a BDC for sales order creation, creates one sales order and at the same time creates another sales order with a blank sales order number(but the data of both the sales order is identical), meaning it creates 2 sales orders. This only occurs when the BDC is processed in mode 'N' but it works fine when the BDC runs in mode 'A' and 'E'. Any idea as to why this could be happening?
    Any help will be appreciated.
    Thanks,
    ALAM.

    Hi Alam,
    No, sorry, I don't know why this is happening.
    What update-mode are you using? Asynchronous or Synchronous?
    Test both options, maybe it helps.
    Why are you not using BAPI_SALESORDER_CREATEFROMDAT2?
    Regards, Miranda

  • Execution of report in background and foreground

    Hi all,
    I have a report in which i have two radio buttons on selection screen.
    1, Foreground
    2. background
    could you please tell how to do foreground and background execution of report depends on user selection.if you could send some sample code its really helpful.
    thanks

    If the Background radio button is selected the you need to use the SUBMIT command to submit your program in background.
    Example
    Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately providing the user has the relevant authorization.
    DATA: number           TYPE tbtcjob-jobcount,
          name             TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    Cheers
    VJ
    Message was edited by:
            Vijayendra  Rao

  • [JTable] prepareRenderer() override and foreground selection setting

    Hello,
    I can't solve this problem :
    To get a JTable's cell blinking in different colors, I overrided the JTable's prepareRenderer() method : this works fine.
    "But", because there's always a butt, if I restore the cell default background and foreground color when I want the cell to stop blinking, I lose the cell selection foreground color. If I don't restore those colors, the cell selection foreground color (translucent blue) is kept, but cell background and foreground colors will remain in the last blinking state.
    Can you see why or should I submit it as a Java bug (I already read and followed other topics on cell blinking, but it doesn't cover this very point) ?
    Here is the problematic code snippet (to get this method called, I manually and regularly trigger a fireTableCellUpdated() in a thread). The alternative issue is commented in it :
            public Component prepareRenderer(TableCellRenderer renderer,int row,int column) {
                Component res;
                res = null;
                res = super.prepareRenderer(renderer,row,column);
                // conditions required to make the cell blink
                if(
                   (isRunningThreadNewLog) &&
                    (row == 0) &&
                    (column == 0)
                   (! isCellSelected(row,column))
                    res.setBackground(newItemColor[0][lastItemColorIndex]);
                    res.setForeground(newItemColor[1][lastItemColorIndex]);
                    lastItemColorIndex = (lastItemColorIndex + 1) % newItemColor[0].length;
                * Here is where the problem occurs :
                *  - if I build ans runs as it, cell selection foreground will be painted with the default translucent blue color, but cell background and foreground colors won't be reset
                *  - if I uncomment, build and run, ccell background and foreground colors will be paint, but cell forground will be lost, or exactly, it will be painted to the cell foreground color, not the cell selection foreground color
               else {
                    res.setBackground(defaultItemColor[0]);
                    res.setForeground(defaultItemColor[1]);               
                return res;
            }Thanks for help :)
    Edited by: Rockz on Mar 5, 2009 1:19 PM

    or should I submit it as a Java bugLets see, you write some custom code and it doesn't work the way you want it to, so it must be a Java bug?
    Did you ever think it might be a problem with your code?
    First of all, whats with all the brackets in the if statement? Why do you try to group the row and column test?
    So lets take a look at your code. You have 4 conditions. If any one of them fail then you will go into the "else" which automatically resets the foreground and background colors "even" if the isCellSelected() test is true.
    Basically, the isCellSelected should be a separate test. Maybe something like:
    if (! isCellSelected(...))
        if (isRunningThreadNewLog
        && row == 0
        && column == 0)
            // do something
        else
            // do something else
    }If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

  • Difference: Job run in foreground, job run in background and batch job

    Hi  Gurus,
    Can you please help me to know what are the differences between job run in foreground, job run in background and batch job? Do jobs in foreground run in presentation server? Do jobs in background or batch jobs run in application server?
    Thanks,
    Kumar

    foreground job running may cause job running crash or failed if it is too big or server is busy and it take too long time. meantime it will take one sap session.
    background job will run base on request server status. and it will not take your sap session. and it will not failed normally.
    and you can get the result by SM37.
    my experience show that big report run in background normally faster than in foreground.
    Edited by: JiQing Zhao on Sep 3, 2010 4:13 AM

  • Issue with Visibility Settings for Backgrounds and Layers

    I am using Acrobat Pro XI 11.0.10 (Windows) and having an issue with visibility settings for layers and backgrounds. I am attempting to get backgrounds to appear while viewing in Adobe Reader and Acrobat Pro but not be printed and so far have had no success.
    When using a background the Appearance Options dialogue has "Show when printing" unchecked, but "Show when displaying on screen" is checked. This results in the background not showing on the screen, and the background will only appear once the box for "Show when printing" is checked. It looks like the option for printing is dictating whether or not the background is able to appear.
    Using layers has not worked either. The background layer is set to "Never Prints", but will still show up when printed.
    I was wondering if anyone else has run into this and has a solution, or has any recommendations.
    Thanks in advance.

    Hi setrev2012,
    How are you adding the backgroud?
    The only way I can think to accomplish this is via a watermark.
    The basics...
    Open PDF in Acrobat. Choose Pages > Watermark > Add Watermark.
    Select a jpg or PDF of your background and adjust scaling options as desired.
    Then click the Appearance Options.. and uncheck the Show When Printing option.
    In this image the PDF is a blank page with the word "Test" on it. The watermark is the stamp and impression (a stock photo jpg).
    If you want a solid color background, just create a flat image of the background color for use as the watermark.
    If you have already followed the steps and still facing the issue then please share the file with me at [email protected] so that i can have a look.
    Regards,
    Rave

  • What is the difference between background job and foreground job

    Hi Experts,
    Could you pls tell me
    What is the difference between background job and foreground job
    and where exactly used background jobs...
    Thanks

    Hello,
    Background jobs - without user interaction, scheduled via SM37.
    Foreground jobs - with user interaction (transactions).
    For more information, please read these: [http://help.sap.com/saphelp_nw04/helpdata/en/e4/2adbda449911d1949c0000e8353423/frameset.htm], [http://help.sap.com/saphelp_nw04/helpdata/en/73/69ef5755bb11d189680000e829fbbd/frameset.htm] and [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/20cb0b44-8f0b-2a10-2381-ca8162bcb5b2].
    Regards,

  • Error while executing BDC in background.

    Hi
    I have written a program that creates a background job to execute a BDC on Transaction CKMPRPN. This transaction is used to update future price of Materials. When this program is executed in foreground it works perfect. But when it is executed in background it throws these error messages. Same error messages are displayed when I process the BDC recording in background.
    Enter at least one plant                                              
    Enter at least one plant                                              
    Spool request (number 0000023938 ) created without immediate output   
    No batch input data for screen SAPMSSY0 0120                          
    Can anyone tell me why this problem is occuring only during background execution?
    Or Do I need to find out a Function Module to update the future price of materials?

    Thanks Kris,
    Its a useful answer.. But unfortunately in 4.6C version we dont have this option of 'simulate background mode'.
    Anyways.. I was able to find the solution.. I used call transaction and executed the BDC program in background and it worked. Earlier I was executing a single transaction for set of materials. But now I m executing separate transaction for each material. It gives these messages at every execution but it also updates the database. Dont know how..

  • Bdc in background mode PA30

    hi,
         I facing issue in BDC for PA30, My BDC is working in foreground mode but not running in background mode. purpose of bdc is based on value of itab of previous day data update on next day in backgound.
    below code i m using in BDC :
    INITIALIZATION.
    ctu = 'X'.
    session = ''.
    nodata = ''.
    ctumode = 'N'.
    cupdate = 'L'.
    FORM processs_bdc_data .
      DATA: v_date LIKE sy-datum,
                  begda type pa9004-endda.
      DATA:
            endda(10) TYPE c,
            stime(5) TYPE c,
            etime(5) TYPE c,
            loaddat(10) TYPE c.
      SORT itab BY taskno pernr.
    LOOP AT itab.
        tabix = sy-tabix.
       begda = sy-datum.
          PERFORM open_group.
          PERFORM bdc_dynpro      USING 'SAPMP50A' '1000'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                                '=INS'.
          PERFORM bdc_field       USING 'RP50G-PERNR'
                                                 itab-pernr.
          PERFORM bdc_field       USING 'RP50G-TIMR6'
                                     'X'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                         'RP50G-SUBTY'.
          PERFORM bdc_field       USING 'RP50G-CHOIC'
                                     'Employee Task  Monitoring'.
          PERFORM bdc_field       USING 'RP50G-SUBTY'
                                        '1'.
          PERFORM bdc_dynpro      USING 'MP900400' '2000'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                     'P9004-ZZREMARK'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                     '=UPD'.
          PERFORM bdc_field       USING 'P9004-ZSTATUS'
                                     'NEW TASK'.
          PERFORM bdc_field       USING 'P9004-ZPRIORITY'
                                     'MEDIUM'.
         PERFORM bdc_field       USING 'P9004-ZPERNO'
                                       itab-zperno.
          PERFORM bdc_field       USING 'P9004-BEGDA'
                                        begda.
         PERFORM bdc_field       USING 'P9004-STIME'  '083000'.
         PERFORM bdc_field       USING 'P9004-ENDDA'
                                         begda.
          PERFORM bdc_field       USING 'P9004-ETIME'  '082959'.
         PERFORM bdc_field       USING 'P9004-MNDAT'
                                          begda.
          PERFORM bdc_field       USING 'P9004-TERMN'
          PERFORM bdc_field       USING 'P9004-ZZTASK'
                                   itab-zztask.
          PERFORM bdc_field       USING 'P9004-ZZREMARK'
                                   itab-zzremark.
         call transaction 'PA30' using bdcdata mode ctumode  update cupdate messages into
                                                                         messtab.
    PERFORM messages.
    PERFORM close_group.
    REFRESH : messtab, bdcdata.
      ENDIF.
      ENDLOOP.
    ENDFORM.                    " PROCESSS_BDC_DATA
      What can be the possible reasons for not updating in backoground mode pls sugess me.
    Thanks in advance
    tarun

    Try the following:
    Replace your code
    call transaction 'PA30' using bdcdata mode ctumode update cupdate messages into messtab.
    with
    DATA: gs_options TYPE ctu_params.     "BIM Processing options
    * Set processing options.
      gs_options-dismode  = 'N'.        "N (back) A (Fore) / E (Error)
      gs_options-updmode  = 'S'.           "Synchronous update
      gs_options-defsize  = 'X'.           "Default screen-size (for texts!)
      gs_options-racommit = 'X'.           "COMMIT WORK
    * Perform the transaction 'PA30'
      CALL TRANSACTION 'PA30' USING bdcdata
                           OPTIONS FROM   gs_options
                           MESSAGES INTO messtab.
    Edited by: Rob Postema on Sep 6, 2010 11:00 AM
    Edited by: Rob Postema on Sep 6, 2010 11:00 AM
    Edited by: Rob Postema on Sep 6, 2010 11:00 AM
    Edited by: Rob Postema on Sep 6, 2010 11:01 AM

  • Weird issue backgrounding "sudo vim"

    I'm having a strange issue backgrounding vim when executed using sudo. I'll try my best to explain it, because I'm stumped. When I attempt to foreground the process, the console draws the vim interface, but as soon as I type, the process is backgrounded again. I've ruled out my user's .vimrc/vim directory, as well as the type of terminal I'm using (tested in VT, rxvt-unicode, and XFCE terminal).
    I appreciate any insight anyone may have regarding this, it's driving me nuts because this worked on my system a month ago.

    Look at the "-e" argument, or the sudoedit command. The manpage states that when using this argument/command, the environment should remain unmodified, but the problem persists. Again, I can confirm that I used this heavily on my Arch system in the past, and can also confirm that it works using my Debian server (which is using software from their testing repository).
    Thanks for the input either way .

  • Running BDC in Background

    Hi all,
            I'm working on ECC 6.
            Whenever I'm scheduling a BDC in background, it is not running, whereas the same is working perfectly in foreground.
            What can be the reason?
            Can anybody guide me?
    Regards
    Vamsy

    hi,
    there can be various reasons.
    Please check whether you are using the file on presentation server or application server. In background processing  the function modules GUI_UPLOAD etc will not work. You need to put the file on application server.
    Check whether you are giving file with data or empty file.
    Create a variant in the program and While creating background job mention the variant name there.
    Is it showing any errors ? if so please mention them .
    Thanks and regards.

  • My lock screen just shows a black background and a User Name/Password dialog after opening the screen from sleep. How do I get it back to where it blurs my desktop image with the dialog and my account image displayed?

    I'm not sure when it began, but now my Macbook Air only shows a black background and a User Name and Password dialog box when I wake it from sleep. It used to show my desktop background blurred with my user name and icon displayed with only a text field for entering my password. I'm currently using Yosemite (OS X 10.10.1) and all updates have been done. Any help or suggestions would be greatly appreciated as I know this isn't a real problem, just an annoyance since I couldn't find how to change it back in the System Preferences.

    I just have to point out that after looking at a related post (https://discussions.apple.com/message/22661092#22661092), it brought to memory that my issue most certainly began happening after I added some DoD certificates to the keychain. This obviously has something to do with it, but it still leaves me wondering what actually causes this to happen. :/

  • Document not posting through F-02 BDC in background.

    Hi,
    While trying to post park documents for a company code through F-02 using BDC in background mode N, when any single document is having any error then all the documents for that company code are going in error state and not getting posted.When checked in debug mode for the error document, it is showing the Profit center field is not present on screen at BDC whereas the profit center field is actually passed and is present.Please advise.
    Edited by: rohan.das on Dec 20, 2011 2:40 PM

    There is a POP-Up window in the process, that is not coming in background. identify that screen no and not pass any data, another option is pass OK_CODE for that particular screen.
    Hope it's might be useful for you.
    Thanks,
    Prarthan

Maybe you are looking for