SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

RFC



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Sep 08, 2007 6:20 pm    Post subject: RFC Reply with quote

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

Code:

CALL FUNCTION 'RFC_READ_TABLE'
  DESTINATION 'X51400'
  EXPORTING
   query_table = 'YT301'
   NO_DATA = ' '
  TABLES
    fields =
    data = tdata
  EXCEPTIONS
    table_not_available = 1
    table_without_data = 2
    option_not_valid = 3
    field_not_valid = 4
    not_authorized = 5
    data_buffer_exceeded = 6
    OTHERS = 7.

*To access to a record of tdata
READ TABLE tdata WITH KEY wa+3(3) = ifile-ist.


Code:
DATA T_DATA TYPE STANDARD TABLE OF TAB512.
 
CALL FUNCTION 'RFC_READ_TABLE' destination 'destination'
  EXPORTING
     QUERY_TABLE = 'KNB5'
  TABLES
*     OPTIONS = ???
*     FIELDS = ???
     DATA = T_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
    OTHERS = 7.


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.

PERFORM fill_options USING: 'KUNNR' '0000000001' 'AND',
                            'BUKRS' 'MAAB' space.
PERFORM fill_fields USING: 'KUNNR', 'BUKRS', 'MAHNA'.

CALL FUNCTION 'RFC_READ_TABLE'
  EXPORTING
    query_table                = 'KNB5'
*   DELIMITER                  = ' '
*   NO_DATA                    = ' '
*   ROWSKIPS                   = 0
*   ROWCOUNT                   = 0
  TABLES
    OPTIONS                    = t_options
    fields                     = t_fields
    data                       = t_data.

LOOP AT t_data.
  WRITE / t_data.
ENDLOOP.

*&---------------------------------------------------------------------*
*&      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.

CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
   destination dest
  EXPORTING
    LANGU                     = SY-LANGU
    TABNAME                   = 'SPFLI'
  TABLES
    SEL_TAB                   = wtab
    TABENTRY                  = itab
 EXCEPTIONS
   INTERNAL_ERROR            = 1
   TABLE_HAS_NO_FIELDS       = 2
   TABLE_NOT_ACTIV           = 3
   NOT_AUTHORIZED            = 4
   OTHERS                    = 5 .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.