2014 Dec 18 5:19 PM
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.
2014 Dec 18 7:02 PM
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'.
2014 Dec 18 5:34 PM
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
2014 Dec 18 7:02 PM
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'.
2014 Dec 19 1:31 PM
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'.