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

multiple f4

Former Member
0 Likes
1,231

is possible to manage more than one f4 in report?

i'm using...

CALL METHOD grid1->register_f4_for_fields
    EXPORTING
      it_f4 = lt_f4[].

* register events for abap objects (backend)
  CREATE OBJECT g_onf4.
  SET HANDLER g_onf4->on_f4 FOR grid1.

  CREATE OBJECT g_dc.
  SET HANDLER g_dc->handle_data_changed FOR grid1

and...

METHOD show_f4.
    DATA: ls_outtab LIKE gt_outtab.
    IF f4_cont IS INITIAL.
      CALL METHOD init_f4.
    ENDIF.
   READ TABLE gt_outtab INTO ls_outtab INDEX f4_params-cs_row_no-row_id                                                                      .
    CALL METHOD fill_f4_itab( ls_outtab-plnnr )...

  METHOD fill_f4_itab.
    DATA ls_f4_itab TYPE f4_itab_type.
    IF plnnr  IS INITIAL.
      ls_f4_itab-value = '767AFTFD'.
      ls_f4_itab-descr = text-t03.                          "PLNNR1
      APPEND ls_f4_itab TO f4_itab.
      ls_f4_itab-value = 'A380OP10'.
      ls_f4_itab-descr = text-t04.                          "PLNNR2
      APPEND ls_f4_itab TO f4_itab.
      ls_f4_itab-value = 'ATRS144R'.
      ls_f4_itab-descr = text-t05.                          "PLNNR3
      APPEND ls_f4_itab TO f4_itab.
    ENDIF.
  ENDMETHOD.                    "fill_f4_itab

I wish i can make other f4 for other field.

Is it possible with a routine like perform using...?

Edited by: EBONGUE ANDRE on Aug 6, 2009 10:39 PM

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
1,023

Hi Andre,

Don't know if I get you correct, but you can use same event for different fields


  DATA: lt_fields_f4 TYPE lvc_t_f4,
        ls_fields_f4 TYPE lvc_s_f4.

  ls_fields_f4-fieldname = 'SEATSMAX_F'.
  ls_fields_f4-register = 'X'.
  ls_fields_f4-getbefore = 'X'.
  ls_fields_f4-chngeafter = 'X'.
  APPEND ls_fields_f4 TO lt_fields_f4.
  ls_fields_f4-fieldname = 'SEATSOCC'.
  ls_fields_f4-register = 'X'.
  ls_fields_f4-getbefore = 'X'.
  ls_fields_f4-chngeafter = 'X'.
  APPEND ls_fields_f4 TO lt_fields_f4.

CALL METHOD grid1->register_f4_for_fields
    EXPORTING
      it_f4 = lt_fileds_f4[].

Inside method show_f4 populate appropriate data to your f4_itab depending on fieldname it F4 was triggered for.

Regards

Marcin

5 REPLIES 5
Read only

MarcinPciak
Active Contributor
0 Likes
1,024

Hi Andre,

Don't know if I get you correct, but you can use same event for different fields


  DATA: lt_fields_f4 TYPE lvc_t_f4,
        ls_fields_f4 TYPE lvc_s_f4.

  ls_fields_f4-fieldname = 'SEATSMAX_F'.
  ls_fields_f4-register = 'X'.
  ls_fields_f4-getbefore = 'X'.
  ls_fields_f4-chngeafter = 'X'.
  APPEND ls_fields_f4 TO lt_fields_f4.
  ls_fields_f4-fieldname = 'SEATSOCC'.
  ls_fields_f4-register = 'X'.
  ls_fields_f4-getbefore = 'X'.
  ls_fields_f4-chngeafter = 'X'.
  APPEND ls_fields_f4 TO lt_fields_f4.

CALL METHOD grid1->register_f4_for_fields
    EXPORTING
      it_f4 = lt_fileds_f4[].

Inside method show_f4 populate appropriate data to your f4_itab depending on fieldname it F4 was triggered for.

Regards

Marcin

Read only

0 Likes
1,023

ok, got me well, it's what i'm trying to do but i was wondering how to manage the read table for each field.

READ TABLE gt_outtab INTO ls_outtab INDEX f4_params-cs_row_no-row_id                                                                      .
    CALL METHOD fill_f4_itab( ls_outtab-plnnr )...

Read only

0 Likes
1,023

This event has exporting parameter E_FIELDNAME which you can use to get exact cell value in gt_outtab . I guess this is your query right?


READ TABLE gt_outtab INTO ls_outtab INDEX f4_params-cs_row_no-row_id. "first read which row your action applies

"now read which cell
field-symbols <field_val> type any.

assing component E_FIELDNAME of structure LS_OUTTAB into <field_val>.  "<field_val> stores value for cell which triggered action F4

Hope this is what you need.

Regards

Marcin

Read only

0 Likes
1,023

Error while inserting or changing rows in a sorted table

Read only

matt
Active Contributor
1,023

Best not use a SORTED table for this then.