How to download a template from BDN to a program?

Hi,
There is an excel sheet in BDN(t-code-oaor). I need to call this template in a report.
After that I will fill data in this excel and download it on the local PC.
I need suggestions that how can I do it?

This is  sample prog for downloading the template from BDN to local system.
REPORT  YVAI_SV_LOC.
type-pools : slis.
Tables containing the Fields for appl. toolbar on selection screens.
tables : sscrfields.
Business Document Navigator: Internal Connection Table for the
download of excel template.
data:  begin of i_bds_conn occurs 10.
        include structure bdn_con.
data:   objecttext  like toasp-objecttext,
        objecttext2 like toasd-objecttext,
        objecttext3 like toasr-objecttext,
        ntext       like tojtt-ntext,
     end of i_bds_conn.
*data : i_local_path_for_copy like rlgrap-filename.
**i_local_path_for_copy = 'E:\'.
data: gv_flag    type xflag,
      gv_item_no type i.
data: gs_bds_conn_marked like i_bds_conn occurs 5 with header line.
data: l_ipi(40) type c.
selection-screen function key 1.
selection-screen begin of block c1 with frame title text-001.
parameters : p_po type rlgrap-filename
                    obligatory default 'E:\test98.xls'.
selection-screen end of block c1.
Intialization for the text for function key.
Create application toolbar with following mentioned text
initialization.
  move text-tit to sscrfields-functxt_01.
At selection screen on value request the file seach is performed.
File search opens standard window pop-up for searching the file.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_po.
PERFORM file_search.
at selection-screen.
  if sscrfields-ucomm = 'FC01'.
The Excel Id and other information is to be passed to the program
SAPLBDS_TOOLS to get the excel template.
    perform fill_bds_data.
   perform export_document
     in program saplbds_tools
         using gs_bds_conn_marked.
    perform y_export_document
          using gs_bds_conn_marked.
  if sy-subrc = 0.
    call TRANSACTION 'YVAI_TEST98'.
  endif.
call TRANSACTION 'YVAI1'.
  elseif sscrfields-ucomm = 'ONLI'.
The Check for the file Existence for uploading.
    call function 'DX_FILE_EXISTENCE_CHECK'
      exporting
        filename       = p_po
        pc             = 'X'
      importing
        file_exists    = gv_flag
      exceptions
        rfc_error      = 1
        frontend_error = 2
        no_authority   = 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.
    if gv_flag = ' '.
      message e070(zf) with p_po.
    endif.
  endif.
*&      Form  fill_bds_data
      Passing the Required parameters for the excel.
form fill_bds_data .
  gs_bds_conn_marked-client = sy-mandt.
  gs_bds_conn_marked-classname = 'SOFFICEINTEGRATION'.
  gs_bds_conn_marked-classtype = 'OT'.
  gs_bds_conn_marked-objkey = 'SOFFICEINTEGRATION'.
  gs_bds_conn_marked-loio_id =
                            'BDS_LOC2  DDBD0807B93B26F19ED30050569F4158'.
  gs_bds_conn_marked-doc_ver_no = '1'.
  gs_bds_conn_marked-doc_var_id = '1'.
  gs_bds_conn_marked-doc_var_tg = 'OR'.
  gs_bds_conn_marked-descript = 'VCPI'.
  gs_bds_conn_marked-langu = 'E'.
  gs_bds_conn_marked-comp_id = 'vai - test99 file.xls'.
  gs_bds_conn_marked-mimetype = 'application/vnd.ms-excel'.
  gs_bds_conn_marked-contrep = 'BDS_DB2_R'.
  gs_bds_conn_marked-docuclass = 'XLS'.
  gs_bds_conn_marked-doc_type = 'BDS_SHEET'.
  gs_bds_conn_marked-stor_tab = '2'.
endform.
                    " fill_bds_data
form y_export_document using i_bds_conn_marked structure i_bds_conn.
-- data declaration                                               -- *
  data: local_signature like bapisignat occurs 1 with header line,
        export_components like bapicompon occurs 5 with header line,
        i_local_path_for_copy like rlgrap-filename,
        popup_fields like sval occurs 5 with header line.
  DATA : i_files like bapifiles occurs 1 with header line.
  clear:   i_files.
  refresh: i_files.
-- check if document is currently in change modus                 -- *
if ( ( i_bds_conn_chng-loio_id    = i_bds_conn_marked-loio_id and
     i_bds_conn_chng-doc_ver_no = i_bds_conn_marked-doc_ver_no and
     i_bds_conn_chng-doc_var_id = i_bds_conn_marked-doc_var_id and
       i_bds_conn_chng-doc_var_tg = i_bds_conn_marked-doc_var_tg )
        and (  i_bds_conn_chng-loio_id <> space and
               i_bds_conn_marked-loio_id <> space  )
        and ( doc_chng_is_open = 'X' ) ).
     -> set info popup -> doc can not be exported
   message i337(sbds).
