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

F4 and Table control

Former Member
0 Likes
1,149

hi,

Here is the issue:

I have a table controle where i specify for a field a F4 with the event PROCESS ON VALUE-REQUEST.

I can't get the value back from the F4.

here's a piece of my code:

TYPES: BEGIN OF t_dunn_run,

mark(1),

laufd LIKE f150v-laufd,

laufi LIKE f150v-laufi,

END OF t_dunn_run.

DATA: wa_dunn_run TYPE t_dunn_run.

DATA: gt_dunn_run TYPE t_dunn_run OCCURS 0.

*tablecontrol 'TC_DUNN_RUN' itself

CONTROLS: tc_dunn_run TYPE TABLEVIEW USING SCREEN 0100.

start-of-selection.

call screen 0100.

PAI

PROCESS ON VALUE-REQUEST.

FIELD wa_dunn_run-laufd MODULE f4_laufd_0100.

MODULE f4_laufd_0100 INPUT.

....

....

CALL FUNCTION 'DYNP_GET_STEPL'

IMPORTING

povstepl = step_line

EXCEPTIONS

stepl_not_found = 1

OTHERS = 2.

tab_update-fieldname = 'GT_DUNN_RUN-LAUFI'.

tab_update-fieldvalue = <what ever you want>.

tab_update-stepl = step_line.

APPEND tab_update.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

dyname = sy-cprog

dynumb = sy-dynnr

TABLES

dynpfields = tab_update

EXCEPTIONS

OTHERS = 8.

any Idea??

thank in advance,

joseph fryda

Message was edited by: joseph fryda

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,100

Hi Joseph,

Is this the right field name?

<b>tab_update-fieldname = 'GT_DUNN_RUN-LAUFI'.</b>

tab_update-fieldvalue = <what ever you want>.

tab_update-stepl = step_line.

APPEND tab_update.

OR is it <b>WA_DUNN_RUN-LAUFI</b>?

Please check..

Sri

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,100

I've actually never done it that way.

Here is what I've done.

In the flow logic.....





process on value-request.

  field imdl-dplno module optin_value_request.

Here the field in the table control is IMDL-DPLNO.

Here is the code for the module.





module optin_value_request input.

  data: begin of option_help occurs 0,
        custid     type zhp_plans-custid,
        planid     type zhp_plans-planid,
        homemod    type zhp_plans-homemod,
        planno     type zhp_options-planno,
        optionid   type zhp_options-optionid,
        optionidx  type zhp_options-optionidx,
        optdesc1   type zhp_options-optdesc1,
        end of option_help.

* Read the line of the table where user has requested F4 help
  get cursor field cursorfield line cursorline value cursorvalue.
  cursorline = ( cursorline + imdlcon-top_line ) - 1.
  read table imdl index cursorline.

* Get the values..
  clear option_help.  refresh option_help.
  select zhp_plans~custid zhp_plans~planid zhp_plans~homemod
         zhp_options~planno zhp_options~optionid
         zhp_options~optionidx zhp_options~optdesc1
                into corresponding fields of table option_help
                     from zhp_plans
                        inner join zhp_options
                           on zhp_plans~planno = zhp_options~planno
                                   where zhp_plans~custid = p_cstid
                                     and zhp_plans~planid = imdl-plnid.


  sort option_help ascending by custid planid homemod
                               planno optionid optionidx optdesc1.

  delete adjacent duplicates from option_help comparing all fields.

<b>  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
       exporting
            retfield    = 'OPTIONID'
            dynprofield = 'IMDL-DPLNO'
            dynpprog    = sy-cprog
            dynpnr      = sy-dynnr
            value_org   = 'S'
       tables
            value_tab   = option_help.</b>

endmodule.




You can most likely ignore the parts where it is getting the data. Pay attention to the stuff which is bolded.

Regards,

Rich Heilman

Read only

0 Likes
1,100

hi rich,

I can't do it that way because it suppose me to build the serch help (if i understand well).

In my case i'm using a function module from sap that give a list of value on the screen and then I pick up one row and come back to the screen with 2 fields (that i have to put in the Table control).

