cancel
Showing results for 
Search instead for 
Did you mean: 

Code not woking

Former Member
0 Kudos

Please get the code workig. i want to have the user-selection of DIR in a variable.if its not possible this way, plz suggest other solution.

reward guranteed.

DATA: DIR_SEL TYPE STRING.

CALL METHOD cl_gui_frontend_services=>directory_browse

EXPORTING

WINDOW_TITLE = 'Select Folder'

INITIAL_FOLDER = 'C:\'

CHANGING

selected_folder = DIR_SEL

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

others = 3.

write:/ DIR_SEL,'*******'.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anid,

Ok here is a small change to your code that works,

DATA: DIR_SEL TYPE STRING.

CALL METHOD cl_gui_frontend_services=>directory_browse

EXPORTING

WINDOW_TITLE = 'Select Folder'

INITIAL_FOLDER = 'C:\'

CHANGING

selected_folder = DIR_SEL

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

others = 3.

<b>CALL METHOD cl_gui_cfw=>flush.</b>

write:/ DIR_SEL,'*******'.

Hope this helps..

Sri

Former Member
0 Kudos

Thanks, it worked..can you explain a bit regarding

CALL METHOD cl_gui_cfw=>flush.

what it does?

Former Member
0 Kudos

Hi Anid,

Basically flush call will synchronize the automation queue (the buffered method calls to get control attributes) and gets the control (in our case, Frontend services directory select dialog) attributes from the front end.

Check the following links that explain this in detail,

http://help.sap.com/saphelp_46c/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/9b/d080ba9fc111d2bd68080009b4534c/frameset.htm

http://help.sap.com/saphelp_46c/helpdata/en/37/63bdc2e80211d2bdcb080009b4534c/frameset.htm

Sri

Former Member
0 Kudos

Thanks, those were nice links

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

even i tried it's working fine

regards,

manohar.

Former Member
0 Kudos

Hi Anid,

The code you mentioned is working perfectly fine.

I copied and tried the same.

Which problem are u facing in this code ?

Regards,

Amit M.

Former Member
0 Kudos

Hi Amit,

In my system, its only writing ****, not the dir_sel value. the dir_sel is having null value even if the user select one directory.

Any setting related problem??