endif.
-- check if components exist                                      -- *
-- fill signature table
  local_signature-doc_count  = '1'.
  local_signature-doc_id     = i_bds_conn_marked-loio_id.
  local_signature-doc_ver_no = i_bds_conn_marked-doc_ver_no.
  local_signature-doc_var_id = i_bds_conn_marked-doc_var_id.
  local_signature-doc_var_tg = i_bds_conn_marked-doc_var_tg.
  append local_signature.
  call function 'BDS_BUSINESSDOCUMENT_GET_INFO'
    exporting
      logical_system  = i_bds_conn_marked-log_system
      classname       = i_bds_conn_marked-classname
      classtype       = i_bds_conn_marked-classtype
      client          = i_bds_conn_marked-client
      object_key      = i_bds_conn_marked-objkey
      all             = 'X'
    tables
      components      = export_components
      signature       = local_signature
    exceptions
      nothing_found   = 1
      parameter_error = 2
      not_allowed     = 3
      error_kpro      = 4
      internal_error  = 5
      not_authorized  = 6
      others          = 7.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
-- get path for export                                            -- *
  call function 'WS_QUERY'
    exporting
      query          = 'CD'
    importing
      return         = i_local_path_for_copy
    exceptions
      inv_query      = 1
      no_batch       = 2
      frontend_error = 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.
-- get path for the documents by the user                         -- *
perform get_local_path using i_local_path_for_copy.
  loop at export_components.
    i_files-doc_count  = export_components-doc_count.
    i_files-comp_count = export_components-comp_count.
    i_files-comp_id    = export_components-comp_id.
   i_files-directory  = i_local_path_for_copy.
     i_files-directory  = p_po.
    append i_files.
  endloop.
  call function 'BDS_BUSINESSDOCUMENT_GET_FILES'
    exporting
      logical_system  = i_bds_conn_marked-log_system
      classname       = i_bds_conn_marked-classname
      classtype       = i_bds_conn_marked-classtype
      client          = i_bds_conn_marked-client
      object_key      = i_bds_conn_marked-objkey
    tables
      files           = i_files
      signature       = local_signature
    exceptions
      nothing_found   = 1
      parameter_error = 2
      not_allowed     = 3
      error_kpro      = 4
      internal_error  = 5
      not_authorized  = 6
      others          = 7.
  if sy-subrc <> 0.
   message i338(sbds).
  else.
   message i339(sbds).
  endif.
endform.                               " EXPORT_DOCUMENT

