Skip to Content
0
Former Member
Jul 04, 2011 at 03:31 PM

A question about BAPI_USER_GET_DETAIL

719 Views

Dear all,

I have a question about user information in SAP and I would appreciate if

you could kindly give me a hand.

In my ABAP program I need to rectreive the information that

can be viewed by using SU01 for a given sap userid (the address tab)

Here is the infomation that I need for each user:

BAPIADDR3-title_p

BAPIADDR3-lastname

BAPIADDR3-firstname

BAPIADDR3-function

BAPIADDR3-department

BAPIADDR3-room_no_p

BAPIADDR3-floor_p

BAPIADDR3-building_p

BAPIADDR3-tel1_numbr

BAPIADDR3-fax_number

BAPIADDR3-e_mail

company TYPE OF BAPIUSCOMP

And assuming that:

logondata TYPE OF BAPILOGOND

I need:

logondata-class (user group)

logondata-gltgv (user valide from <date>)

logondata-gltgb (user valide to <date>)

And assuming to have defaults TYPE OF BAPIDEFAUL

I need:

defaults-spld (user printer)

I concatenate all of these fields as pipe delimited string and I write them in

a .TXT file (one row per user). After a bit googling I found a BAPI named

BAPI_USER_GET_DETAIL which does the job pretty well and produces exactly what

I'm looking for.

Now the problem is that this BAPI provides the desired information only for

one user. As a result if I'm supposed to produce the specified .TXT file for

N users then I have to call this BAPI, N times inside a loop. Currently, the program

is being developed on a sandbox with a limited number of users. So the performance

of the program for now, is not really and issue. But the target production

system towards which this program should later be transported includes several

thousands of users and I'm really concerned about the program performance.

I activated the SQL tracing in order to have an idea about how the BAPI functions

and I observed that it does many SELECT on several tables. This means that if

there are N select statements and for example 4000 users, the BAPI inside the loop will do

at least N * 4000 SELECT statements (so N*4000 transactions between application

server and database server).

I humbly admit that I'm not at all a professional ABAP programer, but my personal

experience has shown to me that multiple SELECT statements are often lowering the

program performance rather single global SELECT statement (well, of course this

is really generally speaking and it depnds on the context of each program).

By looking the source code of the BAPI, I tried to find directly the tables

in order to write my own SQL queries. I succeeded to find several of

them but not all that is needed for my program (the code is difficult to understand

at least for me)

Consequently the only operational solution that I know is to put the BAPI inside a loop and

call it as times as the number of users.

I would like to ask whether anybody could kindly suggest a better solution ?

Thank you very much for your attention.

Kind Regards,

Dariyoosh