BAPI_DOCUMENT_CHANGE2 and BAPI_DOCUMENT_CREATE2 in background

Hi,
Can anyone please tell me whether the BAPIS   'BAPI_DOCUMENT_CHANGE2 ' and 'BAPI_DOCUMENT_CREATE2  can be executed in background?.
In foreground mode I can able to create and change the document successfully.
but in background mode I am getting an error from the BAPI saying that document can not be checked in.
Can anyone help me?
Regards,
Deepu

Hi,
maybe the problem are not the BAPI but the selection of the file. You can't use the GUI Frontend Services for selection in Batch-Mode..
Please use   FUNCTION 'EPS_GET_DIRECTORY_LISTING' .
program-code example for background:
FORM pd_batch .
  DATA: lv_def(5) TYPE c,
  lv_hp1 TYPE string,
  lv_hp2 TYPE string,
  lv_hp3 TYPE string,
  lv_sep3(1),
  lv_vg(20) TYPE c,
  lt_epsfili TYPE STANDARD TABLE OF epsfili,
  ls_epsfili TYPE epsfili.
  DATA: lv_start     TYPE string.
  DATA: lv_dir       TYPE epsf-epsdirnam.
  DATA: lv_filter    TYPE string.
  DATA: gt_filetable TYPE filetable.
  DATA: wa_filetable LIKE LINE OF gt_filetable.
  DATA: return       TYPE i.
  DATA: lv_objnr     TYPE cobrb-objnr.
  DATA: lt_jstat     LIKE STANDARD TABLE OF jstat WITH HEADER LINE.
  DATA: lv_epsfilnam TYPE epsf-epsfilnam.
  REFRESH: lt_files,lt_drat,lt_drad.
  SELECT * FROM  zqm_pd_custom INTO wa_pd_custom WHERE manuell = ''.
    APPEND wa_pd_custom TO gt_pd_custom.
  ENDSELECT.
Dokumentendaten zuweisen
  break de00009.
  LOOP AT gt_pd_custom INTO wa_pd_custom.
Liste mit allen Einlesedaten aus dem Verzeichnis
    REFRESH: gt_filetable, lt_files.
    CLEAR:  wa_filetable.
    CLEAR:  ls_doc,ls_return,ls_return2, lf_docnumber,
            lf_docpart,lv_01,lv_02,lv_03,lv_path,lv_file,
            lv_file2,lv_fauf, lv_rest,lv_help,lv_help2,lv_sep,wa_aufk.
    ls_doc-documenttype    = '044'.
    ls_doc-documentversion = '00'.
    ls_doc-documentpart    = '000'.
    ls_doc-statusextern    = 'FR'.
    lv_sep3 = '-'.
    lv_start = wa_pd_custom-path.
    CONCATENATE '.' wa_pd_custom-ufext INTO lv_filter.
GUI-Frontend-Services läuft nicht im Batch
    IF sy-batch = 'X'.
      lv_dir = lv_start.
      CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
        EXPORTING
          dir_name               = lv_dir
          file_mask              = '.'
        TABLES
          dir_list               = lt_epsfili
        EXCEPTIONS
          invalid_eps_subdir     = 1
          sapgparam_failed       = 2
          build_directory_failed = 3
          no_authorization       = 4
          read_directory_failed  = 5
          too_many_read_errors   = 6
          empty_directory_list   = 7
          OTHERS                 = 8.
      LOOP AT lt_epsfili INTO ls_epsfili.
        wa_filetable-filename = ls_epsfili-name.
        APPEND wa_filetable TO gt_filetable.
      ENDLOOP.
    ELSE.
      CALL METHOD cl_gui_frontend_services=>directory_list_files
        EXPORTING
          directory                   = lv_start
          filter                      = lv_filter
          files_only                  = 'X'
        CHANGING
          file_table                  = gt_filetable
          count                       = return
        EXCEPTIONS
          cntl_error                  = 1
          directory_list_files_failed = 2
          wrong_parameter             = 3
          error_no_gui                = 4
          not_supported_by_gui        = 5
          OTHERS                      = 6.
    ENDIF.
    IF sy-subrc = 0 AND gt_filetable IS NOT INITIAL..
      LOOP AT gt_filetable INTO wa_filetable.
        REFRESH lt_files.
        lv_path = wa_pd_custom-path.
        lv_file = wa_filetable-filename.
        SPLIT lv_file AT lv_sep3  INTO: lv_hp1 lv_hp2.
        lv_fauf = lv_hp1.
        CONCATENATE '00000' lv_fauf INTO lv_fauf.
        REPLACE ALL OCCURRENCES OF '.csv' IN  lv_hp2 WITH ''.
        CONCATENATE 'O0000000000' lv_hp2 INTO lv_vg.
