Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Function module Registry_get

Former Member
0 Likes
1,039

Hi All,

We are going for upgrade from 4.6 to ECC 6.0.Function module REGISTRY_GET is obselete in 4.6 instead of this i have used class CL_GUI_FRONTEND_SERVICES method 'registry_get_value' .But the there is a diffrence in number of parameter passed in function module and that class method.Below is the code both in 4.6 and ECC 6.0.

In 4.6 it was as below:

CALL FUNCTION 'REGISTRY_GET'

EXPORTING

KEY = 'protocol\StdFileEditing\server'

SECTION = 'ExcelWorksheet'

IMPORTING

VALUE = EXCEL_PATH.

Now in ECC 6.0 i replaced as below:

call method cl_gui_frontend_services=>registry_get_value

exporting

root = cl_gui_frontend_services=>hkey_classes_root

key = 'protocol\StdFileEditing\server'

value = ''

importing

reg_value = reg_value

exceptions

get_regvalue_failed = 1

cntl_error = 2

error_no_gui = 3

others = 4.

If i compair both the code then parameters differ's.But i am not able to undestand what the use of these parameter.Please sugest if i am doing the right thing in ECC6.0 and please also let me know the replacement of function module 'Profile_GET' used as below in 4.6:

call function 'PROFILE_GET'

exporting

filename = 'front.ini'

key = 'Path'

section = 'Filetransfer'

importing

value = dir_path

exceptions

others = 1.

Thanks

Mohit

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
827

Sample to understand :

Code 46C

*     Test, ob OrgPublisher lokal installiert ist
      CALL FUNCTION 'REGISTRY_GET'
           EXPORTING
                key     = 'CLSID'
                section = 'OrgPublisher.Document.2'
           IMPORTING
                value   = class_id.
      IF class_id IS INITIAL.

Code ECC 6.0

      CALL METHOD cl_gui_frontend_services=>registry_get_value
        EXPORTING
          root         = cl_gui_frontend_services=>hkey_classes_root
          key          = 'OrgPublisher.Document.2\CLSID'
        IMPORTING
          reg_value            = class_id
        EXCEPTIONS
          get_regvalue_failed  = 1
          cntl_error           = 2
          error_no_gui         = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      CALL METHOD cl_gui_cfw=>flush
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      IF class_id IS INITIAL OR sy-subrc NE 0.

Regards,

Raymond

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
0 Likes
828

Sample to understand :

Code 46C

*     Test, ob OrgPublisher lokal installiert ist
      CALL FUNCTION 'REGISTRY_GET'
           EXPORTING
                key     = 'CLSID'
                section = 'OrgPublisher.Document.2'
           IMPORTING
                value   = class_id.
      IF class_id IS INITIAL.

Code ECC 6.0

      CALL METHOD cl_gui_frontend_services=>registry_get_value
        EXPORTING
          root         = cl_gui_frontend_services=>hkey_classes_root
          key          = 'OrgPublisher.Document.2\CLSID'
        IMPORTING
          reg_value            = class_id
        EXCEPTIONS
          get_regvalue_failed  = 1
          cntl_error           = 2
          error_no_gui         = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      CALL METHOD cl_gui_cfw=>flush
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      IF class_id IS INITIAL OR sy-subrc NE 0.

Regards,

Raymond

Read only

RaymondGiuseppi
Active Contributor
0 Likes
827

Second sample to understand :

Code 46C

      CALL FUNCTION 'PROFILE_GET'
           EXPORTING
                filename = 'front.ini'
                key      = 'Path'
                section  = 'Filetransfer'
           IMPORTING
                value    = path.

Code ECC 6.0

    CALL FUNCTION 'GUI_GET_REGVALUE'
      EXPORTING
        ROOT           = 2
        KEY            = 'software\sap\sap shared'
        VALUE_NAME     = 'sapworkdir'
      CHANGING
        STRING         = path
      EXCEPTIONS
        REGISTRY_ERROR = 1
        OTHERS         = 2.

Regards,

Raymond

Read only

0 Likes
827

Hi ,

Thanks for your help.I have one more query where i should pass value of 'section = 'Filetransfer'. in below function module:

CALL FUNCTION 'GUI_GET_REGVALUE'

EXPORTING

ROOT = 2

KEY = 'software\sap\sap shared'

VALUE_NAME = 'sapworkdir'

CHANGING

STRING = path

EXCEPTIONS

REGISTRY_ERROR = 1

OTHERS = 2.

Thanks

mohit

Read only

0 Likes
827

"Filetransfer'" has become "'sapworkdir", if found it initially within a SAP OSS note that corrected one of their program which used the obsolete function module.

Regards,

Raymond

PS: note found (again) [Note 966310 - Local copies of documents not in SapWorkDir|https://service.sap.com/sap/support/notes/966310] read the source correction for the FORM GET_DISPLAY_DIR. (applicable since 46C...)

Edited by: Raymond Giuseppi on Sep 24, 2009 6:45 PM

Read only

0 Likes
827

Hi Raymond,

Thanks for your help.I have seen this note but i believe it's applicable till 4.6 only.Shaii i go ahead with correction in ECC 6.0 with using ''GUI_GET_REGVALUE' function module instead of 'Profile_GET'.

Thanks

Mohit