BAPI_DOCUMENT_CREATE2 fails in Background

Hi everyone,
I wrote an ABAP-report calling BAPI 'BAPI_DOCUMENT_CREATE2'.
This ABAP has to create a document and upload files per FTP into DMS (Checkin)
Works Online fine (cause the BAPI avoids FTP as a GUI is online available)  but miserably fails in background:
Message: RFC callback calls are not allowed in the ABAP...
This message comes from a failed call of the FM 'SYSTEM_START_REG_SERVER'
in the FM  'CV120_FTP_START_REG_SERVER' as described in an old thread (Error in Check in of Originals by BAPI In background)
Sample of the BAPI-call:
  CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
    EXPORTING
      documentdata         = documentdata
      pf_ftp_dest          = 'SAPFTPA'
    IMPORTING
      documenttype         = documenttype
      documentnumber       = documentnumber
      documentpart         = documentpart
      documentversion      = documentversion
      return               = return
    TABLES
      documentdescriptions = documentdescriptions
      objectlinks          = objectlinks
*      documentstructure    = documentstructure.
*      documentfiles        = documentfiles
*      documentstructure    = documentstructure.
      documentfiles        = documentfiles.
I tried a lot, even in 2 steps (first create the doc per BAPI, second checkin per call of CVAPI_DOC_CHECKIN)
but in everycase, i always get the same problem...
Any help will greatly be appreciated : i daily and manually (ok, even if 1 report launch per day is sufficent) have to upload aprox.
2000 PDFs ...
Thanks in advance for answering...
Edited by: Guillaume Delorme on May 5, 2010 11:08 AM

Hi everyone,
Due to holidays, i gotta  post under another account...
There was a logical mistake in my problem:
-> i thought i had to do the physical checkin of the files while or after the BAPI_DOCUMENT_CREATE2-call.
In my case, the content-server is reachable from the app-server as it's been defined in the AL11.
The content-server is directly defined in table TDWD with complete directorypath as a vault-server (NO DVA-VAULT).
The SAP-FBs do actually handle two cases for file-checkin that can suit my concern::
-> DVA-Vault?->FTP-Connect for filetransfer
-> No DVA-Vault? ->Local GUI-Upload  for filetransfer
For background-processing fails always the GUI-Upload -> normal
I don't use any DVA-Vault -> i must do something else.
Solution: Ridiculously easy...
*-> FIRST :Physical Checkin over a stupid TRANSFER DATASET for the file.
*If OK:
*->SECOND: Call of  BAPI_DOCUMENT_CREATE2 with reference to the transferred File
*      ->Structure BAPI_DOC_DRAW2:
*          -> Short Dataname in BAPI_DOC_DRAW2-docfile1
*          -> Datacarrier in BAPI_DOC_DRAW2-datacarrier1 (actually the key for the VAULT-server)
*          -> App.type in BAPI_DOC_DRAW2-wsapplication1.
*          -> Description, Documentype, username, laboratory are must-fields with my customizing too.
*       ->Internal Table BAPI_DOC_FILES2:
*          -> Short Dataname in BAPI_DOC_FILES2-docfile
*          -> Datacarrier in  BAPI_DOC_FILES2-storagecategory (actually the key for the VAULT-server)
*          -> App.type in BAPI_DOC_FILES2-wsapplication.
*          -> no other fields required for this table
*       ->(...)
*endif.
Now it runs fine every 5 minutes and i handle about 3000 documents a day...
I give points to Phillip van den Heever who reminded me the AL11-Setting and i mark this topic solved as soon as i can...
Thanks to everyone and greets,
Guillaume Delorme

