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

Problem with Value Request in a table control

jensupetersen
Participant
0 Likes
1,890

Hello everyone,

I have a dynpro with an editable table control on it. For the column OBJID of said table control I want to implement an F4 value help using a module in PROCESS ON VALUE-REQUEST.

Trouble is, the possible values in that column OBJID depend on the neighboring column OTYPE (this relates to table HRP1000). So when programming the VALUE REQUEST I would need to know the content of the neighboring OTYPE field in the same row. However, the PROCESS ON VALUE-REQUEST event does not initiate a field transport between dynpro (table control) and the corresponding internal table, so in my module in the PROCESS ON VALUE-REQUEST-block I don't know the content of the OTYPE field.

Is there a solution to this? In a normal PAI, I would simply code a preceding FIELD OTYPE. (with no following module command), thereby manually initiating the field transport. However, in a PROCESS ON VALUE-REQUEST-block FIELD commands with no subsequent module command are forbidden.

Is there any way to get the current OTYPE field value of that row from the table control? I could do a GET CURSOR LINE and then read the corresponding internal table, but that will not yield an altered value that the user may have entered into the table control row in the meantime - especially when the user is creating a new row which does not yet exist in the internal table.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,139

hi jens,

you can get the value of OTYPE using function 'DYNP_VALUES_READ'.



sample code is as follows:

data: OTYPE type C LENGTH 20.
  
data: begin of dynpfields occurs 3.
           include structure dynpread.
   data: end of dynpfields.

   data: repid like sy-repid.
dynpfields-fieldname = 'MARA-MATNR'.
append dynpfields.

repid = sy-repid.
call function 'DYNP_VALUES_READ'
   exporting
   dyname = repid
   dynumb = sy-dynnr
   tables
   dynpfields = dynpfields
   exceptions
   others.

read table dynpfields index 1.
OTYPE = dynpfields-fieldvalue.

MESSAGE OTYPE TYPE 'I'.

3 REPLIES 3
Read only

roberto_vacca2
Active Contributor
0 Likes
1,139

HI.

If you can see this value in debug (as global value) you'll can catch it with dynamic access.

But I don't know if it's your case.

Hope to help

Bye

Read only

Former Member
0 Likes
1,140

hi jens,

you can get the value of OTYPE using function 'DYNP_VALUES_READ'.



sample code is as follows:

data: OTYPE type C LENGTH 20.
  
data: begin of dynpfields occurs 3.
           include structure dynpread.
   data: end of dynpfields.

   data: repid like sy-repid.
dynpfields-fieldname = 'MARA-MATNR'.
append dynpfields.

repid = sy-repid.
call function 'DYNP_VALUES_READ'
   exporting
   dyname = repid
   dynumb = sy-dynnr
   tables
   dynpfields = dynpfields
   exceptions
   others.

read table dynpfields index 1.
OTYPE = dynpfields-fieldvalue.

MESSAGE OTYPE TYPE 'I'.

Read only

0 Likes
1,139

Thank you very much, Abdul! Your sample code is not perfect, but was definitely good enough to put me on the right track and earn the green star. Only thing (aside from minor cosmetics) is that in your sample code, you do not select the right row of the table control before reading the corresponding column value. I found the keys to achieving this is a GET CURSOR LINE into the STEPL column of the DYNPFIELDS table.

The accurate solution, based on your example, is this:

data: begin of tc occurs 0, " the initial table that corresponds with the table control

    OTYPE like hrp1000-otype,

    OBJID like hrp1000-objid,

end of tc.
  
data dynpfields like standard table of dynpread initial size 1 with header line.

data repid like sy-repid.


dynpfields-fieldname = 'TC-OBJID'.

get cursor line dynpfields-stepl.
append dynpfields.

repid = sy-repid.
call function 'DYNP_VALUES_READ'
   exporting
   dyname = repid
   dynumb = dynnr
   tables
   dynpfields = dynpfields
   exceptions
   others = 1.

read table dynpfields index 1.
TC-OTYPE = dynpfields-fieldvalue.

MESSAGE OTYPE TYPE 'I'.