Application Development 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: 

Problem with Method environment_get_variable (Windows GUI)

Former Member
0 Kudos

Hello,

I want to use the Method "cl_gui_frontend_services=>environment_get_variable".

I try this coding with same keywords ('%TMP%', 'TMP', ...), but the result is ever sy-subrc = 0 und s_path is initial.

DATA s_path TYPE string.

CALL METHOD cl_gui_frontend_services=>environment_get_variable

EXPORTING

variable = 'USERPROFILE'

CHANGING

value = s_path

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Please, can every body tell what is wrong.

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

If Ralf's suggestion doesn't help, after the CALL METHOD cl_gui_frontend_services=>environment_get_variable

CALL METHOD cl_gui_cfw=>flush

before looking at the value returned in s_path.

2 REPLIES 2

Former Member
0 Kudos

hi,

seems to be a problem with java environment...

see link and note

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_fes/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31303237303133%7d]

take a look at the env-variable:

QTJAVA=d:Javajre1.5.0_11libextQTJava.zip

and try to change it to older relase (1.4!)

Bye

Former Member
0 Kudos

If Ralf's suggestion doesn't help, after the CALL METHOD cl_gui_frontend_services=>environment_get_variable

CALL METHOD cl_gui_cfw=>flush

before looking at the value returned in s_path.