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

Getting user input for F4 help

Former Member
0 Likes
1,083

Hi Guys,

I've a question, I'm sure it's something stupid but I can't get it right.

In a report, I use the event :at selection-screen on value-request for a parameter P_APPID. To get a value help for the parameter p_appid.

I'd like to use the value of another parameter in this event. But the parameter is always empty before I go to the start-of-selection. What do I have to do to get what the user type in the first parameter P_PER_CE before the start-of-selection

parameters:

P_PER_CE(5) type C

P_APPID(5) type C,

at selection-screen on value-request for P_APPID.

select * from mytable where per_ce = P_PER_CE // Even if the user entered something in P_PER_CE the value of P_PER_CE is still initial.

start-of-selection.

// here I can use P_PER_CE, it has a value.

rest of the code

1 ACCEPTED SOLUTION
Read only

venkat_o
Active Contributor
0 Likes
889

Clarke, Try this way.

 REPORT ztest_notepad.

 DATA: BEGIN OF it_marc OCCURS 0,
         matnr TYPE marc-matnr,
         werks TYPE marc-werks,
       END OF it_marc.
 DATA:it_dynpread TYPE TABLE OF dynpread,
      wa_dynpread LIKE LINE OF it_dynpread.
 DATA: it_return_tab TYPE ddshretval OCCURS 0,
       wa_return LIKE LINE OF it_return_tab.
 PARAMETERS:
         p_werks TYPE marc-werks,
         p_matnr TYPE marc-matnr.

 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

   wa_dynpread-fieldname = 'P_WERKS'.
   APPEND wa_dynpread TO it_dynpread.
   CLEAR  wa_dynpread.
  "DYNP_VALUES_READ read screen 
   CALL FUNCTION 'DYNP_VALUES_READ'
     EXPORTING
       dyname     = sy-repid
       dynumb     = sy-dynnr
     TABLES
       dynpfields = it_dynpread.
   READ TABLE it_dynpread INTO wa_dynpread INDEX 1.
   p_werks = wa_dynpread-fieldvalue.
   IF it_marc[] IS INITIAL.
     SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_marc WHERE werks = p_werks.
   ENDIF.
   "F4 help F4IF_INT_TABLE_VALUE_REQUEST
   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     EXPORTING
       retfield    = 'MATNR'
       dynpprog    = sy-repid
       dynpnr      = sy-dynnr
       dynprofield = 'P_MATNR'
       value_org   = 'S'
     TABLES
       value_tab   = it_marc
       return_tab  = it_return_tab.
   IF sy-subrc EQ 0.
     READ TABLE it_return_tab INTO wa_return INDEX 1.
     IF sy-subrc EQ 0.
       p_matnr = wa_return-fieldval.
     ENDIF.
   ENDIF.
Thanks Venkat.O

4 REPLIES 4
Read only

MarcinPciak
Active Contributor
0 Likes
889

Hi Anthony,

Yes, you are right. You will get this field empty and all the others. This is becasue in POV event (at selection-screen on value reuqest for ...) there is no automatic transport of screen fields to their corresponding parameters/select-options variables.

You have to use FM DYNP_VALUES_READ in this POV event to read them explicitly.

There are plenty of examples for this, so you will easily find how to call it. [Example link|http://sap.niraj.tripod.com/id27.html]

Futhermore if you want to update some screen field in the same POV event, you must use DYNP_VALUES_UPDATE .

This will solve your issue.

Regards

Marcin

Read only

Former Member
0 Likes
889

Hi,

You need to use the FM 'DYNP_VALUES_UPDATE' to get the values entered in the previous selection screen variable.

Refer:

http://sap.ittoolbox.com/groups/technical-functional/sap-abap/running-into-f4-help-issue-at-selectio...

Read only

venkat_o
Active Contributor
0 Likes
890

Clarke, Try this way.

 REPORT ztest_notepad.

 DATA: BEGIN OF it_marc OCCURS 0,
         matnr TYPE marc-matnr,
         werks TYPE marc-werks,
       END OF it_marc.
 DATA:it_dynpread TYPE TABLE OF dynpread,
      wa_dynpread LIKE LINE OF it_dynpread.
 DATA: it_return_tab TYPE ddshretval OCCURS 0,
       wa_return LIKE LINE OF it_return_tab.
 PARAMETERS:
         p_werks TYPE marc-werks,
         p_matnr TYPE marc-matnr.

 AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

   wa_dynpread-fieldname = 'P_WERKS'.
   APPEND wa_dynpread TO it_dynpread.
   CLEAR  wa_dynpread.
  "DYNP_VALUES_READ read screen 
   CALL FUNCTION 'DYNP_VALUES_READ'
     EXPORTING
       dyname     = sy-repid
       dynumb     = sy-dynnr
     TABLES
       dynpfields = it_dynpread.
   READ TABLE it_dynpread INTO wa_dynpread INDEX 1.
   p_werks = wa_dynpread-fieldvalue.
   IF it_marc[] IS INITIAL.
     SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_marc WHERE werks = p_werks.
   ENDIF.
   "F4 help F4IF_INT_TABLE_VALUE_REQUEST
   CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     EXPORTING
       retfield    = 'MATNR'
       dynpprog    = sy-repid
       dynpnr      = sy-dynnr
       dynprofield = 'P_MATNR'
       value_org   = 'S'
     TABLES
       value_tab   = it_marc
       return_tab  = it_return_tab.
   IF sy-subrc EQ 0.
     READ TABLE it_return_tab INTO wa_return INDEX 1.
     IF sy-subrc EQ 0.
       p_matnr = wa_return-fieldval.
     ENDIF.
   ENDIF.
Thanks Venkat.O

Read only

Former Member
0 Likes
889

Thanks Guys for your help.

It works great. Thanks for the code extract I just had to copy it and change the parameters and works.

You made my day.