Testen, ob FAUF vorhanden
        SELECT SINGLE  * FROM  aufk INTO wa_aufk
               WHERE  aufnr  = lv_fauf.
        IF sy-subrc <> 0.
*Datei einfach stehen lassen
        ELSE.
Nur Status "TABG" behandeln
          CONCATENATE 'OR' lv_fauf INTO lv_objnr.
          CALL FUNCTION 'STATUS_READ'
            EXPORTING
              objnr            = lv_objnr
              only_active      = 'X'
            TABLES
              status           = lt_jstat
            EXCEPTIONS
              object_not_found = 1.
          READ TABLE lt_jstat WITH KEY stat = 'I0045'.       " TABG
          IF sy-subrc = 0.
            CONCATENATE lv_path '' lv_file INTO lt_files-docfile.
*zum löschen vormerken
            CONCATENATE lv_path '' lv_file INTO lv_file2.
            lt_files-wsapplication   = wa_pd_custom-wsapp.
            lt_files-statusintern    = 'FR'.
            lt_files-storagecategory = 'Z0001'.
            APPEND lt_files.
Kurztexte
            CLEAR lt_drat.
            REFRESH lt_drat.
            lt_drat-language    = 'DE'.
            lt_drat-description = wa_pd_custom-ktext.
            APPEND lt_drat.
Objektverknüpfung zum Fertigungsauftrag
            CLEAR lt_drad.
            REFRESH lt_drad.
            lt_drad-objecttype = 'PORDER'.
            CONCATENATE lv_fauf lv_vg INTO lt_drad-objectkey.
            APPEND lt_drad.
Dokument anlegen
            CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
                  EXPORTING: documentdata         = ls_doc
                  IMPORTING: documenttype         = lf_doctype
                             documentnumber       = lf_docnumber
                             documentpart         = lf_docpart
                             documentversion      = lf_docversion
                             return               = ls_return
                 TABLES: documentdescriptions = lt_drat
                         objectlinks          = lt_drad
                         documentfiles        = lt_files.
            SHIFT lf_docnumber LEFT  DELETING LEADING space.
FAUF-Nr.
            lv_01 = lt_drad-objectkey.
Dokumentenart
            lv_02 = ls_doc-documenttype.
DIS Nummer
            lv_03 = lf_docnumber.
Fehler aufgetreten ??
            IF ls_return-type CA 'EA'.
              ROLLBACK WORK.
              MESSAGE ID '26' TYPE 'I' NUMBER '000'
                      WITH ls_return-message.
            ELSE.
              COMMIT WORK.
Wenn einchecken ok, Datei löschen
              IF ls_return IS INITIAL.
                IF sy-batch = 'X'.
                  lv_epsfilnam = lv_file.
                  CALL FUNCTION 'EPS_DELETE_FILE'
                    EXPORTING
                      file_name              = lv_epsfilnam
                      dir_name               = lv_dir
                    EXCEPTIONS
                      invalid_eps_subdir     = 1
                      sapgparam_failed       = 2
                      build_directory_failed = 3
                      no_authorization       = 4
                      build_path_failed      = 5
                      delete_failed          = 6
                      OTHERS                 = 7.
                  IF sy-subrc <> 0.
                  ENDIF.
                ELSE.
                  CALL FUNCTION 'WS_FILE_DELETE'
                    EXPORTING
                      file   = lv_file2
                    IMPORTING
                      return = sy-subrc.
                  IF sy-subrc <> 0.
                  ENDIF.
                ENDIF.
              ENDIF.
