How to read data from ABAP with filter?

I know the famous pass which uses RFC_READ_TABLE to get a whole table into IdM. How can I only read a part of it, e.g. The currently locked users from table USR02 having UFLAG NE 0?

Let's have a look to ABAP (with basis release 702):
The function RFC_READ_TABLE offers filters using the input table OPTIONS. OPTIONS is a simple text table with line length 72 which directly is copied into the WHERE clause of the SELECT.
The result is restricted to tables having maximum record length of 512 characters. However, using the input table FIELDS you could list the FIELDNAMES which should be read from the database. This way it would be possible to read larger tables - if you only choose fields which sum up to maximum 5121 characters.
Coding example in ABAP:
data: ls_OPTIONS type          RFC_DB_OPT,
       lt_OPTIONS type table of RFC_DB_OPT,
       ls_FIELDS  type          RFC_DB_FLD,
       lt_FIELDS  type table of RFC_DB_FLD,
       ls_DATA    type          TAB512,
       lt_DATA    type table of TAB512.
ls_FIELDS-FIELDNAME = 'BNAME'.
append ls_FIELDS to lt_FIELDS.
ls_FIELDS-FIELDNAME = 'UFLAG'.
append ls_FIELDS to lt_FIELDS.
ls_FIELDS-FIELDNAME = 'BCODE'.
append ls_FIELDS to lt_FIELDS.
ls_OPTIONS-TEXT = `BNAME LIKE 'J%'`.
ls_OPTIONS-TEXT = `AND`.
ls_OPTIONS-TEXT = `UFLAG NE 0`.
append ls_OPTIONS to lt_OPTIONS.
CALL FUNCTION 'RFC_READ_TABLE'
   DESTINATION 'NONE'
   EXPORTING
     QUERY_TABLE                = 'USR02'
*   DELIMITER                  = ' '
*   NO_DATA                    = ' '
*   ROWSKIPS                   = 0
*   ROWCOUNT                   = 0
   TABLES
     OPTIONS                    = lt_OPTIONS
     FIELDS                     = lt_FIELDS
     DATA                       = lt_DATA
   EXCEPTIONS
     TABLE_NOT_AVAILABLE        = 1
     TABLE_WITHOUT_DATA         = 2
     OPTION_NOT_VALID           = 3
     FIELD_NOT_VALID            = 4
     NOT_AUTHORIZED             = 5
     DATA_BUFFER_EXCEEDED       = 6
     system_failure             = 8 "MESSAGE l_message
     communication_failure      = 9 "MESSAGE l_message
     OTHERS                     = 7
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
write: / 'RFC_READ_TABLE', 30 'SY-SUBRC =', sy-subrc.
loop at lt_DATA into ls_DATA.
   write: / ls_DATA.
endloop.
How can we create a FromSAP pass in IdM which uses function RFC_READ_TABLE with OPTIONS and FIELDS?
Let's have a look to alternatives:
Function RFC_GET_TABLE_ENTRIES has the same limitation of maximum record length of 512 but does not offer data or field selections. -> Not useful for IdM
Function GET_TABLEBLOCK_RFC is not remote enables but a local starter in ABAP for function GET_TABLEBLOCK_COMPRESSED_RFC, however, this one retrieves compressed results. -> Not useful for IdM 
Function TABLE_ENTRIES_GET_VIA_RFC has a maximum line length of 2014 and offers data selection using input table SEL_TAB (no field selection). Limitation: This function can only process table which have character-like fields only, i.e. table USR02 is out of scope. (Function RFC_READ_TABLE does not have this limitation.)
Coding example in ABAP:
data: ls_SEL_TAB  type          BDSEL_STAT,
       lt_SEL_TAB  type table of BDSEL_STAT,
       ls_NAMETAB  type          BDI_MFGRP,
       lt_NAMETAB  type table of BDI_MFGRP,
       ls_TABENTRY type          BDI_ENTRY,
       lt_TABENTRY type table of BDI_ENTRY.
ls_SEL_TAB-ZEILE = `BNAME like 'B%'`.
append ls_SEL_TAB to lt_SEL_TAB.
CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
   DESTINATION 'NONE'
   EXPORTING
*   LANGU                     = SY-LANGU
*   ONLY                      = ' '
     TABNAME                   = 'UST04'
* IMPORTING
*   RC                        =
   TABLES
     SEL_TAB                   = lt_SEL_TAB
     NAMETAB                   = lt_NAMETAB
     TABENTRY                  = lt_TABENTRY
   EXCEPTIONS
     INTERNAL_ERROR            = 1
     TABLE_HAS_NO_FIELDS       = 2
     TABLE_NOT_ACTIV           = 3
     NOT_AUTHORIZED            = 4
     system_failure            = 8 "MESSAGE l_message
     communication_failure     = 9 "MESSAGE l_message
     OTHERS                    = 5
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
write: / 'TABLE_ENTRIES_GET_VIA_RFC', 30 'SY-SUBRC =', sy-subrc.
loop at lt_TABENTRY into ls_TABENTRY.
   write: / ls_TABENTRY.
