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

ABAP Basics: FUNCTION 'DYNP_VALUES_UPDATE'

Clemenss
Active Contributor
0 Likes
704

Hi,

in a selection-screen-event (AT SELECTION-SCREEN ON RADIOBUTTON GROUP dest.) I want to modify another screen field depending on the input for the 2 radiobutton fields.

The exit is only processed after I declared the first parameter with addition "USER-COMMAND dest". I don't understand why, but it's OK.

Now comes the dilemma:

When changing the radiobutton first, the event is processed and the value on the selection screen replaced.

When I do it again, the event is processed, but the replament does not work.

I'm using DYNP_VALUES_UPDATE as shown below:

<pre>

FORM dynp_values_update USING pv_field TYPE fieldname

pv_value TYPE any.

DATA:

lv_dyname TYPE d020s-prog,

lv_dynumb TYPE d020s-dnum,

lt_dynpfields TYPE STANDARD TABLE OF dynpread WITH DEFAULT KEY,

ls_dynpfields TYPE dynpread.

FIELD-SYMBOLS:

<dynpfields> TYPE dynpread.

lv_dyname = sy-repid.

lv_dynumb = sy-dynnr.

ls_dynpfields-fieldname = pv_field.

ls_dynpfields-fieldvalue = pv_value.

APPEND ls_dynpfields TO lt_dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = lv_dyname

dynumb = lv_dynumb

TABLES

dynpfields = lt_dynpfields

EXCEPTIONS

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

undefind_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

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

ENDIF.

ENDFORM. " dynp_values_update

</pre>

Sy-Subrc is zero - what's wrong? Obviously the update takes place only if the screen field is empty.

Please help me, thank you.

Regards,

Clemens

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
572

First, the event is only fired when you use the extension USER-COMMAND because the action of selecting the radiobutton now triggers a round trip.

To help with your real problem, I would have to see the entire coding, can you post this or send to my email address on my BC.

Regards,

Rich Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
572

Please check this sample program, here there is no need to use the DYNPRO_VALUE_UPDATE.



report zrich_0001 .

parameters: p_rad1 radiobutton group dest user-command chk,
            p_rad2 radiobutton group dest,
            p_file type localfile.

<b>
* Comment out this event
*at selection-screen on radiobutton group dest.</b>

<b>at selection-screen output.
  if p_rad1 = 'X'.
    p_file =  'C:/TestFile1.txt'.
  elseif p_rad2 = 'X'.
    p_file =  'C:/TestFile2.txt'.
  endif.</b>


Regards,

Rich Heilman

Read only

Clemenss
Active Contributor
0 Likes
572

I created a

selection-screen begin of block ...

and end of block... araound my parameters

and use at selection-screen on block.

Now it works fine.