Running bapi in back ground

hi all,
i had to upload material master basic view, iam updating using bapi,
i want to run this program in background. i am getting problem wen calling bapi. its not executing this bapi.
wen i run the same program its working fine.
could any body help me in this regard
below is the code
*& Report  ZTEST_BAPI_BASIC
report  ztest_bapi_basic.
types : begin of ty_mara,
        matnr type mara-matnr,
        mbrsh type mara-mbrsh,
        mtart type mara-mtart,
        meins type mara-meins,
        maktx type makt-maktx,
        end of ty_mara.
data: begin of it_makt occurs 0.
        include structure bapi_makt.
data end of it_makt.
data:begin of it_ret occurs 0.
        include structure bapiret2.
data end of it_ret.
data : t_mara type standard table of ty_mara,
       st_mara type ty_mara.
data: bapi_head like bapimathead,
      bapi_clientdata like bapi_mara,
      bapi_clientdatax like bapi_marax.
selection-screen : begin of block b1 with frame title text-001.   "SELECTION SCREEN
parameters: p_fnam like rlgrap-filename.
selection-screen : end of block b1.
at selection-screen on value-request for p_fnam.
  call function 'F4_FILENAME'                              "FUNCTION MODULE TO LOCATE THE FILE ON THE DISK
    exporting
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
      field_name    = ' '
    importing
      file_name     = p_fnam.
start-of-selection.
  perform upload.
  perform bapi.
*&      Form  UPLOAD
      text
-->  p1        text
<--  p2        text
form upload .
  data : filename type string.
  filename = p_fnam.
  call function 'GUI_UPLOAD'
    exporting
      filename                      = filename
     filetype                      = 'ASC'
     has_field_separator           = 'X'
   HEADER_LENGTH                 = 0
   READ_BY_LINE                  = 'X'
   HEADER                        =
    tables
      data_tab                      = t_mara
EXCEPTIONS
  if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
endform.                    " UPLOAD
*&      Form  BAPI
      text
-->  p1        text
<--  p2        text
form bapi .
  sort t_mara by matnr.
  loop at t_mara into st_mara.
    perform conversion using st_mara-matnr changing  st_mara-matnr.
    bapi_head-material = st_mara-matnr.
    bapi_head-ind_sector = st_mara-mbrsh.
    bapi_head-matl_type = st_mara-mtart.
    bapi_head-basic_view ='X'.
    bapi_clientdata-base_uom = st_mara-meins.
    bapi_clientdatax-base_uom = 'x'.
    refresh it_makt.
    it_makt-langu = 'E'.
    it_makt-matl_desc = st_mara-maktx.
    append it_makt.
    clear it_ret.
    refresh it_ret.
    perform update_bapi  using bapi_head
                                     bapi_clientdata
                                     bapi_clientdatax .
    read table it_ret with key type = 'S'.
    if sy-subrc eq 0.
      commit work.
    else.
      call function 'BAPI_TRANSACTION_ROLLBACK'
              IMPORTING
                RETURN        =
    endif.
  endloop.
endform.                    " BAPI
*&      Form  CONVERSION
      text
     -->INPUT      text
     -->OUTPUT     text
form conversion using input changing  output.
  call function 'CONVERSION_EXIT_ALPHA_INPUT'
    exporting
      input  = input
    importing
      output = output.
endform.                    "conversion
*&      Form  update_bapi
      text
     -->BAPI_HEAD         text
     -->BAPI_CLIENTDATA   text
     -->BAPI_CLIENTDATAX  text
form update_bapi  using bapi_head bapi_clientdata  bapi_clientdatax .
  call function 'BAPI_MATERIAL_SAVEDATA' in background task as separate unit
    exporting
      headdata                   = bapi_head
     clientdata                 = bapi_clientdata
     clientdatax                = bapi_clientdatax
  FLAG_ONLINE                = ' '
  FLAG_CAD_CALL              = ' '
  NO_DEQUEUE                 = ' '
  NO_ROLLBACK_WORK           = ' '
  importing
     return                     = it_ret
   tables
     materialdescription        = it_makt
  append it_ret.
endform.                    "update_bapi
regards
siva

Hi,
I'm a bit confused now - does the BAPI call work if you run it entirely in foreground or does it fail there too?
You need to ensure your BAPI works correctly with the data you are passing to it - preferably in foreground so you can debug it and see what is happening.  If it throws errors there then add them to this thread.
If it works in foreground then you probably need to schedule the job in background but as others have pointed out, you can't use the GUI_UPLOAD function to do this.
Gareth.