endloop.
Despite the limitation, how can we create a FromSAP pass in IdM which uses function TABLE_ENTRIES_GET_VIA_RFC?
Kind regards
Frank

Similar Messages

  • How to download data from abap-ouput to excel sheet with logo

    how to download data from abap-ouput to excel sheet with standard logo
    Edited by: Harish Kasyap on Nov 18, 2008 8:19 AM
    Edited by: Harish Kasyap on Nov 18, 2008 8:20 AM

    For saving the report you can goto System -> List -> Save -> Local File -> Location where you want to save in your presentation server.
    You can also give a option in your selection screen to save the file to Presentation server using FM GUI_DOWNLOAD.
    Hope it helps.
    Thanks,
    Jayant.

  • How to read data from an internal table into a real table?

    Hello experts,
    I'm relatively new to ABAP and I'm trying to figure out how to read data from an internal table into a table that I created.  I'm trying to use the RRW3_GET_QUERY_VIEW_DATA function module to read data from a multiprovider.  I'm trying to read data from the e_cell_data and e_axis_data tables into a table that I've already created.  Please see code below.
    TABLES MULTITAB.
    DATA:
      query_name TYPE RSZCOMPID,
      s_cubename TYPE RSINFOPROV,
      t_cell_data TYPE RRWS_T_CELL,
      t_axis_data TYPE RRWS_THX_AXIS_DATA,
      t_axis_info TYPE RRWS_THX_AXIS_INFO,
      wa_t_cell_data like line of t_cell_data,
      wa_t_axis_data like line of t_axis_data,
      w_corp_tab like line of t_cell_data.
    s_cubename = 'CORP_MPO1'.
    query_name = 'Z_corp_test'.
        CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
           EXPORTING
             i_infoprovider           = s_cubename
             i_query                  = query_name
            i_t_parameter            = query_string_tab
           IMPORTING
             e_cell_data              = t_cell_data
             e_axis_data              = t_axis_data
             e_axis_info              = t_axis_info.
    If anyone has any information to help me, I would greatly appreciate it.  Thanks.

    Hi,
    <li>Once you call the function module RRW3_GET_QUERY_VIEW_DATA, lets say data is available in the corresponding tables e_cell_data e_axis_data which you have mentioned.
    <li>Modify your internal table defined for other purpose, with data from e_cell_data e_axis_data like below.
    LOOP AT t_cell_data INTO wa_t_cell_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_cell_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    LOOP AT t_axis_data INTO wa_t_axis_data.
      "Get the required data from t_cell_data.
      MOVE-CORRESPONDING wa_t_axis_data TO it_ur_tab.
      "Modify your internal table wih data
      MODIFY it_ur_tab TRANSPORTING <field1> <field2> <field3>.
    ENDLOOP.
    Thanks
    Venkat.O

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to fetch data from Mysql with SSL.

    I am using jdk1.5 and mysql 5.0.
    How to fetch data from Mysql with SSL
    I am using url = jdbc:mysql://localhost/database?useSSL=true&requireSSL=true.
    It shows error. how to fetch

    I have created certificate in mysql and checked in mysql.
    mysql>\s
    SSL: Cipher in use is DHE-RSA-AES256-SHA
    but through ssl how to fetch data in java.

  • How to read data from a CLUSTER STRUCTURE not cluster table.

    Hi,
    how to read data from a CLUSTER STRUCTURE not cluster table.
    regards,
    Usha.

    Hello,
    A structre doesnt contain data.. so u cannot read from it. U need to find out table of that structure and read data from it.
    Regards,
    Mansi.

  • How to read data from a router by using labview

    I am a  beginner labview. How to read data from a router by using labview ? 

    What kind of data are you trying to read?
    Does the router behave like a webserver that you log into?  If so, search the forums for threads discussing HTML.

  • How to read data from a connected modem

    any one can help me? how to read data from a connected modem. The modem received real-time data from other server. The data is in text format. I can see this text when I used hyperterminal for dial up and the data is accumulated such as:
    @aa1235678
    @bb2135647
    @cc5214367
    since it is real-time data, I want to read one line each time instantly when it arrives.

    You need to use the Java Communications API. (http://java.sun.com/products/javacomm/index.html)

  • How to read data from a zipped MS Access file?

    How to read data from a zipped MS Access file?

    RPJ,
    You do not need to use the Close Zip File.vi when you unzip a folder.  This VI is used when you are creating a zip folder.
    As for examples, I found a couple of ActiveX based MS Access examples.  These programs look to be pretty basic.  For more in depth example I would search Microsoft Developers Network
    http://zone.ni.com/devzone/cda/epd/p/id/2188
    http://zone.ni.com/devzone/cda/epd/p/id/1694
    Regards,
    Jon S.
    National Instruments
    LabVIEW R&D

  • Help me,  How to read data from USB ???

    Help me, How to read data from USB ???

    If its a disk on key or some portable hard drive than once its connected to the usb and recognized by the system you can access it through java like you would access your hard drive.

  • JTable, how to read Data from it when enter is pressed

    How to read Data from JTable on Return or lost focus from cell.
    Also please tell me which listener I should should.
    thx for help

    You should read the tutorial about tables, cell editors and models.
    Also you should not [url http://forum.java.sun.com/thread.jsp?thread=472677&forum=57&message=2186815]crosspost
    Mike

  • How to read data from a file in OSB

    hi guys,
    Recently, I've got a problem with reading file from specific location. I've actually followed this post OSB 11g - Read or Poll File in OSB - Oracle Fusion Middleware Blog, and then
    I know how to read a file. However, it does not as expected. Because, I've found no way to read data from the file. Therefore, no chance to manipulate the data like assigning to a variable, or extracting ....
    Hence, is there any way to read data from file by using proxy service in OSB ??? No Java code ???
    by the way, supposed that there is no way to read data from a file in OSB. So, What purposes will the way in the post above be used for?
    Many thanks in advance

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to Read Data from a table (horizontal axsis) in an existing report

    Hi to all,
    I've a question. I must read the data in a table of an existing report. I develope with BO XI 3.0
    I don't know how to reach the table in my report from SDK.
    this is my code:
    reports = document.getReports();
    rep = reports.getItem(0);     
    the report has the title and a table horizontal axsis.
    I must read the column name(header column) of the table and all rows for retrieving values.
    Thank u in advance for your attention.

    hi ChinMay,
    thank u for your answer.
    I would like to ask u if Ireport refers crystal reports, while i mean to read data from a webi report.
    I've tried in many manners to read this data and i've read the SDK, but i'm unable to reach the table of my report for reading its rows. i'm able to export in XML format, i'm able to get reportelement , block, but in the java's example of SDK its not present how to obtain the reportbody and subsequently the section or directly a table. the example that i've seen show that if u create a new report u can create the reportbody, the section, the table and others. But don't show how to obtain this from an existing report.
    Probably i don't understand very well all the SDK structure and i think that is possbile to read a table(with horizantal axis) in a report without section only passing by the ReportBody.
    I know that u don't have so time to spent for things that are in the SDK, but if it's possible to have ten rows of sample about this question i'll be very happy.
    If it's not possibile, thank u very much for your interesting and disponbility and i'll try again and again and again to solve this.
    Matteo

  • How to read data from itab

    can someone help me with this....
    how to read data.....and move it to internal table....
    the requirement is as:
    <b>Get the Participant details in an internal table IT_FINAL_PAR</b>
    •     Loop through IT_PA0002 and move Personnel number (PERNR), Personnel ID Number (PERID), Last name  (NACHN), First name (VORNA), Gender Key (GESCH), Date of Birth (GBDAT) into a final internal table for Participant data IT_FINAL_PAR.
          Read the internal table IT_PA0006 to get the corresponding House Number and Street 
    (STRAS), City (ORT01), Postal code (PSTLZ), State (STATE), 2nd address line (LOCAT) by comparing Personnel Number (PERNR)and move those retrieved field values to the final internal table for Participant data IT_FINAL_PAR.

    Hi,
      you could try the following:
    * work areas
    data: W_PA0002 like line of IT_PA0002[],
          W_PA0006 like line of IT_PA0006[],
          W_FINAL_PAR like line of IT_FINAL_PAR[].
    loop at IT_PA0002 into W_PA0002.
      clear W_FINAL_PAR.
    * move values from IT_PA0002
      W_FINAL_PAR-PERNR = W_PA0002-PERNR.
      W_FINAL_PAR-PERID = W_PA0002-PERID.
    * read address values from IT_PA0006
      read table IT_PA0006 into W_PA0006 with key pernr = W_PA0002-pernr.
      if sy-subrc = 0.
    * move fields from IT_PA0006
        W_FINAL_PAR-STRAS = W_PA0006-STRAS.
      endif.
      append W_FINAL_PAR to IT_FINAL_PAR.
    endloop.

  • How to read data from clusters ??

    Hi ,
    Can any one please help me with procedure to read data from any Pcln tables.....other than pcl2.
    with and without using macros..
    I'm planning to read data from Pcl4 from cluster LA .using the macro RP_IMP_C4_LA. i dont know how to pass the key or where to use the key to read data .
    Please please let me know the standard procedure to read data from cluster tables.(i know PCL2).'
    Thanks In Advance !
    Kiran

    Hi Thomas,
    Just out of curiosity. In our system we have a custom table built which stores data in LRAW format.
    The table is updated using IMPORT/EXPORT FROM/TO DATABASE statements (similar to INDX).
    Can we read the PCL* tables in the same way as INDX ?
    BR,
    Suhas

Maybe you are looking for