on 08-24-2014 12:03 AM
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?
Hi Frank,
For reading user with Filter in Read Pass, you can use filter as shown below (for example, reading all dialog and unlocked users).
FILTER SELECTION_EXP:0/LOGOP=AND
FILTER1 SELECTION_EXP:0/ARITY=2
FILTER2 SELECTION_EXP:1/PARAMETER=LOGONDATA
FILTER3 SELECTION_EXP:1/FIELD=USTYP
FILTER4 SELECTION_EXP:1/OPTION=EQ
FILTER5 SELECTION_EXP:1/LOW=A
FILTER6 SELECTION_EXP:2/PARAMETER=LOGONDATA
FILTER7 SELECTION_EXP:2/FIELD=UFLAG
FILTER8 SELECTION_EXP:2/OPTION=EQ
FILTER9 SELECTION_EXP:2/LOW=0
You would find more details in sap note 1398976 where BAPI "BAPI_USER_GETLIST" would have information about applicable fields for filter if you have different requirements.
Regards,
Pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
You can use SELECTION_RANGE option in source tab. I havent done for users filter till now but the role filter I tried looks like this for reading Z1* and Z2* roles from SAP.
Can you play around with options by changing parameter after "SELECTION_RANGE/" to get desired result. Experts here would have exact solution for your requirement if you wait.
Kind regards,
Jaisuryan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jaisuryan,
this is the special FILTER for roles (you do not need to specify the field name AGR_NAME) and there exist other special filters for users according to note 13998976.
http://service.sap.com/sap/support/notes/1398976
But it seems that there is no solution for ENTRYTYPE=TABLE in general !?
KInd rgards
Frank
By the way, with ABAP selections you either can select by range (BT=between) or by pattern (CP=contains pattern) but you cannot mix both types of selections. The characters '*' and '?' are only interpreted as pattern characters within a CP or NP selection. With EQ, NE, GT, ..., BT they are just ordinary letters having a specific location in the ASCII character set.
The example does not work as expected:
I(nclude) BT Z1* Z2*
To get all entries starting with Z1 or Z2 you need this selection:
I(nclude) BT Z1 Z2
I(nclude) CP Z2*
The first line gets everything between 'Z1 ' and 'Z2 ' including these values. You see the spaces? The third character of 'Z1 ' is a space which has a lower position in the ASCII set than any other character which means that e.g. 'Z1a' is in scope but not 'Z2a'.
The second line adds everything which starts with Z2, i.e. 'Z2a'.
Kind reagrds
Frank
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.