Similar Messages

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • How to download a file from Path specifed

    Hi Frndz..
    How to download a file from a specified path like  , i have a file on server in the path like "C://temp/Sap.pdf"
    I want to download this to user desktop..
    Thanks in Advance
    regards
    Rajesh

    Hi,
    For file down load u have to use a UI element as "File download".
    u just create context attribute as setdownload_res and file data.
    setdownload_res as of type "com.sap.ide.webdynpro.uielementdefinitions.Resource" then bound it to the ui element "resource".
    file data as of type "com.sap.tc.webdynpro.progmodel.api.IWDInputStream"
    and set calcuclated as true and read only as true.
    then in doinit method u just write this code
    IWDAttributePointer attr = wdContext.currentContextElement().getAttributePointer("fileData");
    IWDResource res = WDResourceFactory.createResource(attr,null,WDWebResourceType.UNKNOWN);
    wdContext.currentContextElement().setDownload_res(res);
    wdComponentAPI.getMessageManager().reportSuccess(""+c);
    after this in the getter method u write this code
    IWDInputStream stream = null;
    try
    stream = WDResourceFactory.createInputStream(new FileInputStream(new File("<pathof the file to be download>")));
    catch(Exception e)
    e.printStackTrace();
    return stream;
    also look at this thread  How to DownLoad any type of File from the server(PDF,XLS,Word)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f
    PradeeP

  • How to download a file from the internet using terminal

    how to download a file from the internet using terminal
    does any one know how to download afile from the internet using the Terminal application?

    Use curl. Something like this:
    curl -O http://www.example.com/filename.zip
    For more info, type +man curl+.

  • How to download a file from AL11 inot Excel format without collapse the col

    Hi,
    Please suggest how to download a file from AL11 to Excel sheet.currenlty all field are merging into single column.I writing this file via using DATASET.
    Regards
    Ricky

    Hi,
       Try this code,
    ==============================================
    TYPES : BEGIN OF ty_emp,
              empno(2) TYPE c,
              empid(10) TYPE c,
              empname(3) TYPE c,
            END OF ty_emp.
    DATA : it_emp TYPE TABLE OF ty_emp,
            wa_emp TYPE ty_emp.
    DATA : pbk TYPE string.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : p_file TYPE rlgrap-filename.
    PARAMETERS : p_asfile TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b1.
    pbk = p_file.
    OPEN DATASET p_asfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      DO.
        READ DATASET p_asfile INTO wa_emp.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        APPEND wa_emp TO it_emp.
      ENDDO.
    CLOSE DATASET p_asfile.
    Filling the already created file with download PS radiobutton
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                  =
          filename                      = pbk
      FILETYPE                      = 'ASC'
         append                        = 'X'
         write_field_separator         = ' '
      HEADER                        = '00'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
        TABLES
          data_tab                      = it_emp
    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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ==============================================
    Regards,
    Krrishna

  • How to download PDF attachment from gmail on iphone 5S

    Hi,
    How to download PDF attachment from gmail on iphone 5S
    Regards
    Ram

    Hello Ram2910
    You should be able to view them natively within iOS. If you can view them in safari and want to save them, then download iBooks or search for other apps that can view and save them.
    iBooks
    https://itunes.apple.com/us/app/ibooks/id364709193?mt=8
    iBooks: Viewing, syncing, saving, and printing PDFs on iPhone, iPad, and iPod touch
    http://support.apple.com/kb/ht4227
    Regards,
    -Norm G.

  • How to download Halloween videos from YouTube?

    <By Jenny>
    It is that time of year again, the exciting Halloween! Since activities in these days are wonderful, unforgettable, impressive, crazy, and fantastic, lots of them are recorded in the form of videos and uploaded to YouTube for sharing with all the people worldwide. Do you fall in love with some interesting, meaningful and unique video files about Halloween, and want to download them as your own collections so as to enjoy them in the leisure time? If so, this thread will definitely do you a favor, for it will instruct you how to download Halloween videos from YouTube in detail.
    The software we will use here is Pavtube [YouTube Converter|http://www.pavtube.com/youtube-converter/], which is free for downloading, if you want to convert the downloaded FLV YouTube Halloween videos to other formats, you should use its retail version, if not, there will be watermarks of Pavtube stamped in the output files.
    Okay, now let’s begin.
    1. Download Pavtube [YouTube Converter|http://www.pavtube.com/youtube-converter/], install and run it.
    2. Add URL, select output format
    After launching, press “Add URL” in the main interface of this program, and then the following interface will pop up. Copy and paste URL of the Halloween videos which you want to download from YouTube into the textbox after “URL”. If you only want to use its downloading function totally for free, you should check “Only Download FLV source file”, and uncheck “Keep FLV source file”, on the contrary, if you want to convert it to other format while downloading as well as keeping the FLV source file, you should tick the checkbox of “Keep FLV source file” in advance.
    Imagine you’d like to do downloading and converting work simultaneously, in that case, you should click on the drop-down list of “Convert to” to select an output format, here I choose “iPhone MPEG-4 640X480(*.MP4)” as an example.
    Also, there are two more optional steps, namely, specify output file name and save path. Factually, this program will generate a file name and destination folder by default automatically, if you don’t like using these ones, you can type your preferred file name into the textbox after “Save as” and click on the ellipsis icon at the opposite side of “Save to” to specify a path to store the output files.
    3. Custom
    This program allows users adjusting video and audio parameters like codec, aspect ratio, bit rate, frame rate, etc. You can configure all of these items according to your own requirements. For instance, if you need change the output files to have a smaller size, and do not mind the output quality, you can adjust these parameters into smaller figures.
    4. Click “OK” to start downloading and converting
    Once all the above settings are done, you can now click “OK” button to begin downloading and converting your favorite Halloween videos from YouTube at the same time. Pavtube [YouTube Converter|http://www.pavtube.com/youtube-converter/] will finish its tasks, even batch tasks at speed, and never let video and audio go in separate ways.
    Well, just 4 simple steps, the downloading and converting work are completed, sincerely hope this guide is helpful for you to download or convert your beloved Halloween video files from YouTube.
    By the way, I know an amused website specially designed for Halloween, it provides people with games and Halloween gifts, from which you can not only gain funs, but also get cute presents, [play this game here|http://www.pavtube.com/halloween/halloween.html], and happy Halloween.
    Get more related articles here : [Pavtube Halloween|http://www.pavtube.com/halloween/]

    Try this:
    http://i1224.photobucket.com/albums/ee374/Diavonex/0f2ca63a.jpg

  • How to download org model from R/3 to CRM.

    Dear Friends,
                     How to download Org model  from R/3 to CRM. Any one tell me step by step detaily.
    Regards,
    Raj kumar,
    08123667379

    You can download organization from R3 to CRM in the following way.
    go to SPRO -> Customer Relationship Management -> Master Data -> Organization Management -> Data Transfer -> Copy SAP ECC Sales Structure. This is the place from where you can replicate the sales structure from ECC. You can have a look at the IMG Implementation Guide for a more detailed information.
    As for the BP not coming as an Organization, you need to activate the switch to integrate the BP and Organization functionality. The link for the same is given below:
    SPRO -> Customer Relationship Management -> Master Data -> Business Partner -> Integration Business Partner-Organization Management --> Set up Intergration with Organization Management . Here you need to activate the following Switch - HRALX OBPON ON Integration O-BP Activated.

  • How to download RAW images from Canon S100 to iPhoto?

    How to download RAW images from Canon S100 to iPhoto?

    You need the Raw compatibility update 3.9:
    http://support.apple.com/kb/DL1473

  • HT6154 how to download the files from mail like gmail or yahoo or hotmail to my iphone 5s.I have not seen the option in my iphone 5s

    how to download the files from mail like gmail or yahoo or hotmail to my iphone 5s.I have not seen the option in my iphone 5s

    Download what files?
    What is the actual problem that is occurring?

  • How to create apple id for mac app store without using credit card and there is no any option for payment none. please tell how to download free apps from mac app store

    how to create apple id for mac app store without using credit card and there is no any option for payment none. please tell how to download free apps from mac app store

    my problem solve by me
    first create apple id
    fill credit card details
    and complete your account creating  process.
    than go to app store or itune store
    login your acount
    click right side  - account button
    than again login for account setting
    next go to payment information and click edit button
    when u enter payment infomation
    click none button in payment method and click done button.
    than ur credit card has been removed.
    but rs. 60 will deducted in your account when u doing this process.

  • How to download ALL MAIL from the server in a Mail app ?

    How to download ALL MAIL from the server in a Mail app ? I want all the mail messages, sent, received ON my computer... Thanks much !!!!!!!

    In Mail's Accounts/Mailbox Behavior preference pane make sure these 4 checkboxes are NOT checked:
    OT

  • How to download paid games from the App Store in the absence of a credit card?

    How to download paid games from the App Store in the absence of a credit card?

    If you don't have a credit card, you'll need a prepaid iTunes card or iTunes gift certificate. Or, if you're in the US, you can use PayPal, though it's often an unreliable method of payment.
    Regards.

  • How to download a form from the web, complete and save it?

    How to download a form from the web, complete and save it?

    Download Adobe Reader. If the form author allows filling out digitally, you can do so and save it again.
    Mylenium

  • How to download free applications from ovi without...

    How to download free applications from ovi without net connection in my mobile?

    Though there is a way of Downloading the applications from OVI onto your PC..as its not a method recommended by Nokia, we can not discuss here. In fact there were a no. of threads on this Forum mentioning this method.. but slowly, the Mods are removing the threads.

Maybe you are looking for

  • Is there any way to recover a deleted note if a backup hasn't been done recently?

    I recently either deleted a "note" on accident, or it just disappeared. I had just created a note a few days ago, and it had important information on it. As I was looking at it, it just disappeared like I deleted it, but I never hit the trash can but

  • W520 at two locations?

    Hi all, I have a W520 for work.  There, I use a Mini Dock which is connected to three 24" LCDs (among all the other crap).  Simply drop it down onto the dock, turn it on, and go to town.  As designed. At home, I have my own PC with three 24" LCDs and

  • Using an ESD install Volume for Mavericks

    Since I have a few Macs to update to Mavericks, I created an ESD Install volume from the latest (10.9.1) download.  All went well and I now have a bootablle USB Flash drive with the ESD install app on it.  My question is: When installing Mavericks ov

  • Navigating a zoomed image with shift+end... but using an action or a script?

    hello, i a have a crop script and with all my images i have to clean the floor... in that script the image goes to 200% zoom, them manually i hit "shift+end" to move to the bottom right of the image... so that i can clean that floor. can you help me

  • Failed to sync with user provisioning

    Hi, None of the users other than admin are able to login to planning application in SIT. I have the admin access in SIT, but still not able to log into any planning application. The error i get is "Failed to sync with user provisioning. Check Plannin