Posted: Sat Sep 08, 2007 6:20 pm Post subject: RFC
SAPGUI_PROGRESS_INDICATOR - Set 'Progress Indicator' in Current Window.
Code:
DATA: A LIKE SY-UCOMM.
DO 100 TIMES.
DO 300 TIMES.
GET TIME.
ENDDO.
A(3) = SY-INDEX.A+3 = '%'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = SY-INDEX
TEXT = A.
ENDDO.
SAPGUI_SET_FUNCTIONCODE - Set a function code and continue processing.
This module simulates user input in the command field. This enables you to run screen sequences without user input.
Since the function SAPGUI_SET_FUNCTIONCODE is not implemented for all front end platforms, you may need to use a substitute solution.
For example:
Code:
call function 'SAPGUI_SET_FUNCTIONCODE' exporting functioncode = 'ABCD'
exceptions function_not_supported = 1.
if sy-subrc <> 0.
suppress dialog.
endif. "For Motif etc.
RFC_SYSTEM_INFO - Returns System Information.
If destination = 'SAPGUI" then returns:
- SAP character set;
- SAPGUI version;
- Frontend computer Name, Operating System and IP-address etc.
Example.
Code:
REPORT ZVV001F .
DATA SI LIKE RFCSI.
CALL FUNCTION 'RFC_SYSTEM_INFO' DESTINATION 'SAPGUI'
IMPORTING
RFCSI_EXPORT = SI.
WRITE:
/ 'RFC log version:', SI-RFCPROTO,
/ 'Character set (SAP name):', SI-RFCCHARTYP,
/ 'Integer format (1 / 2 = little / big endian):', SI-RFCINTTYP,
/ 'Floating point format (1=IEEE, 2=IBM/370 format):', SI-RFCFLOTYP,
/ 'Logical destination (specified when calling function):', SI-RFCDEST,
/ 'Host:', SI-RFCHOST,
/ 'System: SAP System ID:', SI-RFCSYSID,
/ 'System: SAP System ID:', SI-RFCDATABS,
/ 'Database host name:', SI-RFCDBHOST,
/ 'System: Database system:', SI-RFCDBSYS,
/ 'System: SAP Release:', SI-RFCSAPRL,
/ 'RFC: SAP machine ID:', SI-RFCMACH,
/ 'System: Operating system:', SI-RFCOPSYS,
/ 'Time zone (difference from UTC in seconds):', SI-RFCTZONE,
/ 'Summertime active ? (''daylight saving time''):', SI-RFCDAYST,
/ 'IP address:', SI-RFCIPADDR.
TH_USER_INFO - Returns User Information.
IP address, computer name, sessions.
Code:
REPORT ZVV0IP .
DATA: W_HOSTADDR LIKE MSXXLIST-HOSTADR,
W_TERMINAL(30) TYPE C,
w_1 type i,
w_2 like w_1,
w_3 like w_1,
w_4 like w_1.
CALL FUNCTION 'TH_USER_INFO'
IMPORTING
HOSTADDR = W_HOSTADDR
TERMINAL = W_TERMINAL
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
w_1 = W_HOSTADDR(1).
w_2 = W_HOSTADDR+1(1).
w_3 = W_HOSTADDR+2(1).
w_4 = W_HOSTADDR+3(1).
WRITE: / 'IP address:', w_1,'.',w_2,'.',w_3,'.',w_4,
/ 'Terminal :', W_TERMINAL.
ELSE.
WRITE / 'Unknown Error.'.
ENDIF.
TH_LONG_USR_INFO - Returns User Sessions Information.
TH_POPUP - Send message to a SAP user.
The message will appear in SAPGUI popup window. The user can be in other mandant (parameter CLIENT) or SAP system (call ... destination DEST ...)
TH_REM_TRANSACTION - Call transaction [using bdctab]. Remotely if call ... destination DEST ...
TH_REMOTE_TRANSACTION - Login and Call transaction [using bdctab] on remoted system (parameter DEST).
TH_SAP_LOGIN - Login and Call transaction [using bdctab] on remoted system (call ... destination DEST ...). Called from TH_REMOTE_TRANSACTION
TERMINAL_ID_GET - Returns IP-address and Terminal(Computer) Id for the particular SAP User.
RFC_READ_TABLE - External access to R/3 tables via RFC As of 4.6c, not Released to Customers
The query result is stored in the internal table T_DATA.
You need to transfer OPTIONS only if u need to create a filter in oder to select certain records, you need to transfer FIELDS only if u nedd to extract the data of certain fields of KNB5
See this sample:
Code:
DATA: t_options TYPE TABLE OF rfc_db_opt WITH HEADER LINE.
DATA: t_fields TYPE TABLE OF rfc_db_fld WITH HEADER LINE.
DATA: t_data TYPE TABLE OF tab512 WITH HEADER LINE.
*&---------------------------------------------------------------------*
*& Form FILL_OPTIONS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FIELD text
* -->P_VALUE text
* -->P_OPT text
*----------------------------------------------------------------------*
FORM fill_options USING p_field
p_value
p_opt.
DATA: value(15).
CONCATENATE '''' p_value '''' INTO value.
CONCATENATE p_field '=' value p_opt INTO t_options SEPARATED BY space.
APPEND t_options.
ENDFORM. " FILL_OPTIONS
*&---------------------------------------------------------------------*
*& Form FILL_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0045 text
*----------------------------------------------------------------------*
FORM fill_fields USING p_field.
t_fields-fieldname = p_field.
APPEND t_fields.
ENDFORM. " FILL_FIELDS
The table T_FIELDS is usually empty, but u should consider the system store the data in a string of 512 char.
Anyway how to call this FM depends on from you need to call it.
TH_DELETE_USER - Logoff a user. Similar results to using SM04.
TH_ENVIRONMENT - Get the UNIX environment
TABLE_ENTRIES_GET_VIA_RFC
Code:
data: wtab type BDSEL_STAT occurs 0 with header line.
data hname(5) value '''LH'''.
concatenate 'CARRID =' hname into wtab-zeile separated by space.
append wtab.
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.