‎2005 Mar 11 8:04 AM
Hi,
I'm building an application, where in the selection screen there are linked drop-down list. So the user select value in the first drop-down list, then in the second one the values will be available, which are linked to the selected value. Same for the third one...based on the selected value in the second drop-down list.
Is there a good example in SAP R/3 46C for this?
I found RSDEMO_DROPDOWN_LISTBOX, but this one is not really what I was looking for.
My problem is the following:
User select value in the first one and then in the second one. When the user goes back and select value in the first one again, the value from the second selection is still in the list althought I cleared the value table and the screen field.
Any idea about this?
Thanks in advance,
Peter
‎2005 Mar 11 10:28 AM
Hello Peter,
I've been trying to follow this thread and I have now got a doubt. Are you trying to use the <i>dropdown list</i> or the <i>F4 Help</i>?
There has been much confusion between these terms and your second post in this thread where you have given some code (esp. the call to the FM F4IF_INT_TABLE_VALUE_REQUEST)makes me ask you this question.
What you get when you use the FM VRM_SET_VALUES can only be called a drop-down list, at least as far as ABAP is concerned.
Please confirm this and I shall start working on your problem.
Regards,
Anand Mandalika.
Not that it makes too much of a difference, but, are you using a selection screen or a normal screen?
‎2005 Mar 11 8:31 AM
Hi Peter
If you are building a transaction then I believe you must use FM DYNP_VALUES_UPDATE to clear the other fields when responding to the user input for the drop down in the PAI.
I did something similar the other week so hopefully I am not misleading you here. My scenario was that I had a dropdown and when the user chosed an alternative then two other fields should be updated as well. The solution was to use the above mentioned FM.
Hope this helps,
Regards, Johan
‎2005 Mar 11 9:33 AM
Hi Johan,
I believe you're right with this FM, however probable I do something wrong as it's not getting updated:-(
I checked the documentation/example program for this FM, but still I miss something.
The flow logic of my screen:
PROCESS BEFORE OUTPUT.
MODULE status_9000.
PROCESS AFTER INPUT.
MODULE exit_9000 AT EXIT-COMMAND.
MODULE save_okcode_9000.
MODULE user_command_9000.
PROCESS ON VALUE-REQUEST.
FIELD p_orgname_1 MODULE orgname_1_f4.
FIELD p_orgname_2 MODULE orgname_2_f4.
FIELD p_orgname_3 MODULE orgname_3_f4.My module for the second field:
*&---------------------------------------------------------------------*
*& Module orgname_2_f4 INPUT
*&---------------------------------------------------------------------*
* Org level 2
*----------------------------------------------------------------------*
MODULE orgname_2_f4 INPUT.
* Clear values
CLEAR p_orgname_2.
REFRESH git_org_sel_2.
* Fill value itab for the second field
SELECT s~org o~orgname
FROM zca_arch_struct AS s
INNER JOIN zca_arch_org AS o
ON s~org = o~org AND
s~orgtyp = o~orgtype
INTO TABLE git_org_sel_2
WHERE s~parent_org = p_orgname_1
AND s~orgtyp IN ('SUB_AREA', 'SUB_LINE')
AND s~parent_typ IN ('AREA', 'BU_LINE').
* \ Test - Try to reset field 2
BREAK-POINT.
DATA:
git_dynpfields TYPE TABLE OF dynpread,
gwa_dynpfields TYPE dynpread.
gwa_dynpfields-fieldname = 'P_ORGNAME_2'.
gwa_dynpfields-fieldvalue = space.
APPEND gwa_dynpfields TO git_dynpfields.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = git_dynpfields
EXCEPTIONS
OTHERS = 01.
IF sy-subrc <> 0.
"? add later
ENDIF.
* // Test - Try to reset field 2
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'ORG'
value_org = 'S'
TABLES
value_tab = git_org_sel_2
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc = 0.
*
ENDIF.
ENDMODULE. " orgname_2_f4 INPUT
P_ORGNAME_2 is the fieldname for drop-down list and git_org_sel_2 contains the values for the drop-down list.
May be I have to place this FM somewhere else.
In the debugger I can see that this FM is called successfully, there is no exception.
Do you have any idea, what is wrong?
Thanks a lot in advance,
Peter
‎2005 Mar 11 9:56 AM
Hi Peter,
Have a look at this demo program DEMO_DYNPRO_F4_HELP_MODULE.
Thanks
Lakshman
‎2005 Mar 11 10:13 AM
Hi Tandra,
Thanks for your help (also for your previous example).
Unfortunately program DEMO_DYNPRO_F4_HELP_MODULE has the same error as my program...if selest something from the first field, then in the second, then again in the first, the second field not getting cleared.
Peter
‎2005 Mar 11 11:14 AM
Hi Peter,
Try like this, If you want to make 'p_orgname_2' fieldvalue to blank, place the the logic what you have mentioned in the module 'orgname_1_f4' of field 'p_orgname_1'.
Thanks
Lakshman
Message was edited by: Lakshman Tandra
‎2005 Mar 11 1:13 PM
Hi Lakshman,
Sorry I cannot get your message.
My logic is almost the same for 'p_orgname_1' and 'p_orgname_2'.
Can you try to rephase it?
Thanks in advance,
Peter
‎2005 Mar 11 1:33 PM
Hi again Peter
Been to lunch etc. I think I know what your problem is:
You must change field2, field3 etc directly in the module where you take care of field1. As from your coding you try to do the update when doing F4 for field2.
So, try to move relevant parts from your coding into module:
FIELD p_orgname_1 MODULE orgname_1_f4.
I think it should work then. (This is again similar to what I had to do. I also had 3 POV and the first one should influence the other two like in your case.)
Hope this helps,
Regards, Johan
‎2005 Mar 11 1:47 PM
Hi Peter,
What I mean to say is, the logic whatever you have posted is written in FIELD p_orgname_2 MODULE orgname_2_f4.
and in the same logic you are trying to clear the P_ORGNAME_2 field. Instead write the logic for clearing P_ORGNAME_2 fieldvalue in FIELD p_orgname_1 MODULE orgname_1_f4 itself.
Thanks
Lakshman
‎2005 Mar 11 8:38 AM
Hi Peter,
There is demo program similar to the one you have mentioned. Have a look at this program DEMO_DYNPRO_DROPDOWN_LISTBOX.
Thanks
Lakshman
‎2005 Mar 11 10:28 AM
Hello Peter,
I've been trying to follow this thread and I have now got a doubt. Are you trying to use the <i>dropdown list</i> or the <i>F4 Help</i>?
There has been much confusion between these terms and your second post in this thread where you have given some code (esp. the call to the FM F4IF_INT_TABLE_VALUE_REQUEST)makes me ask you this question.
What you get when you use the FM VRM_SET_VALUES can only be called a drop-down list, at least as far as ABAP is concerned.
Please confirm this and I shall start working on your problem.
Regards,
Anand Mandalika.
Not that it makes too much of a difference, but, are you using a selection screen or a normal screen?
‎2005 Mar 11 10:40 AM
Hi Anand,
It's good to see that you are also in the forum.
Sorry not to be clear enough.
My answers:
- I use drop-down list.
FM F4IF_INT_TABLE_VALUE_REQUEST works fine in this case also.
- I use normal screen (I never found the way to use drop-down list on selection screen)...and that's why I have modules, not events.
If you need further info, just let me know.
Thanks,
Peter
‎2005 Mar 11 10:53 AM
Hi,
I shall list the sequence of operations that you are performing, just correct me if I go wrong:
1. A value is selected for FIELD1.
2. The values for FIELD2 appear as expected (based on the value in FIELD1)
3. The value in FIELD1 is now changed.
4. The values for FIELD2 do not get reflected from the new value of FIELD1. Instead, we see the same values as in step 2.
If this is the case, then in the code that you have pasted in your second post of this thread, do you have the correct (the new one) value for the FIELD1 ? Or do you still have the same old one ?
Regards,
Anand Mandalika.
‎2005 Mar 11 11:03 AM
Hi,
The sequence is:
0. The values for FIELD1 appear as expected.
1. A value is selected for FIELD1.
2. The values for FIELD2 appear as expected (based on the value in FIELD1)
3. The value in FIELD1 is now changed.
4. The values for FIELD2 is updated, but there is still an extra value, which was selected on step 2.
5. If the user selects drop-down for FIELD2 again, the old value disappears.
So what bothers me that the old value is still there.
To make the picture complete: in the dropdown list, there is a list of values plus the description for them. In step 4, the old key valus is still there, but the description disappeared.
Peter
‎2005 Mar 11 11:12 AM
Hi Peter,
I'm just writing a test program to see what's happenning. In the meanwhile, just try this:
data : w_repid type syrepid,
w_dynnr type sydynnr.
w_repid = sy-repid.
w_dynnr = sy-dynnr.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = w_repid
dynumb = w_dynnr
TABLES
dynpfields = git_dynpfields
EXCEPTIONS
OTHERS = 01.
IF sy-subrc <> 0.
"? add later
ENDIF.Regards,
Anand Mandalika.
‎2005 Mar 11 11:34 AM
If you still don't get the things working, then DYNP_UPDATE_FIELDS might be a more appropriate FM. It seems to be slightly different from the other one.
‎2005 Mar 11 1:09 PM
Hi Anand,
Sorry, I don't get where/when/why/how should I use FM 'DYNP_VALUES_UPDATE'. I already added to my code (as it's shown in my code example above) without any result:-(
Peter
‎2005 Mar 11 1:11 PM
Thanks Anand, I'll try.
Unfortunately I just had to reorganize my control tables, so I have to rewrite my code a little bit, so I cannot test it in this moment:-(
Peter
‎2005 Mar 11 1:13 PM
Hi Peter,
Am sorry for being so vague.
what I meant is that you should try to use the temporary variables in calling the FM instead of directly using the system variables.
You call the Fm exactly at the same place that you have, but don't use the system variables (sy-cprog,sy-dynnr) drectly in the FM's interface.
Regards,
Anand Mandalika.
‎2005 Mar 11 3:56 PM
Hi everyone,
Thanks for everyone for your help.
Unfortunately I tried the suggestion, but I couldn't get further:-(
A)Tried sy-cprog,sy-dynnr -> There was no change at all.
B)Tried DYNP_UPDATE_FIELDS ... although in debugger every internal table was filled correctly, in the screen all the dropdown was initial.
C)Tried to link the 3 POV module together/move the logic from the 2nd to the first -> Same result as in case of B.
I think I will put apart this part for a while, leave it to the end of the implementation, when everything else works fine...may be I can get further with fresher mind.
Thanks again,
Peter
‎2005 Mar 17 3:32 PM
Find the solution:
Somehow in 'MODULE orgname_2_f4 INPUT.' although I cleared the field, it was not cleared in the screen itself.
However in module 'MODULE user_command_9000.' I could delete the drop-down values.
It works fine so far:-)
Thanks for everyone, who helped me!
Peter
*&---------------------------------------------------------------------*
*& Module user_command_9000 INPUT
*&---------------------------------------------------------------------*
* 9000 User command
*----------------------------------------------------------------------*
MODULE user_command_9000.
CASE gv_save_ok.
WHEN 'DISPLAY'.
....
WHEN 'L_1'. "Drop-down for Level1
CLEAR p_orgname_2.
REFRESH git_org_sel_2.
CLEAR p_orgname_3.
REFRESH git_org_sel_3.
WHEN 'L_2'. "Drop-down for Level2
CLEAR p_orgname_3.
REFRESH git_org_sel_3.
ENDCASE.
ENDMODULE. "user_command_9000 INPUT