How to extract the data from module pool program to Excel Sheet?

Hi Guys
        I am having a requirement to transfer the data from Module pool screen to excel sheet directly.
        This is an urgent requirement.
        So plz reply me with some coding examples.
        I will give points for that.

This report extract excel file. From that concept you can easily extract data from module pool program also by coding in PAI of the screen.
REPORT ztest1 .
* this report demonstrates how to send some ABAP data to an
* EXCEL sheet using OLE automation.
include ole2incl.
* handles for OLE objects
data: h_excel type ole2_object,        " Excel object
      h_mapl type ole2_object,         " list of workbooks
      h_map type ole2_object,          " workbook
      h_zl type ole2_object,           " cell
      h_f type ole2_object,            " font
      h_c type ole2_object.            " color
DATA: FILENAME LIKE RLGRAP-FILENAME.
tables: spfli.
data  h type i.
* table of flights
data: it_spfli like spfli occurs 10 with header line.
*&   Event START-OF-SELECTION
start-of-selection.
* read flights
  select * from spfli into table it_spfli.
* display header
  uline (61).
  write: /     sy-vline no-gap,
          (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
          (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
          (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
          (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
          (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
  uline /(61).
* display flights
  loop at it_spfli.
    write: / sy-vline no-gap,
             it_spfli-carrid color col_key no-gap, sy-vline no-gap,
             it_spfli-connid color col_normal no-gap, sy-vline no-gap,
             it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
             it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
             it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
  endloop.
  uline /(61).
* tell user what is going on
  call function 'SAPGUI_PROGRESS_INDICATOR'
     exporting
*           PERCENTAGE = 0
           text       = text-007
       exceptions
            others     = 1.
* start Excel
  create object h_excel 'EXCEL.APPLICATION'.
*  PERFORM ERR_HDL.
  set property of h_excel  'Visible' = 1.
*  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:kis_excel.xls'
*  PERFORM ERR_HDL.
* tell user what is going on
  call function 'SAPGUI_PROGRESS_INDICATOR'
     exporting
*           PERCENTAGE = 0
           text       = text-008
       exceptions
            others     = 1.
* get list of workbooks, initially empty
  call method of h_excel 'Workbooks' = h_mapl.
  perform err_hdl.
* add a new workbook
  call method of h_mapl 'Add' = h_map.
  perform err_hdl.
* tell user what is going on
  call function 'SAPGUI_PROGRESS_INDICATOR'
     exporting
*           PERCENTAGE = 0
           text       = text-009
       exceptions
            others     = 1.
* output column headings to active Excel sheet
  perform fill_cell using 1 1 1 200 'Carrier id'(001).
  perform fill_cell using 1 2 1 200 'Connection id'(002).
  perform fill_cell using 1 3 1 200 'City from'(003).
  perform fill_cell using 1 4 1 200 'City to'(004).
  perform fill_cell using 1 5 1 200 'Dep. Time'(005).
  loop at it_spfli.
* copy flights to active EXCEL sheet
    h = sy-tabix + 1.
    if it_spfli-carrid cs 'AA'.
      perform fill_cell using h 1 0 000255000 it_spfli-carrid.
    elseif it_spfli-carrid cs 'AZ'.
      perform fill_cell using h 1 0 168000000 it_spfli-carrid.
    elseif it_spfli-carrid cs 'JL'.
      perform fill_cell using h 1 0 168168000 it_spfli-carrid.
    elseif it_spfli-carrid cs 'LH'.
      perform fill_cell using h 1 0 111111111 it_spfli-carrid.
    elseif it_spfli-carrid cs 'SQ'.
      perform fill_cell using h 1 0 100100100 it_spfli-carrid.
    else.
      perform fill_cell using h 1 0 000145000 it_spfli-carrid.
    endif.
    if it_spfli-connid lt 400.
      perform fill_cell using h 2 0 255000255 it_spfli-connid.
    elseif it_spfli-connid lt 800.
      perform fill_cell using h 2 0 077099088 it_spfli-connid.
    else.
      perform fill_cell using h 2 0 246156138 it_spfli-connid.
    endif.
    if it_spfli-cityfrom cp 'S*'.
      perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
    elseif it_spfli-cityfrom cp 'N*'.
      perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
    else.
      perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
    endif.
    if it_spfli-cityto cp 'S*'.
      perform fill_cell using h 4 0 200200200 it_spfli-cityto.
    elseif it_spfli-cityto cp 'N*'.
      perform fill_cell using h 4 0 000111222 it_spfli-cityto.
    else.
      perform fill_cell using h 4 0 130230230 it_spfli-cityto.
    endif.
    if it_spfli-deptime lt '020000'.
      perform fill_cell using h 5 0 145145145 it_spfli-deptime.
    elseif it_spfli-deptime lt '120000' .
      perform fill_cell using h 5 0 015215205 it_spfli-deptime.
    elseif it_spfli-deptime lt '180000' .
      perform fill_cell using h 5 0 000215205 it_spfli-deptime.
    else.
      perform fill_cell using h 5 0 115115105 it_spfli-deptime.
    endif.
  endloop.
* EXCEL FILENAME
  CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
              SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
  CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
  free object h_excel.
  perform err_hdl.
*       FORM FILL_CELL                                                *
*       sets cell at coordinates i,j to value val boldtype bold       *
form fill_cell using i j bold col val.
  call method of h_excel 'Cells' = h_zl
    exporting
      #1 = i
      #2 = j.
  perform err_hdl.
  set property of h_zl 'Value' = val .
  perform err_hdl.
  get property of h_zl 'Font' = h_f.
  perform err_hdl.
  set property of h_f 'Bold' = bold .
  perform err_hdl.
  set property of h_f 'Color' = col.
  perform err_hdl.
endform.                    "FILL_CELL
*&      Form  ERR_HDL
*       outputs OLE error if any                                       *
*  -->  p1        text
*  <--  p2        text
form err_hdl.
  if sy-subrc <> 0.
    write: / 'OLE-Automation Error:'(010), sy-subrc.
    stop.
  endif.
endform.                    " ERR_HDL

Similar Messages

  • [webdynpro] How to get the data from database and store in Excel sheet

    Hi All-
    I am developing an application in Webdynpro and I need to provide a URL ( link ) which if clicked , need to collect the data from Database ( SQL Server ) and puts in an Excel Sheet corresponding fields and opens the sheet.....
    Please look into this issue and help me out......
    Regards,
    Cris

    Hi Cris,
    Add-on to wat santosh has pointed to:
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    (Or) If you have implemented your logic to get Database records below Blog should guide you in opening an excel with ur records.
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    Regards,
    N.

  • How to Extract the data from R/3 Genric extractor to BW ?

    How to Extract the data from R/3 Genric extractor to BW ?

    hi,
    step by step procedure for generic extraction delta
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Refer:
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/548c9ec754ee4d90188a4f108e0121/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/84bf4d68-0601-0010-13b5-b062adbb3e33
    Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    Extractions in BI
    https://www.sdn.sap.com/irj/sdn/wiki
    New to Materials Management / Warehouse Management?
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1b439590-0201-0010-ea8e-cba686f21f06
    Ramesh

  • How to Extract the data from Microsoft BI to SAP BI 7

    Dear All,
    We have a requirement to Extract the data from Microsoft BI to Sap BI 7. How can we achieve this??
    Shall we use the DB connection for this??
    If anyone knows about this please give me some suggestion.
    Thanks in advance
    Sathiya

    Hi All,
    How to include the DBMS name when I give the connection. We are using the Data base as MS-BI.
    Please guide me
    Thanks in advance.
    Regards
    Sathiya

  • How to extract the data from R/3?

    Gurus,
    I need to extract the data from R/3 to BI . Below i am giving Table name followed by field name and field description.
    I am using BI 7.0 and ECC 6.0
    I am having following doubts.
    1. Based on below information which extract method I need to use (Generic data  Extraction?)?
    2. I try to create a one view but I could not find Join between the tables. I found only few joins. how to join other tables?
    3. Without joining these table how can I collect the data ?
    4. Do i need to create multiple tables?
    SAP Table      SAP Field        Field Description
    VBAK->             VBELN->        Sales Document
    VBAP->             WERKS->        Plant
    VBAK->              AUART->            Doc Type
    VBAP->             PSTYV->        Item Category
    VBAP->             MATNR->        Material
    VBAP->             ARKTX->        Description
    MATNR->              GROES->     
    VBAP->             ZIEME->        Target Quantity UOM
    VBAP->             WAVWR->        Cost
    VBAK->             ERNAM->        Name of a person who created the object
    VBAKA->             KUNNR->        Customer Number 1
    VBAP->             BSTNK->                 Customer purchase Order no
    VBEP->             BANFN->        Purchase Requisition Number
    QMFE->             FEGRP->        Cause Code(Code Group Problem)
    QMFE->             FECOD->        Damage Code(Problem or Damage Code)
    QMEL->             QMNUM->        Notification No
    EQUI->             EQUNR->        Equipment Number
    QMEL->             QMART->        Notification Type
    QMELI->             ERDAT->        Date on Which Record Was Created
    ============================================================================================
    Gurus I will assign full points .
    Thanks

    Hi,
    I would use the standard extractor 2lis_11_vaitm and enhance it for the following fields:
    VBEP-> BANFN-> Purchase Requisition Number
    QMFE-> FEGRP-> Cause Code(Code Group Problem)
    QMFE-> FECOD-> Damage Code(Problem or Damage Code)
    QMEL-> QMNUM-> Notification No
    EQUI-> EQUNR-> Equipment Number
    QMEL-> QMART-> Notification Type
    QMELI-> ERDAT-> Date on Which Record Was Created
    regards
    Siggi

  • How to extract the data from SAP using Msaccess tool ?

    Hi Experts,
    Purpose u2013
    Want to extract the data in a better way rather than using the T.code u2013 SE16
    regards
    Kedar Kulkarni

    Hi,
    Try this...
    Please use the standard ABAP program "RIACCESS".
    Before using the program "RIACCESS", you need to install the PS utilities, which are part of SAPGUI install CD.
    It is available in the "\SAPGUI\PS directory". 
    Then do the followings :
    1. Select transaction code SALE -> Systems in network-> Define RFC Destination. 
    2. You will need two RFC destinations (TCP/IP connections for the front-end workstation). 
         Setup the two RFC destinations PS_ACCESS_1 and PS_ACCESS_2 and you'll have to get them to point to wdpsastr.exe and wdpsatab.exe respectively. 
    3. Then execute RIACCESS and choose PS_ACCESS_1 to generate access tables. 
    The system must also be able to access the RFC-DLL files (librfc2.dll, librfc3.dll, librfc4.dll, librfc5.dll, librfc6.dll, vrfc.dll). 
    Please note that Access only supports tables with up to 255 fields.

  • How to store the variant in Module Pool Programming

    Hi,
       I have the module pool program which is having 4 screen. depends on the first and second screen, third screen is called. i want to store the data of third screen to the variant. All the screen except first screen is a subscreen.
    Regards,
    Dhiraj.

    Hi Dhiraj,
    You can create a variant only for a Report. Module Pool Programs require a dialog with the user & hence creating a varint is not possible. You  can possibly create some Parameter IDs & default values in there.
    Regards,
    Suresh Datti

  • How to extract the data from the chart. Data were not saved

    Hi everyone. Beginners question, but could not find an answer to it
    How can I get the numerical data from the chart. Chart is already on the screen and data vere not saved into file during VI run. All I have - just chart, but I need numbers       
    Thanks
    Message Edited by olka on 07-18-2007 09:41 AM

    You can still do it, the process just changes a bit...
    Copy the control to a new VI as before, and change it into a control.
    Create the diagram shown in the attached screen shot.
    Run the new VI. You will get two arrays: one of x-axis values and one of y-axis values.
    Mike...
    Message Edited by mikeporter on 07-18-2007 12:21 PM
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    extracting xy data.JPG ‏5 KB

  • My Blackberry Device got wet in Salt Water, How to extract the data from its Memory ?

    I have forgotten my device in my pocket while swimming in Sea Water. Eventually , the device got water damaged , I've taken out the battery, used the hair drier and still didn't work. All My concern is how can I retrieve the data on my Device Memory. Most important the Media Files (Photos, Videos...etc),
    Thanks,

    photos and vids ar most lilkely on the SD card and youcan get a USB reader to get them if they are not encrypted.
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • How to Extract the data from the database to XML Format

    Hi All,
    RepositoryItem userItem = getProfileRepository().getItem("user747", "user");
    String userAsXML = GetService.getItemAsXML(userItem,"profileMapping.xml");
    While searching, I got the above snippet. But i don't have any idea about to execute it. Can any one help me out.

    if you want to export all the repository data into an xml, you can use export
    C:\ATG\ATG 9.1\home
    bin\startSQLRepository -m ModuleName -export all outputfilename -repository pathtorepository
    C:\ATG\ATG9.1\home
    bin\startSQLRepository -m MotorPriseJSP -export all users.xml -repository /atg/userprofiling/ProfileAdapterRepository
    this will export all profile data from MotorPriseJSP to users.xml. Make sure you point correct datasource while executing this comamnd.
    Hope this helps !!!
    Thanks,
    Rajesh Akavaram

  • How to get the text in module pool program after f4 help

    Hi to all experts,
    My required is to get the text of a field when the user clicks on the f4 help text should be populated automatically beside the field
    how to do it

    >
    > the screen name is defined as t528t-plstx and while passing im using the same name in the POV module after what could be the reason;
    Hi in the POV module, first read the dynpro filed for which a text has to be displayed  (using FM- DYNP_VALUES_READ)and then update your Text Description field uing  the FM -'DYNP_VALUES_UPDATE
        dynpfields-fieldname  = 'FNAME'.                  "FNAME is the field for which POV is called
        append dynpfields.
        repid = sy-repid.
      call function 'DYNP_VALUES_READ'
           exporting
                dyname     = sy-cprog
                dynumb     = sy-dynnr
           tables
                dynpfields = dynpfields
           exceptions
                others.
       read table dynpfields index 1.
       fname = dynpfields-fieldvalue.
    *Fetxh the Text field into a local varaible.
        l_plstx = XXXXXXX. 
        dynpfields-fieldname    = 'T528T-PLSTX'.
        dynpfields-fieldvalue   =  l_plstx.
        APPEND dynpfields .
        CALL FUNCTION 'DYNP_VALUES_UPDATE'
          EXPORTING
            dyname               = sy-repid
            dynumb               = sy-dynnr
          TABLES
            dynpfields           =  dynpfields.
    This will update your text field dynamically.
    Regards,
    Rajesh

  • How to extract the data

    data source is 0FI_AP_4 how to extract the data from R3 to bw

    Hai<b> Anand</b>...
    If you also Create a DataSource in R/3 Extract it Using the Transaction code <b>RSA3</b> and Please Replicate DataSource in BW.....
    Replication is Easy in BW....
    Just Click on Right from the SourceSystem and Click the option " <b>Replicating DataSource</b> "....
    The Datasource will be replicated in BW after Clicked.....
    <i><b>Assign points If It Helps </b></i>
    <u><b>BalajeeKannan</b></u><u></u><i></i>

  • Extract the data from xbrl source

    Hi ,
    I want to extract the data from xbrl source system . I have one xsd, few xml files and one xbrl file .   I have imported xsd file  but lot of the xml files failing to parse against xsd.
    Please guide me how to extract the data from xbrl file .
    Thanks & Regards,
    Ramana.

    Hi,
              Yes it will work, follow the bellow steps,
    Steps
    1) Create a blank database in Microsoft Access, lets call it 'TestDB.mdb'. I saved this mdb file in my XI server path itself,
    xiserver\xitemp\db\TestDB.mdb
    (you can save it anywhere provided it has a shared access)
    2) Add a table in TestDB.mdb, call it TEST_EMPLOYEE with the following rows and save it.
    EMPID type text
    EMPNAME type text
    EMPAGE type number
    FLAG type text
    3) Now follow the same steps as mentioned in the blog,
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    except for the receiver jdbc adapter configuration.
    4) In the receiver JDBC adapter configuration pass the following parameters,
    Transport Protocol: JDBC 2.0
    Message Protocol: XML SQL Format
    Adapter Engine: Integration Server
    JDBC Driver: jdbc.odbc.JdbcOdbcDriver
    Connection: jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//xiserver/xitemp/db/TestDB.mdb
    5) In my case there is no userid and password required, but if you have userid and password, then the parameter for Connection becomes,
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//xiserver/xitemp/db/TestDB.mdb;Uid=yourid;Pwd=yourpwd;
    Reward Points ,if found Useful.
    Thanks,
    Satish.

  • How to send the data from jsp page to excel ???

    hi all,
    i want to send the data from my jsp form to excel sheet. any one can help me ??

    Hope this sample code might help :
    StringBuffer data = new StringBuffer();
    OutputStream ostream = response.getOutputStream();
    response.setContentType("application/vnd.ms-excel");
    response.setHeader( "Content-Disposition",
    "attachment; filename=sample.xls" );
    ostream.write(data.toString().getBytes());
    ostream.flush();
    Try it out.
    Swathi

  • How to extract the data by using function module?

    hi experts,
    what are the steps i have to fallow to extract the data from R/3 by using FUNCTION MODULE.
    thanks & regards
    venkat

    Hi,
    Extracting data from R/3 extract structure thru function modules
    You can proceed with create function module using SE37, thereu2019s sample in system RSAX_BIW_GET_DATA_SIMPLE,
    You need to know the logic how to populate the structure,
    after that RSO2, create datasource specify extract structure and
    function module,
    activate and replicate to bw.
    Chheers
    Raj

Maybe you are looking for