Posted: Sat Nov 17, 2007 7:54 pm Post subject: List active SAP users via RFC calls - C program and RemoteFM
C program
Code:
/*
This C program lists the active sap users of a specified SAP instance
by calling an ABAP function module. The program can be placed to
/sapnmt/SID/exe, and can be used just before stopping the system.
*/
lnr = ItFill( ltab );
for ( line=1; line <= lnr; line++)
{
lpt = (char *) ItGetLine( ltab, line );
len = ab_csize( lpt, 100 );
memcpy( lst, (char *) ItGetLine( ltab, line ), len);
lst[len] = '\0';
fprintf( stdout, "%s\n", lst );
}
return 0;
}
Server remote function module
Code:
* This function module can be called from a C program to list the
* active users of the system. The structure ZTEST has to be created
* by se11.
*
FUNCTION Z_TST.
*"----------------------------------------------------------------------
*"*"Local interface:
*" TABLES
*" A STRUCTURE ZTEST
*"----------------------------------------------------------------------
DATA: OPCODE TYPE X VALUE 2.
DATA: BEGIN OF USR_TABL OCCURS 10.
INCLUDE STRUCTURE UINFO.
DATA: END OF USR_TABL.
CALL 'ThUsrInfo' ID 'OPCODE' FIELD OPCODE
ID 'TAB' FIELD USR_TABL-*SYS*.
A-A = 'CLIENT USER LAST_ACCESS_TIME EXT_SESS INT_SESS'.
APPEND A.
CLEAR A.
LOOP AT USR_TABL.
A-A+1(3) = USR_TABL-MANDT.
A-A+8(12) = USR_TABL-BNAME.
A-A+21(8) = USR_TABL-ZEIT.
A-A+37(1) = USR_TABL-EXTMODI.
A-A+46(1) = USR_TABL-INTMODI.
APPEND A.
ENDLOOP.
ENDFUNCTION.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.