Similar Messages

  • BAPI_DOCUMENT_CREATE2 failed in background

    Hi experts,
    when i using this BAPI to create document, it works fine if executed on line. but when executed in background, it failed saying that 'Error while checking in and storing: &'.
    the file is already on the application server like:
    Erpr3d11\apps\SAP\PM\IMAGE\abc.jpg
    can anyone help me? thanks a lot in advance!

    Hi Wei,
    as you have marked this question as solved, I would kindly ask you to post if you have found a suitable solution for your requirement and how it was realised. This will help all other forum users to get similar issues solved too.
    Best regards,
    Christoph

  • External commands fail in Background Jobs on Application server

    Hi,
    We are having problems with jobs that include External Commands. The jobs run successfully if on the Central Instance. But if they run on either of the two Application Server's it fails with 'Unable to connect to Target Host' error message.
    I can run the External Commands from SM49 on both AS's. But as soon as its run in background it fails.
    I have read the rfcexec.sec file needs to be in the .\work directory on the application so I have this in place.
    This is what gets written to dev_w0 when the failure occurs :
    M  *****************************************************************************
    M  *
                                                                                    M  *  LOCATION    SAP-Gateway on host <APP_SERVER> / sapgw75
    M  *  ERROR       timeout during allocate
    M  *
                                                                                    M  *  TIME        Fri May 30 11:20:34 2008
    M  *  RELEASE     640
    M  *  COMPONENT   SAP-Gateway
    M  *  VERSION     2
    M  *  RC          242
    M  *  MODULE      gwr3cpic.c
    M  *  LINE        1795
    M  *  DETAIL      no connect of TP sapxpg from host <CENTRAL_INSTANCE.domain>
    M  *              after 22 sec
    M  *  COUNTER     483
    M  *
                                                                                    M  *****************************************************************************
    M
                                                                                    A  RFC 1446  CONVID 48742194
    A   * CMRC=27 DATA=0 STATUS=0 SAPRC=242 ThSAPECMINIT
    A  RFC> ABAP Programm: SAPLCRFC (Transaction: )
    A  RFC> User: <USERNAME> (Client: 300)
    A  RFC> Destination: %_TCPIP_%1 (handle: 2, , )
    A  RFC SERVER> RFC Server Session (handle: 1, 48741194, {C4A35AF0-2F4C-4E36-98C3-9999A6FE99D7})
    A  RFC SERVER> Caller host: iblonc4306_P75_75
    A  RFC SERVER> Caller transaction code:  (Caller Program: RSBTCXPG)
    A  RFC SERVER> Called function module: SXPG_STEP_COMMAND_START                                
    I'd really appreciate any suggestions on how to fix this issue??
    Thanks,
    Kye

    Hi Siddhesh,
    Thank you for your prompt response. I'm confident all of the prerequisites are set correctly.
    I have enabled the trace on SAPXPG but its only writing to the log dev_cp and dev_xpg when the command is executed successfully.
    For example, if I use SM49 to run the External command from one of the Application Servers dev_cp & dev_xpg  are updated and the command completes successfully. However if I run the job (that has the external command as a single step) from SM37 it fails and doesn't log anything to dev_cp or dev_xpg??
    Is this normally how the trace would work?
    Thanks again,
    Kye

  • FORM USEREXIT_PRICING_PREPARE_TKOMP in RV60AFZZ fails in Background

    Hi all,
    In Include RV60AFZZ , I have added my code in
    FORM USEREXIT_PRICING_PREPARE_TKOMP to Deactivate Condition types for FPD process . I activated the code. Now when I create a delivery doc (via Vf01), it gets created and saved if I do it in the fore ground, but it fails if I schedule it as Back ground job. Is this because the Include doesnt have the SAVE_DOC User exit.Please elaborate if you have any suggetsions as to why it is failing in the Background and what will be the other options to make it work in the Back ground.
    Thanks,
    Raj

    The parent prog of RV60AFZZ. is SAPLV60A.(Pl do check it)
    in the sample given we are basically accesing a variable from another program in memory and getting its value via our local field symbol <fs>
    if we take program SAPLV60A. then it will be:
    field-symbol <fs> type any.
    data myfield_name(40) type c value '(SAPLV60A)VBRPVB'.
    assign (myfield_name) to <fs>.
    now move like this:
    MOVE <fs>-ZZKVGR6 TO TKOMK-ZZKVGR6.
    this way <fs>-ZZKVGR6 will have the value which is in VBRPVB-ZZKVGR6 .
    hope you understood.
    but as happens with field symbols this can onl be checked at run time only.
    regards.

  • FTP connection failed in background

    Hi Folks,
        I'm connecting from SAP system to a FTP server using the FTP program. When I'm connecting to the FTP server through the RFC destination SAPFTP its working fine i can connect to the server however I have to run the program in the background mode so I cannot use the SAPFTP rfc destination as it can run only on the foreground so in my case I'm using the RFC destination SAPFTPA as this is the RFC destination which can be used in the background mode.
    The problem arises here when I'm using SAPFTPA in place of SAPFTP as I have to run the program in background. When I'm using the RFC dest SAPFTPA I'm getting an error saying "Attemp To Set Up Connection To 179.65.23.203 Failed" however the connection is successful when the RFC dest SAPFTP is used.
    Please provide your valuable inputs.
    Regards,
    Santosh

    You may need to write a small utility and runs in background and check
    report zaRs message-id 04 line-size 132.
    tables: rfcdoc.
    data: rfc_mess(132),
    call function 'RFC_PING' destination 'SAPFTPA'
      exceptions
        system_failure        = 1  message rfc_mess
        communication_failure = 2  message rfc_mess.
    if sy-subrc ne 0.
      write: / 'Errors', rfc_mess.
    endif.

  • Submit rfbibl01 fails in background as 'LIST_FROM_MEMORY'  raising exceptio

    Hi All,
    I have a requirement where I submit "rfbibl01" in a custom program. The program works fine in foreground. Below is the code I am using for foreground run. The list output of rfbibl01 is being written to memory using the below submit statement and then read using FM 'LIST_FROM_MEMORY' into an internal table. This internal table is being used for further processing.
        SUBMIT rfbibl01 WITH  ds_name   =   v_filetemp
                        WITH  fl_check  =   v_fl_check
                        WITH  os_xon    =   ''
                        WITH  xnonunic  =   ''
                        WITH  callmode  =   'C'                   
                        WITH  max_comm  =   '1000'
                        WITH  pa_xprot  =   ''
                        WITH  anz_mode  =   'N'
                        WITH  update    =   'S'
                        WITH  xpop      =   ''
                        WITH  xlog      =   'X'
                        WITH  xinf      =   ''
                        EXPORTING LIST TO MEMORY AND RETURN.
        CALL FUNCTION 'LIST_FROM_MEMORY'
          TABLES
            listobject = i_memory_list[]
          EXCEPTIONS
            not_found  = 1
            OTHERS     = 2.
        IF sy-subrc <> 0.
          Error  'List not Found' .
        ENDIF.
    The same code gives exception for FM 'LIST_FROM_MEMORY', when run in background. The submit statement is successfull, but the FM raises error message and so the background processing is stopped.
    I have tried changing my code for background mode as below.
        CONSTANTS: c_job    TYPE tbtcjob-jobname VALUE 'ZFXL_56632_GL_ALINEA_SUB',
                   c_kind      TYPE c VALUE 'P',
                   c_sign      TYPE c VALUE 'I',
                   c_dest(8)   TYPE c VALUE 'HPMISPRT',
                   c_true      TYPE c VALUE 'X',
                   c_option(2) TYPE c VALUE 'EQ'.
        DATA: v_jobcnt     TYPE tbtcjob-jobcount,
              v_desc(200)  TYPE c,
              l_release(1) TYPE c.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = c_job
          IMPORTING
            jobcount         = v_jobcnt
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        DATA: print_parameters TYPE pri_params,
              archi_parameters TYPE arc_params,
              valid_flag(1) TYPE c,
              v_spono TYPE sy-spono.
        TYPES: BEGIN OF t_tsp01,
                 rqident   TYPE tsp01-rqident,
                 rqcretime TYPE tsp01-rqcretime,
               END OF t_tsp01.
        DATA i_tsp01 TYPE STANDARD TABLE OF t_tsp01.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            layout                 = 'X_65_132'
            line_count             = 65
            line_size              = 132
          IMPORTING
            out_parameters         = print_parameters
            out_archive_parameters = archi_parameters
            valid                  = valid_flag
          EXCEPTIONS
            invalid_print_params   = 2
            OTHERS                 = 4.
        IF valid_flag <> space AND sy-subrc = 0.
        Submit program in background to transfer log
          SUBMIT rfbibl01 WITH  ds_name   =   v_filetemp
                            WITH  fl_check  =   'X'                  " v_fl_check
                            WITH  os_xon    =   ''
                            WITH  xnonunic  =   ''
                            WITH  callmode  =   'C'
                            WITH  max_comm  =   '1000'
                            WITH  pa_xprot  =   ''
                            WITH  anz_mode  =   'N'
                            WITH  update    =   'S'
                            WITH  xpop      =   ''
                            WITH  xlog      =   'X'
                            WITH  xinf      =   ''
                         EXPORTING LIST TO MEMORY AND RETURN
                            VIA JOB c_job
                            NUMBER v_jobcnt
                            TO SAP-SPOOL
                            SPOOL   PARAMETERS print_parameters
                            ARCHIVE PARAMETERS archi_parameters
                            WITHOUT SPOOL DYNPRO
                            WITH destination = c_dest
                            WITH immediately = 'X' "space
                            WITH keep_in_spool = c_true
                            AND RETURN.
          COMMIT WORK.
          SELECT rqident RQCRETIME
          FROM tsp01
          INTO table i_tsp01
          WHERE rqowner EQ sy-uname.
            v_spono = sy-spono.
          ENDIF.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount                          = v_jobcnt
              jobname                           = c_job
    IMPORTING
      JOB_WAS_RELEASED                  =
           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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    But I do not see any spool number generated. My requirement is to use this spool number, job name and job number to get the list that is written to the spool and then do some processing on it.
    Can anyone suggest me how to solve this issue?
    <b><REMOVED BY MODERATOR></b>
    Thanks,
    Deepthi
    Message was edited by:
            Alvaro Tejada Galindo

    Hello Deepthi,
    Check whether the report is displaying ALV grid when it  is executed in bacground.
    Since when the report displays ALV grid then u can't export the list to memory from ALV grid.
    Regards,
    Vasanth

  • Email sent successfully in foreground,but fails in background

    Dear All,
    On Tcode FBL5N, i have an option to send the account statement to specific customers.
    the issue i am facing is happening only to ONE customer ABC
    when the program is scheduled to run as a batch, tONLY his customer ABC alone does not recieve the SOA(stmnt of Account)
    But when the prgram is run in foreground, the email is successfully sent.
    This happens only to this particular customer.
    Kindly thorw some light on this.
    Regards,
    SuryaD.

    Hi ,
    You can try with debugging your job.
    Please follow the below processu2026.to debug the back ground job.
    1. Use SM37 to get list of jobs , type 'JDBG' in the command line ( no '/' ), put the cursor on the job and press ENTER
    2. You are in debug mode now. Step through SAP program (press F7 couple of times) until you get to code you need.
    Regards,
    Lokesh

  • Background job fails for BDC profile creation and role assignment

    Hi Experts,
    I have created a BDC Function module for Tcode 'PFCG' for profile creation and role assignment, and called this FM in my zprogram. the problem is that when i run this program in foreground it executes succesfully, but if i schedule it in background it fails throwing error in job log 'Role 'Z...' does not contain any active authorizations'. But i have created one more program to create authorization objects which runs before this zprogram.I have also checked the authorization object in 'RSECADMIN', it reflects active. I dont understand whats happening exactly when it runs background.
    Below is the process of job
       1. ZMIS_AUTH_OBJECT_CREATE
           Variant : auth-create
       2. ZMIS_AUTH_ASSIGN_TO_ROLE
           Variant : auth-assign
    The problem is in second program, runs in foreground but fails in background.
    Code which i have written in my second program
    ***BDC for Profile creation and assignment to Roles
        CALL FUNCTION 'ZROLE'
          EXPORTING
           ctu                     = 'X'
           mode                    = p_mode
           UPDATE                  = 'L'
    *   GROUP                   =
    *   USER                    =
    *   KEEP                    =
    *   HOLDDATE                =
           nodata                  = '/'
            agr_name_neu_001        = wa_role-role_name
            text_002                = wa_role-desc
            text_003                = wa_role-desc
            text_004                = wa_role-desc
           value_01_005            = 'T-ML330881'
            h_fval_low_01_006       = wa_role-auth
            profn_007               = lv_profile
            ptext_008               = lv_text1
    * IMPORTING
    *   SUBRC                   =
         TABLES
           messtab                 = temp_message.
    ***Generation of Profile created
    CALL FUNCTION 'PRGN_AUTO_GENERATE_PROFILE_NEW'
         EXPORTING
           activity_group                      = wa_role-role_name
    *     PROFILE_NAME                        =
    *     PROFILE_TEXT                        =
          no_dialog                           = ' '
          rebuild_auth_data                   = ''
          org_levels_with_star                = ' '
          fill_empty_fields_with_star         = 'X'
          template                            = ' '
          check_profgen_tables                = 'X'
          generate_profile                    = 'X'
          authority_check_pfcg                = 'X'
       EXCEPTIONS
         activity_group_does_not_exist       = 1
         activity_group_enqueued             = 2
         profile_name_exists                 = 3
         profile_not_in_namespace            = 4
         no_auth_for_prof_creation           = 5
         no_auth_for_role_change             = 6
         no_auth_for_auth_maint              = 7
         no_auth_for_gen                     = 8
         no_auths                            = 9
         open_auths                          = 10
         too_many_auths                      = 11
         profgen_tables_not_updated          = 12
         error_when_generating_profile       = 13
         OTHERS                              = 14  .
    Experts please help me out its very urgent. your help is appreciated and rewarded. Thanking you in advance.
    Regards,
    Chetan

    Hi Praveen,
    Yeah definately, my requirement is that I have to access of some BI reports to certain users, so contract data will be downlaoded from ECC on application server, need to read that file from application server and for the each contract i ahould create a authorization object, role creation and assigning of role to the user and profile generation and activation.
    To achieve this i have written two programs
    1) ZMIS_AUTH_OBJECT_CREATE- This program will create the Authorization Object using BDC and Role creation Using the BAPI
    "" Creation of Authorization Object
    CALL FUNCTION 'ZAUTHOBJ'
            EXPORTING
             ctu                    = 'X'
             mode                   = p_mode
             UPDATE                 = 'L'
    *   GROUP                  =
    *   USER                   =
    *   KEEP                   =
    *   HOLDDATE               =
             nodata                 = '/'
             g_authname_001         = 'ZDUMMY_MIS'
              g_targetauth_002       = wa_tab-auth
              g_authtxt_003          = wa_tab-short_desc
              g_authtxtmd_004        = wa_tab-med_desc
             marked_04_005          = 'X'
              g_authtxt_006          = wa_tab-short_desc
              g_authtxtmd_007        = wa_tab-med_desc
             tctiobjnm_04_008       = 'ZBUS_UNIT'
              g_authtxt_009          = wa_tab-short_desc
              g_authtxtmd_010        = wa_tab-med_desc
             marked_05_011          = ''
             opt_01_012             = 'EQ'
              low_01_013             = wa_tab-bu
              g_authtxt_014          = wa_tab-short_desc
              g_authtxtmd_015        = wa_tab-med_desc
             marked_04_016          = 'X'
              g_authtxt_017          = wa_tab-short_desc
              g_authtxtmd_018        = wa_tab-med_desc
             tctiobjnm_04_019       = 'ZCONTRCT'
              g_authtxt_020          = wa_tab-short_desc
              g_authtxtmd_021        = wa_tab-med_desc
             marked_05_022          = ''
             opt_01_023             = 'EQ'
              low_01_024             = lv_contract
              g_authtxt_025          = wa_tab-short_desc
              g_authtxtmd_026        = wa_tab-med_desc
              g_authtxt_027          = wa_tab-short_desc
              g_authtxtmd_028        = wa_tab-med_desc
              g_authname_029         = wa_tab-auth
    * IMPORTING
    *   SUBRC                  =
           TABLES
             messtab                = temp_message.
    "" Creation of role
    LOOP AT it_role INTO wa_role.
          CLEAR wa_text.
          wa_text-text = wa_role-desc.
          wa_text-langu = 'E'.
          APPEND wa_text TO it_text.
          wa_jobrole-agr_name = wa_role-role_name.
          wa_parentrole-agr_name = 'ZM_CT_DUMMY_MIS'.
          wa_method-usmethod = 'CHANGE'.
          CALL FUNCTION 'ZBAPI_JOBROLE_CLONE'
            EXPORTING
              jobrole          = wa_jobrole
             parent           = wa_parentrole
             method           = wa_method
           TABLES
    *   RETURN           =
             shorttext     = it_text
    *   LONGTEXT         =
    *   MENU_NODES       =
    *   MENU_TEXTS       =.
        ENDLOOP.
    2) ZMIS_AUTH_ASSIGN_TO_ROLE - This program will generate the profile created assign it to the role.
      ""*BDC for Profile creation and assignment to Roles
        CALL FUNCTION 'ZROLE'
          EXPORTING
           ctu                     = 'X'
           mode                    = p_mode
           UPDATE                  = 'L'
    *   GROUP                   =
    *   USER                    =
    *   KEEP                    =
    *   HOLDDATE                =
           nodata                  = '/'
            agr_name_neu_001        = wa_role-role_name
            text_002                = wa_role-desc
            text_003                = wa_role-desc
            text_004                = wa_role-desc
           value_01_005            = 'T-ML330881'
            h_fval_low_01_006       = wa_role-auth
            profn_007               = lv_profile
            ptext_008               = lv_text1
    * IMPORTING
    *   SUBRC                   =
         TABLES
           messtab                 = temp_message .
       COMMIT WORK AND WAIT.
    ""*Generation of Profile created
      LOOP AT it_role INTO wa_role.
        CALL FUNCTION 'PRGN_AUTO_GENERATE_PROFILE_NEW'
         EXPORTING
           activity_group                      = wa_role-role_name
    *     PROFILE_NAME                        =
    *     PROFILE_TEXT                        =
          no_dialog                           = ' '
          rebuild_auth_data                   = ''
          org_levels_with_star                = ' '
          fill_empty_fields_with_star         = 'X'
          template                            = ' '
          check_profgen_tables                = 'X'
          generate_profile                    = 'X'
          authority_check_pfcg                = 'X'
       EXCEPTIONS
         activity_group_does_not_exist       = 1
         activity_group_enqueued             = 2
         profile_name_exists                 = 3
         profile_not_in_namespace            = 4
         no_auth_for_prof_creation           = 5
         no_auth_for_role_change             = 6
         no_auth_for_auth_maint              = 7
         no_auth_for_gen                     = 8
         no_auths                            = 9
         open_auths                          = 10
         too_many_auths                      = 11
         profgen_tables_not_updated          = 12
         error_when_generating_profile       = 13
         OTHERS                              = 14
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDLOOP.
    For creating authorization objects, role & profile i have created one dummy auth, dummy role & dummy profile respectively.
    i have created dummy objects to copy the roles from dummy object and assign the same to new Auth obj, role & profile.
    Let me know what needs to be done. because these both the programs run perfectly in foreground, but fails in background.
    Regards,
    Chetan

  • Job getting cancelled in background scheduling

    Hi,
        I have written a report  in the SAP HR system and it is to be scheduled in background. This program transfers the PERNRs from HR system to CRM system as partners in BUT000.The report works perfectly fine if it is run in foreground. When I run it in background the job gets cancelled and I get the job log having a message that it could not ascertain code page and the system exception ERROR_MESSAGE is raised. If anybody has any clues regarding this problem please help me.
    Thanks & Regards,
    Rahul.

    Hi,
    I Guess you are using container controllers in the Report, and all container contols requires help from Sap Gui for execution. I guess that is the reason it is failing in background . Please check on that aspect as well.
    Hope this helps..

  • Difference in Foreground and Background processing of an object

    we have implemented SAP ECC 6 on May 6th, 2008.
    We are facing an issue in a BDC order creation program when run in background.
    But when the same program is executed in foreground it works fine.
    In issue is one of the customized condition ZFML is not getting calculated at all.
    This customized condition gets determined in an user exit MV45AFZZ in FORM USEREXIT_FIELD_MODIFICATION.
    Value gets calculated correctely for the conditon ZFML while executed the program in foreground but it fails in background.
    The obove exit is being processed when I'm executing a BDC for creating Sales Order through the text file from application server for multiple line item. This needs to be executed every one hour through background only
    When I run the BDC in foreground, It is properly executed, but in the background it is not for one particular pricing condition, which is a customized pricing for freight to determine whether for all entire order or for the each line item. System does correctly for the entire order, but not for each line item.
    Is it possible that the userexit is not getting triggered in Background.
    I had never encountered such situations before. I'm not able to predict this peculiar behaviour of BDC.
    Any solution.
    Sanjay Kumar -
    +66 853-551-854

    Hi,
       i guess that the problem with BDC with background mode,see the below theard and refer my solution
    Re: add a new tab in transaction ME51N.
    Regards
    Kiran Sure

  • Sy-batch is not getting set in background?

    Hi Experts,
    I have a scenario in which we are processing Inbound Idocs via standard FM to create EDI orders from the inbound Idoc data.
    We have a requirement in which we implemented enhancement for a Popup screen for user to select a particular material from the list of materials shown on the screen. While background instead of popup we are determining the record progmatically vai customer exit(Function module exit).
    The logic for foreground & background is perfectly fine but the problem is SY-BATCH value is not being set to "X" in background. So our background logic does not come into picture & IDOC fails in background.
    Just to analyze this issue , I have tried to store value of sy-batch in some variable & then put an infinite loop to check in background debugging(VIA SM50) whether that variable contains an "X" or not, That variable was not set to "X".
    Can anybody tell me is there any other way by which we can programatically distinguish whether something is running in foreground or in background?

    Hi,
    Also test the field sy-binpt ( Batch input ) which is set when a call transaction is made in the program. Usually the IDoc processing functions do a call transaction.
    Also at times the IDoc processing function sets a variable and exports it to the memory so you migh want to check for "export" statements in the IDoc processing function as well and import it in your program and test that imported variable.
    Br,
    Advait

  • How to store files in shared-folder in background mode

    Hello All,
    My requirement seems to be simple but I have tried many ways in achieving this, but failed. So require the help in accomplishing this task.
    Requirement
    I have to create a program in SE38 which will create a internal table with data in it in .XML format(which I can achieve).
    My requirement is this .XML file needs to be placed in a shared-folder in "BACKGROUND MODE".
    I have tried using GUI_DOWNLOAD function module, but this FM only runs in Foreground mode and fails in Background mode. I have tried convincing my client that I will keep the file in Application Server as it is achievable using OPEN DATASET statements, but they are not willing to accept this.
    So can you please help me in achieving this task as I am not getting any solution how to keep the file in Shared-folder in BACKGROUND mode itself(not Foreground).
    Best Regards,
    Tousif

    Hi Sanjeev,
    I have just used normal GUI_DOWNLOAD FM. Please find my sample code below
    CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
    *       BIN_FILESIZE                    =
           filename                        = 'D:\Users\baigtomx\Desktop\TOUSIF.XML'
    *       FILETYPE                        = 'ASC'
    *       APPEND                          = ' '
    *       WRITE_FIELD_SEPARATOR           = ' '
    *       HEADER                          = '00'
    *       TRUNC_TRAILING_BLANKS           = ' '
    *       WRITE_LF                        = 'X'
    *       COL_SELECT                      = ' '
    *       COL_SELECT_MASK                 = ' '
    *       DAT_MODE                        = ' '
    *       CONFIRM_OVERWRITE               = ' '
    *       NO_AUTH_CHECK                   = ' '
    *       CODEPAGE                        = ' '
    *       IGNORE_CERR                     = ABAP_TRUE
    *       REPLACEMENT                     = '#'
    *       WRITE_BOM                       = ' '
    *       TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *       WK1_N_FORMAT                    = ' '
    *       WK1_N_SIZE                      = ' '
    *       WK1_T_FORMAT                    = ' '
    *       WK1_T_SIZE                      = ' '
    *       WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *       SHOW_TRANSFER_STATUS            = ABAP_TRUE
    *       VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
    *     IMPORTING
    *       FILELENGTH                      =
         TABLES
           data_tab                        = lt_wo
    *       FIELDNAMES                      =
    *     EXCEPTIONS
    *       FILE_WRITE_ERROR                = 1
    *       NO_BATCH                        = 2
    *       GUI_REFUSE_FILETRANSFER         = 3
    *       INVALID_TYPE                    = 4
    *       NO_AUTHORITY                    = 5
    *       UNKNOWN_ERROR                   = 6
    *       HEADER_NOT_ALLOWED              = 7
    *       SEPARATOR_NOT_ALLOWED           = 8
    *       FILESIZE_NOT_ALLOWED            = 9
    *       HEADER_TOO_LONG                 = 10
    *       DP_ERROR_CREATE                 = 11
    *       DP_ERROR_SEND                   = 12
    *       DP_ERROR_WRITE                  = 13
    *       UNKNOWN_DP_ERROR                = 14
    *       ACCESS_DENIED                   = 15
    *       DP_OUT_OF_MEMORY                = 16
    *       DISK_FULL                       = 17
    *       DP_TIMEOUT                      = 18
    *       FILE_NOT_FOUND                  = 19
    *       DATAPROVIDER_EXCEPTION          = 20
    *       CONTROL_FLUSH_ERROR             = 21
    *       OTHERS                          = 22
       IF sy-subrc <> 0.
    * Implement suitable error handling here
       ENDIF.
    When I run this program in foreground mode, the file gets saved(here in the above example I have just used my desktop path. but the actual requirement is to store file in shared-folder i-e Network Drive).
    But when i run the same program in background mode, No file is getting stored.
    Regards,

  • Upload Files into SAP Office Folder in Background

    Hi All ,
    Has anyone tried uploading file(s) of any type say *.XLS , *.PDF to SAP office folder (Outbox) in the background . I am using the function module  'SO_DOCUMENT_REPOSITORY' with methods "SAVE" , "ATTCREATEFROMPC" and "SEND" . It works fine in foreground without any errors . But when tried to schedule in background , the job stops at the method call "ATTCREATEFROMPC" and gives a message  "Database error for <INSERT INTO KPRO> " . It looks like the uderlyiong function module checks for an active GUI and fails during background .
    Any thoughts or other solutions would be appreciated ....
    Thanks

    Hi,
    I think ATTCREATEFROMPC method is for loading the file from frontend PC. It is bound to fail if you run it in background since there is no SAPGUI running it and it can't know the location.
    You will need to use some other method to be able to read the files from the APP server, and have your documents on the APP server if you want to run your code in the background.
    cheers,
    Ajay

  • LSMW - RFBIBL00 background ko

    HEllo !
    i met problem by loading data by LSMW direct-input in background.
    i use the standard program /SAPDMC/SAP_LSMW_INTERFACE.
    and the last step (running RFBIBL00) fails in background mode only (it works well on foreground).
    by SM37 i got the error message E078 (BD class) : "data does not match job definition".
    i think that RFBIBL00 program is in the cause...
    did anyone already have this problem?
    thanks
    dev

    The message long text:
    NA BD078
    Text
    Job &: Data does not match the job definition; job terminated
    Diagnosis
    You wanted to start a direct input job. The system has found that the data does
    not match the data from the job definition.
    System Response
    The system terminated the job.
    Procedure
    Start the job from the Manage Data Transfers (Direct input) screen, where you can
    also schedule the job periodically.
    Proceed
    Rob

  • Excel upload in background not working

    Greetings,
    I have used 2 functions, ALSM_EXCEL_TO_INTERNAL_TABLE and TEXT_CONVERT_XLS_TO_SAP. Both work when run online, but fail in background. What I am reading suggest that the excel must be converted first to a txt (tab-delimited). Is this correct or is there another function that will work without the conversion?
    Thanks.

    hi Richard,
    the above mentioned FMs work only in foreground. The reason for this is that they communicate with Excel implemented on the presentation server on your machine during the upload. In background, there is no presentation server, so no Excel communication possible, so no successfull upload. You have to for another solution, the one you mentioned (tab delimited text file) could be a good way.
    hope this helps
    ec

Maybe you are looking for