*Satz in ZPROZDATEN einfügen
              wa_prozdaten-aufnr = lv_01.
              wa_prozdaten-arbpl = wa_pd_custom-arbpl.
              wa_prozdaten-werks = wa_pd_custom-werks.
              wa_prozdaten-dokar = ls_doc-documenttype.
              wa_prozdaten-doknr = lv_03.
              wa_prozdaten-dokvr = ls_doc-documentversion.
              CONCATENATE lv_path '' lv_file INTO wa_prozdaten-filep.
              wa_prozdaten-datum = sy-datum.
              wa_prozdaten-name  = sy-uname.
              wa_prozdaten-uzeit  = sy-uzeit.
              INSERT INTO zqm_prozdaten VALUES wa_prozdaten.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
regard Joerg

Similar Messages

  • How to Post a a debit and credit in background? Reclassificaton

    Hi Gurus,
    I have a question regarding how to post a debit and credit in background? In fact I create an internal table and displayed in ALV grid where there are the amounts in local and transaction currency which are atypical. And after I have to post them for a reclassification because those amounts are not correct depending it is a vendor or customer.
    I would like to know if there is a function that I can use. I found a bapi 'AcctngGLPosting' but to be honnest I don't know how to use it. There is no example.
    Ayone could please help me?
    Thanks in advance.
    Regards,
    Mohamed.

    Hi,
    Check this for a example for BAPI_ACC_GL_POSTING_POST
    [http://www.sapfans.com/forums/viewtopic.php?p=546963&sid=6f418d93956fdc91bdb5e7544a9d77ef]
    Regards,
    Vik

  • Preview PDF has a black and white checked background

    Hi All.
    I am trying to look at a map in pdf format which when opened in Preview has a grey and white checked background behind the black lines. this makes it impossible to read. i realize that I can open this in Acrobat Reader I guess but does anyone know what this is called and why it is there or how to get rid of it/
    i realize it has something to do with layers or transparency but is there a good way to get a solid black or white background behind a pdf such as this in Preview?
    Thanks for any advice.

    When that student logs on go to the Universal Access preference pane and make sure the display setting is set to black on white, then go to the Displays preference pane and make sure it is set to millions of colors.
    Those are the only things I can think of off hand that may be causing the issue.

  • 'BAPI_DOCUMENT_CREATE2' in background

    I am trying to call 'BAPI_DOCUMENT_CREATE2' in background mode. I need to check in documents from application server, but I am getting "File cannot be opened" error.
    I am populating the following fields
    bapi_doc_files2-FILE_ID
    bapi_doc_files2-wsapplication
    bapi_doc_files2-storagecategory
    bapi_doc_files2-checkedin
    bapi_doc_files2-active_version
    bapi_doc_files2-description
      CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
        EXPORTING
          documentdata               = pa_doc_data
          pf_ftp_dest = 'SAPFTPA'
          pf_http_dest = 'SAPHTTPA'
       IMPORTING
            documenttype         = l_documenttype
            documentnumber       = l_documentnumber
            documentpart         = l_documentpart
            documentversion      = l_documentversion
            return               = la_return
       TABLES
            characteristicvalues = pt_characteristicvalues
            documentfiles        = pt_documentfiles.
    What should I consider if I wanted to call this bapi in background?

    Hai..
    These are the some some links 
    Running a BAPI in background..
    BAPI in Background..Urgent Pls
    BAPI in background processing
    BAPI in Background mode
    hope this may help you.
    KHS

  • Is it possible to put two different colors in tree parent node background and child nodes background?

    Is it possible to put two different colors in tree parent
    node background and child nodes background?
    Any help will be very helpful.
    Thanks

    Hi PanosE,
    Yes, you can set up another Standard Edition Server in child domain and then deploy pool pairing.
    You need to deploy a new Front End Pool for the new Standard Edition Server.
    A similar case for your reference.
    https://social.technet.microsoft.com/Forums/office/en-US/eca4299c-8edb-481e-b328-c7deba2a79ba/lync-2013-standard-edition-lync-fe-pools-in-multiple-domain-single-forest-senario?forum=lyncdeploy
    Best regards,
    Eric
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.? I want to alter the formatting (i.e., text and/or cell background color), but not cell content.

    Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
    I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).

    Hi Tom,
    Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
    Please explain what you are trying to do.
    Regards,
    Ian.

  • Removing grey-and-white grid background?

    Hey ,
    I installed Acrobat 9 Pro, version 9.4.1, one week ago. Since then, in every opened pdf-document appers an grey-and-white-grid-background (see figure below).  Normally, I would expect a white background, which I get under this setting only, if I change the background manually to white. How can I change this setting, to get the normally white background as a default? Support is warmly welcome - training_needed

    Thank you very much - this makes reading much easier! - training-needed

  • Excel Set Cell Color and Border.viのbackground color 設定について

    お世話になっております。
    Microsoft オフィス用レポート生成ツールキットを使って
    LabVIEWで収集したデータをExcelファイルで出力しようと考えています。
    そこで質問が有ります。
    題名のようにExcel Set Cell Color and Border.viのbackground color 設定についてです。
    デフォルト(未配線)では白に設定されていますが、”色なし”に設定するにはどうしたら良いのでしょうか?
    又、罫線色等を指定する数値設定に関しては、何処を調べたら良いのでしょうか?
    ご教授の程、宜しくお願い致します。

    _YN 様
    平素よりNI製品をご利用頂きまして誠にありがとうございます。
    日本ナショナルインスツルメンツ技術部の湧川と申します。
    ご質問にお答え致します。
    色なしにしたいとの事ですが、こちらでExcel Set Cell Color and Border.viを使用して簡単なVIを実行させてみましたが色なしに設定することはできませんでした。
    そこで質問したいのですが色なしにする理由というのはバックグラウンドが白のままだとセルの枠が見えなくなるからでしょうか。
    もしそうであれば設定により枠をつけることができますのでそちらの方を試して頂けたらと思います。
    方法としましては同じExcel Set Cell Color and Border.viを使い設定します。
    アイコンの上部にピンク色のピンが2つあるかと思いますがそちらからセル内側の線、外側の線を設定できます。
    添付した画像を参照して下さい。
    画像のように設定しますとセルに黒色の枠ができると思います。
    数値設定などに関しても質問されていますが、そちらはヘルプがありますのでそちらを参照頂けると詳しい情報がわかるかと思います。
    LabVIEWでVIを開いている時に ctrl + H を押しますと小さいウィンドウ「詳細ヘルプ」が立ち上がります、その状態でマウスのポインタをアイコンに重ねて頂きますと詳細ヘルプにアイコンの説明が記述されます。
    ウィンドウズ内のリンクからオンラインヘルプを参照することもできます。
    上記内容をご確認いただきまして、何かS_YN様の意図と違う点などありましたらご連絡下さい。
    宜しくお願い致します。
    日本ナショナルインスツルメンツ株式会社
    技術部
    湧川 朝満
    添付:
    Excle Set Color Sample.JPG ‏58 KB

  • How to start work flow agent listener and work flow background engines R12

    Hi,
    I need to start work flow agent listener and workflow background engine in R12.1.3. Could you please specify how to start a workflow agent listener and workflow agent background engine.
    Please send me link if any documents are there .
    Best Regards,
    Anil

    I need to start work flow agent listener and workflow background engine in R12.1.3. Could you please specify how to start a workflow agent listener and workflow agent background engine. How to start the Workflow Deferred Agent Listener andWorkflow Java Deferred Agent Listener? [ID 548918.1]
    Please send me link if any documents are there . Please search the forum before posting similar questions.
    http://forums.oracle.com/forums/search.jspa?threadID=&q=How+to+start+Workflow+Agent+Listener&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    http://forums.oracle.com/forums/search.jspa?threadID=&q=How+to+start+Workflow+Background+process&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How do I create a mobile version of a site that is based on scroll effects and a slideshow background?

    I need to create a mobile version for a site that is based on scroll effects and a slideshow background.
    Is it possible to copy the format from the desktop version without re-designing all the elements?

    Hi
    Different renditions will use require the page elements to be optimized accordingly.
    So you can surely copy the page elements and paste in phone or tablet layout , but you would need  to modify them.
    Thanks,
    Sanjit

  • Mac laptop screen going to sleep and changing desktop background

    last weekend my daughter called to say that her Macbook was acting strange. On Friday night she saw the battery icon said 25%, so she shut the system down. The next morning she plugged it in and booted. It took a while and the desktop background had changed to something grey. Also, the screen would blank out after 30 seconds to a minute. If she hit the space bar it would show and then go black after the 30 to 60 second time period. I had her shutdown and boot to her external drive where she had a month old image of her system. It took a minute or two to boot (it always seems like a long time when you are on the phone). It came up as her normal system and background. She left it for over an hour and it did not black out or go to sleep. We were planning on doing a restore the next day, but when she did a normal boot later that day from the internal hard drive, it came up with her normal background and the screen stayed active. She had not tried to set any settings. Is there something that a low battery would do to change the energy settings? We were going to explore the settings when the system magically worked as normal. It seems strange that a boot to the external drive would restore settings so that the system worked normally.

    Energy Saver and third party USB often don't go well hand in hand. I would though contact OWC and let them know you are having this problem, since they have a good track record of supporting the Mac platform. In the meantime, use Screen Saver instead of Energy Saver.
    And always keep your data backed up at least twice as my FAQ explains:
    http://www.macmaps.com/backup.html

  • When I click "File" and then "New" it keeps opening a new file as a layer and not a background. RGB is selected as the mode.

    When I click "File" and then "New" it keeps opening a new file as a layer and not a background. RGB is selected as the mode.
    With new files opening as a layer and not a background I'm not able to create multiple layers and it wont let me convert the layer to the background.
    How did this happen. I used PS just yesterday and had no problems. Today my computer did mandatory updates and now this.

    Yes. You are using the Ellipse Tool's Pixel option. So it is laying down pixels as it is supposed to do without creating a layer.
    Choose the Shape option:
    Also Layer menu > New Layer creates layers and the curled paper at the bottom of your Layers palette also creates a New Layer. I hope those work.

  • MacPro update has been running 2hrs w/a spinning ball and a blue background, is this  normal?

    My 6 mo old MacPro update has been running 2+hrs w/a spinning ball and a blue background, is this  normal?

    Not normal? Take it to an Apple store or AASP.

  • Implementing and Exposing a Background Callable Object

    Hi,
    I am following tutorial "Implementing and Exposing a Background Callable Object" of NWDS 7.1. I created implemented Java Enterprise Application and deployed. When i try to create Callable object in GP i am getting error saying "Cannot find this class name". Any solution for this please?
    Thanks,
    Songa

    Hi,
    I Have same problem, can anyone help me ?
    I tried the tutorial example for creating "Implementing and Exposing a Background Callable Object". In NW portal, i received message, "Cannot find this class name", when i try create callable objekt.
    Thanks,
    Nicholas

  • How to animate and have the background stay the same.

    Hello, I don't post much. But I have a question that's bugging me. I want to create an animation and have the background stay. How do I do this? I have tried locking the object and puting it on its own layer, but it doesn't work. Animating in AI is new to me.

    How, exactly, are you "animating"?
    If you are exporting Layers to SWF Frames, the export dialog provides a field in which you can select a specific Layer to serve as a static image. See online Help.
    JET