Similar Messages

  • How do I turn off programs running in the back ground on my iPad

    How do I turn off apps running in the back ground with the new update

    How to Close Apps
    Double Tap the Home Button... Then swipe the App (not the icon) Upwards... Tap the Home Button when finished.
    From Here  >  http://support.apple.com/kb/HT4211

  • Firefox is running in the back ground, how can I turn it off to reinstall it?

    I tried to get into the save mode but Firefox still will not come up. I have uninstalled the program and reinstalled and still I can not get Firefox to come up on the screen. But when I shut down my computer it says it is running. It must e running the back ground. Please help me get Firefox working again. I think this is a Mozilla Problem because I did not install addons, etc.

    It is possible that your security software (firewall, anti-virus) blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full, unrestricted, access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    *https://support.mozilla.org/kb/fix-problems-connecting-websites-after-updating

  • Want commands running in the back ground in sql developer

    HI all,
    I am new user to oracle sql developer. i started using it and found interseting. It is very easy just using the GUI interfaces. what ever i need to do i can do using the GUI interfaces instead of using commnads. makes my work easier. BUt there starts my concern
    if i continue to use the tools one day i will not know the commands which are executed actually.
    Is there any way throught which i can look what every that commands or queries that are executed in the back ground for my instruction in the foreground

    Hi,
    If you truly wish to see all the SQL and PL/SQL executed for a given connection, you can try the following:
    1. Tools -> Monitor Sessions...
    2. Select a connection for a user with appropriate privileges (e.g., must be able to run DBMS_MONITOR)
    3. In the list of sessions, right-click on a session of interest, select Trace Session and click Apply
    4. After completing the desired activity on the connection of interest, close the connection.
    5. Open the trace file in SQL Developer (File -> Open, or drag and drop it) -- make sure the Filter drop-down is set to All -- to see the SQL.
    6. Pick one of the four tabbed views of the trace file data: List, Tree, Statistics, History
    Step 5 is easy if the DB is local. For example, with Oracle 10g Xe on Windows, look for the most recent trc file in a directory like
    C:\oraclexe\app\oracle\admin\XE\udumpFor a remote DB you would need to copy the trc onto a shared network drive or ftp it to your local machine.
    If you just wish to see DDL commands as you manipulate DB object definitions from the Connection Navigator tree or the Object Viewer Actions list, the UI usually provides a SQL tab so that you may view the SQL before clicking the Apply button.
    Hope this helps,
    Gary
    SQL Developer Team

  • How do I turn off programs running in the back ground  for iOS7?

    How do i turn off programs running in the background using iOS 7?

    *iOS 7 closing running apps*
    Double-tapping the Home button will bring up the running apps icons along with an app screenshot "card" above the icon. Tap-drag the app's -card- (NOT the icon) up and off the screen.

  • Anyone having or had a problem with kernel_task running uploads in back ground and can't figure out what its doing

    My iMac is running kernel_task and using a lot of upload bandwidth. I talked to isp this morning he said that I was topping out on the upload side while download was normal. He also said that it started about 3 weeks ago but I've been looking and trying to remember what I did as far as installing or changing setting and I can't figure it out, also using a magicjack on computer but tried without it and still the same and its hard to use the phone when other party only gets every other 4 or 5 words. HELP PLEASE!! driving me crazy.

    You have something that is uploading data from your network, so you may have a runaway application doing this. If you quit all your running applications does the problem still exist? If so then you may have a corrupted system process.
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Create a new user account with admin status, then log out of your account and log into the new account. Does the problem still exist?
    Also, try basic repairs:
    Repair the Hard Drive and Permissions - Lion/Mountain Lion
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported then click on the Repair Permissions button. When the process is completed, then quit DU and return to the main menu. Select Restart from the Apple menu.

  • Procedure to run program in back ground and foreground.

    Hi  All,
    What is the procedure to execute for a report program to execute regulrly e.g daily as background job?
    Also it can be executed manually in foreground.
    Please help its urgent.
    Thanks in advance,
    Amruta

    Hi,
    Follow below steps.
    1. Goto SM36--Give Your first Job Job1, Choose Job class
    2. Click on Step, give the Program name and Variant. Come back to main screen.
    3. Click on start Condition then a Popup will be displayed. There click on Date/Time. below you can see Period values there choose Daily, hourly etc.
    4. then Save.
    <REMOVED BY MODERATOR>
    Regards,
    Ashok
    Edited by: Alvaro Tejada Galindo on Feb 18, 2008 1:59 PM

  • \Running program in back ground

    Hello,
       I want to run a program a particular time. how can i do it?. Please send me some doc's regarding this please to [email protected]
    regards
    SDN powered

    Hi,
           You can do this through SM36 transaction.
    SM36 -> specify job name ( any name ) ->
    Click the start condition -> select the option you require
    -> if you want the job periodic click the periodic job flag -> click the radio button periodic values and select frequency
    -> save the dialog screen
    ->click on step ->Provide the program name and if any variant ->check and save the screen
    -> Finally again save the main screen -> Your job will now be scheduled.
    To monitor just click on Job selection. or go directly through  SM37
    Regards,

  • Field missing when running the KSB1 transaction in Back ground

    Hi,
    With the help of  Zreport am executing the KSB1 transaction in back ground and after execution of KSb1 am retrieving the report output and am displaying.
    Issue is when am running Zreport in back ground the the output of KSB1 is giving the output by hiding the last column, where as am running Zreport in foreground the output of KSB1 giving the output with out hiding last field. Please guide me why the variance is coming in output when am running the Zreport in background........ and please advise me to rectify the problem....

    In background it cant be displayed if report width is more than 255 chars. Check line size.
    Satya

  • Back ground running of Standard reports

    Hi,
    I have some requirement in report processing. I need to run(in back ground) statndard structure reports for project def, WBS and activities and CM51 and CJI3. Then output should be saved in predefined folder in an excel format. The whole process of running and saving the report should be automated. And this job has to be run every night.
    I have checked the option of running in back ground for structure reports but variant selection and saving in destination folder should be automated. I could not find the option of running CM51 in back ground.
    Appreciate help in this regard
    Regards,
    Laxminarsimha

    You can try running of the program in the background - you will need to create a background job with the correct selection and display variants.
    Go to SE93 and check the program
    e.g. from SE93 enter CJI3 you will see the program is RKPEP003
    now create a background job for this program with correct variants
    Do the same for the other transaction

  • ALV Grid in back ground

    Hi friends,  i got some problem in alv grid while i am running it in back ground.
      my report contains some currency(amount)  field in out put. when i am removing the amount field it is good result in back ground. but when it consist of amount field it is giving error. it indicating some string length problem. and error analysis as follows.
    Error analysis
    In statement
       "STRLEN( obj )..."
    the argument "obj" can only take a character-type data object.
    In this case, the operand "obj" has the non-character type "P".
      pls tell me can't we run amount field in back ground. if  s  how to solve my error. pls give me some ideas.
                                      Kumar.

    Hi
    Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user won’t have the actual Grid interface but the List interface.
    There is a workaround to display ALV Grid in Background Job. The only restriction is you can’t schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
    The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesn’t have to go to SM37 to view the job status/log. Once the Job Status is changed to “COMPLETED”, user can click on “DISPLAY SPOOL” to view the ALV Grid.
    /people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

  • AMOUNT IN BACK GROUND

    Hi friends, i got some problem in alv grid while i am running it in back ground.
    my report contains some currency(amount) field in out put. when i am removing the amount field it is good result in back ground. but when it consist of amount field it is giving error. it indicating some string length problem. and error analysis as follows.
    Error analysis
    In statement
    "STRLEN( obj )..."
    the argument "obj" can only take a character-type data object.
    In this case, the operand "obj" has the non-character type "P".
    pls tell me can't we run amount field in back ground. if s how to solve my error. pls give me some ideas.
    Kumar.

    Hi,
         Refer the below theard and see the answer of <b>Charles Folwell</b>
    https://forums.sdn.sap.com/click.jspa?searchID=4021002&messageID=209473
    <b>Reward points</b>
    Regards

  • Hi regarding back ground jobs

    I have a report which is scheduled to run 2 times in the background.
    here i am using OO ALV when to display output when run in back ground.
    but i am getting an error when the same report is run in the back ground, stating there is a problem with the object references.
    but one of my friend tried it and is successful to run in the background but another problem, when run in foreground 10 records are displayed and when run in background only 2 records are displayed for the same criteria.in both the cases i am sending the output to the file on appl server.
    pls help me its urgent.
    pionts are assured.

    Ravi,
    I have faced the same problem when I schedule the job in background.
    When the report was run in forground, it gives expected results, and when it run in background, it will supress some fields and disply the report output.
    This problem, I have debugged it and corrected, and its application specific I can say, cant conclude it  by seeing the problem, needs to do much research and fix it up.
    Regards,
    Sujatha.

  • Need to restrict Print out in back Ground Job

    Hi all,
    The T.Code COHVPI  will use for mass processing of Relealse process order. It the same time it will give print out for all process orders which are successfule change status to REALEASE status.Presently it is running forground Job , it is givind print out for process order shopfloor paper.
    NOw Client wants to run in Back gorund for tcode  COHVPI  , But it is running fine. But Clinet does not want print outt when it runs in the back ground. After my analysis , we can restrict print out with SY-batch eq 0 in the print program of Forms.
    But the process order status is changed to with Print out happend in the user status .
    Now i need to restict to change to status of PRINT OUT of process orders.
    Let me know i can i achive this requirement.
    Thanks in Advance,
    Regards,
    JBR

    Hi,
    Thanks for quick reply.
    We need restict this status only if tcode COHVPI runs inn Back gorund.Remaining cases it needs to be working as of now is fine.
    Is there any way to restict through code?
    Thanks& Regards,
    JBR

  • Back ground process

    Hi all,
    I want to run a java program in the background . Yet it should display the results in the foreground itself. In my foreground I have another program runnig. But if I call a function from there the control will be transfered to there na? But I should be able to continue with my current program yet the other program should also run in the back ground. Can I use System command to do so? I tried to execute the following system command from my current program :
    nohup backgroundprogram &
    It is compiling correctly but exiting on running without showing anything.
    Please help me.
    Regards,
    Cochu.

    Use Runtime run = Runtime.getRuntime().exec(....); This should be executed in a separate Thread so you don't block the current application.
    In anticipation of you next question, search the forum, there are plenty of examples of how to use the Runtime class.

Maybe you are looking for