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

Odd behaviour with parameter id on selection screen

matt
Active Contributor
0 Likes
1,896

Try this code

PARAMETERS: p_fpath1 TYPE string LOWER CASE MEMORY ID rofile,
            p_fpath2 TYPE string LOWER CASE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath1.
  PERFORM get_filepath CHANGING p_fpath1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath2.
  PERFORM get_filepath CHANGING p_fpath2.


*---------Forms
FORM get_filepath CHANGING x_filepath TYPE string.

  DATA: l_filepath TYPE string.

  cl_gui_frontend_services=>directory_browse( CHANGING selected_folder = l_filepath ).

* If no filepath selected, leave the filepath unchanged
  IF l_filepath IS NOT INITIAL.
    x_filepath = l_filepath.
  ENDIF.

ENDFORM.

Run the program, and use F4 to choose a file path for p_fpath1 and another for p_fpath2.

Hit execute

Leave the program.

Run the program again.

Use F4 to choose the filepaths for the two parameters.

For me, it's fine for p_fpath2, but for p_fpath1, I get no directory selector. In fact, to get it working again, I have to log off and log back on.

I'd like to know if anyone else gets the same problem, and also if anyone knows how to fix it!

thanks

matt

1 ACCEPTED SOLUTION
Read only

raghavendra_sm2
Explorer
0 Likes
1,853

PARAMETERS: p_fpath1 TYPE string LOWER CASE MEMORY ID rofile,

p_fpath2 TYPE string LOWER CASE.

statement memory id rofile is creating this problem

because program saves the last value of variable p_fpath1 into sap memoryand retrives it back in next execution so try clearing this memory.

hope this will help you

regards

raghu

13 REPLIES 13
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,853

Hi matt,

I tried your piece of code and it works perfectly fine for me .

Rgds,

Sandeep

Read only

0 Likes
1,853

Ok - looks like a gui error then.

Can you confirm your gui version and ABAP stack version?

I'm on 7100.3.12.3123, build 1046700, patch 12 for SAPGui, and

SAP_ABA 700 0016 SAPKA70016 Cross-Application Component

SAP_BASIS 700 0016 SAPKB70016 SAP Basis Component

For the app. server.

Please note, you have to follow the exact steps to get the behaviour. If you don't hit execute it works fine! ( which isn't much use for a report program )

matt

Read only

Former Member
0 Likes
1,853

Tried it out and it is indeed not working.

Haven't got an idea why this is happening and how to solve it though.

edit:

And i'm on:

7100.2.8.3083 build 983952 SP level 8

SAP_ABA 700 0014 SAPKA70014

SAP_BASIS 700 0014 SAPKB70014

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,853

Hello Matt,

I also feel it's a GUI problem. May be other SDNers will have a better answer to this. Anyways can use the method cl_gui_cfw=>flush after the cl_gui_frontend_services=>directory_browse.

cl_gui_frontend_services=>directory_browse( CHANGING selected_folder = l_filepath ).
CALL METHOD cl_gui_cfw=>flush.

Hope this helps.

BR,

SUhas

Read only

matt
Active Contributor
0 Likes
1,853

>

> Hello Matt,

>

> I also feel it's a GUI problem. May be other SDNers will have a better answer to this. Anyways can use the method cl_gui_cfw=>flush after the cl_gui_frontend_services=>directory_browse.

>

>

cl_gui_frontend_services=>directory_browse( CHANGING selected_folder = l_filepath ).
> CALL METHOD cl_gui_cfw=>flush.

>

> Hope this helps.

>

> BR,

> SUhas

Great bit of thinking there! But didn't work...

Read only

raghavendra_sm2
Explorer
0 Likes
1,854

PARAMETERS: p_fpath1 TYPE string LOWER CASE MEMORY ID rofile,

p_fpath2 TYPE string LOWER CASE.

statement memory id rofile is creating this problem

because program saves the last value of variable p_fpath1 into sap memoryand retrives it back in next execution so try clearing this memory.

hope this will help you

regards

raghu

Read only

0 Likes
1,853

>

> PARAMETERS: p_fpath1 TYPE string LOWER CASE MEMORY ID rofile,

> p_fpath2 TYPE string LOWER CASE.

> statement memory id rofile is creating this problem

> because program saves the last value of variable p_fpath1 into sap memoryand retrives it back in next execution so try clearing this memory.

> hope this will help you

> regards

> raghu

...and Gurpreet Singh...

The behaviour I want is for the user to get the same path when they re-run the tranasaction. So clearing the memory isn't going to help, is it? Think about it...

matt

Read only

0 Likes
1,853

Funny thing is: when you enter a SPACE or any other character and then hit F4, it seems to work again (at least in my case).

But i don't think you can expect a user to enter a space or other character before hitting F4.

Read only

0 Likes
1,853

The issue was with the STRING VARIABLE in parameters decelaration.I just changed it to RLGRAP-FILENAME it worked.

Try these codes.

PARAMETERS: p_fpath1 TYPE rlgrap-filename LOWER CASE MEMORY ID rofile,
            p_fpath2 TYPE rlgrap-filename LOWER CASE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath1.
  PERFORM get_filepath CHANGING p_fpath1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath2.
  PERFORM get_filepath CHANGING p_fpath2.


START-OF-SELECTION.
  WRITE : p_fpath1,p_fpath2.
*---------Forms
FORM get_filepath CHANGING x_filepath TYPE rlgrap-filename.
*CALL METHOD cl_gui_cfw=>flush.
  DATA: l_filepath TYPE string.
  CLEAR :l_filepath,x_filepath.
  cl_gui_frontend_services=>directory_browse( CHANGING selected_folder = l_filepath ).

* If no filepath selected, leave the filepath unchanged
  IF l_filepath IS NOT INITIAL.
    x_filepath = l_filepath.
  ENDIF.

ENDFORM.                    "get_filepath

LAST ENTERED VALUE WILL ALSO DISPLAY

These codes work.

Regards,

Gurpreet

Read only

0 Likes
1,853

I changed it to CHAR255, which should be sufficient. It seems that parameter ids and strings don't get on very well. As was point out, with a string, the F4 event wasn't even being processed.

Anyway - thanks for your help.

matt

Read only

Former Member
0 Likes
1,853

I tried to replicate the Same scenario.I faced the same issue but when i set a break point and tried Debugging event AT selection-screen on Value request is not trigerring at all.

I think its the issue with the Memory Id of the Parameter i just tried to remove the memory Id from the Path1 the F4 help was displayed.

Try to clear the Memory Id.

You need to clear the session memory.

Regards,

Gurpreet

Edited by: Gurpreet Singh on Apr 14, 2009 11:02 AM

Read only

naimesh_patel
Active Contributor
0 Likes
1,853

MEMORY ID is causing the problem..

Addition 4

... MEMORY ID pid

Effect

This addition links the input field of the parameter with a SPA/GPA parameter in the SAP Memory. The name of the SPA/GPA parameter must be specified directly and with a maximum of 20 characters

The input.field is filled - when the selection screen is called - with the current value of the SAP/GPA parameter in the SAP memory, provided the data object para is initial after processing of the event AT SELECTION-SCREEN OUTPUT. Otherwise, the value of para is displayed. If there is a user action on the selection screen, the content of the input field is assigned to the SPA/GPA parameter in the SAP memory. If no SPA/GPA parameter exists for the specified name, it will be created.

Regards,

Naimesh Patel

Read only

matt
Active Contributor
0 Likes
1,853

No, it isn't. Read the answers above. It's having string parameter that causes it.