Maybe you are looking for

  • Error when trying to install new apps as well as syncing apps on my Ipod

    I have updated to the new OS on my Ipod Touch but now it won't allow me to sync the apps. I get a greyed out screen and cannot select or deselect any apps. I also cannot update any new apps onto the Ipod anymore. I have tried selecting all the apps I

  • How does one define a default style for a custom Flex component?

    How does one define a default style for a custom Flex component? hello I created a new set of Flex component library slib.swc (Flex 4.5). Would also like to have a default style. defaults.css file, making it the default style of the component library

  • HELP! Some A**hole made me delete my system fonts...

    ...now my computer wont start! I just get a blue screen. I was in a webex meeting with some software tech guy trying to get a program to work and he thought the problem was my system fonts. He deleted them and told me if I restart they would restore

  • Get Agent that triggered SCOM Alert

    Hi Everybody! Is there a way to get the agent id that has triggered an alert in SCOM? Maybe with Powershell or SQL Query? I was searching the Internet and tried some things but still have no solution for it ... We are using SCOM 2012 SP1. I need that

  • MDM Related queries

    Hi Gurus I am a Basis Consultant and new to MDM. I have following doubts. Many may find it very basic, but being new to MDM I want explanation on these.( If I am conecpt wisr wrong please correct me): 1. As per my knowledge MDM Stores Master data in