Read only

0 Likes
1,100

I'm wondering if this would help. Not sure.




PROCESS ON VALUE-REQUEST.
<b>Chain.
FIELD wa_dunn_run-laufd.
Field wa_dunn_run-laufi. 
MODULE f4_laufd_0100.
Endchain.</b>


Regards,

Rich Heilman

Read only

0 Likes
1,100

hi rich,

It's not working.... I'm still searching....

Read only

0 Likes
1,100

Hi joseph,

Please check the below code it is working for me.

IN PAI.

<b>PROCESS ON VALUE-REQUEST.

Field dt_members-PERNR :

MODULE DISPLAY_PERNR.</b>


  REFRESH: dt_fields, dt_contents.


  dt_fields-tabname   = 'PA0001'.
  dt_fields-fieldname = 'PERNR'.
  dt_fields-selectflag = c_x.
  APPEND dt_fields.
  CLEAR dt_fields.

  dt_fields-tabname   = 'PA0001'.
  dt_fields-fieldname = 'ENAME'.
  APPEND dt_fields.
  CLEAR dt_fields.

  CLEAR dt_contents.

* Select from PA0001
  SELECT pernr
         ename
    INTO TABLE dt_contents
    FROM pa0001.
  IF sy-subrc = 0.
    SORT dt_contents BY pernr.

    DELETE ADJACENT DUPLICATES FROM dt_contents
      COMPARING pernr.

* Give F4 help
    CALL FUNCTION 'HELP_VALUES_GET_NO_DD_NAME'
         EXPORTING
              selectfield                  = 'PERNR'
              titel                        = 'Member PERNR'(028)
         IMPORTING
              ind                          = dg_ind
         TABLES
              fields                       = dt_fields
              full_table                   = dt_contents
         EXCEPTIONS
              full_table_empty             = 1
              no_tablestructure_given      = 2
              no_tablefields_in_dictionary = 3
              more_then_one_selectfield    = 4
              no_selectfield               = 5
              OTHERS                       = 6.

    IF sy-subrc EQ 0.
      READ TABLE dt_contents INDEX dg_ind transporting pernr.
      dt_members-pernr = dt_contents-pernr.
    ENDIF.
  ELSE.
   MESSAGE s999 WITH 'No Help Values Found for Primary Contact ID'(012).
  ENDIF.

Hope this will help you.

Thanks&Regards,

Siri.

Kindly Award points if it is useful.

Read only

Former Member
0 Likes
1,101

Hi Joseph,

Is this the right field name?

<b>tab_update-fieldname = 'GT_DUNN_RUN-LAUFI'.</b>

tab_update-fieldvalue = <what ever you want>.

tab_update-stepl = step_line.

APPEND tab_update.

OR is it <b>WA_DUNN_RUN-LAUFI</b>?

Please check..

Sri

Read only

0 Likes
1,100

hi, Sri,

GT_DUNN_RUN is the table.

WA_DUNN_RUN is the work area.

so i think i should write: tab_update-fieldname = 'GT_DUNN_RUN-LAUFI'.

anyway i try the 2 ways and still doesn't work.

Read only

0 Likes
1,100

Hi Joseph,

The reason I suggested WA_DUNN_RUN-LAUFI is because I saw that the other field LAUFD specified in PROCESS ON VALUE-REQUEST is WA_DUNN_RUN-LAUFD. This led me to think that you have use WA_DUNN_RUN for your Table control columns..

Actually you should use whatever you have as Table control column. If you have 'GT_DUNN_RUN-LAUFI' as column then use it otherwise 'WA_DUNN_RUN-LAUFI'.

Also I am not sure why are you using SY-CPROG while calling DYNP_VALUES_UPDATE ? SY-CPROG is normally calling program during external calls.

I think you should use SY-REPID.

Hope this helps..

Sri

Message was edited by: Srikanth Pinnamaneni

Read only

0 Likes
1,100

HI SRI,

First, you right, I needed to use sy-repid.

and second I needed to use WA_DUNN_RUN the work area!!!!

Thank you for your help