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

ALV F4 Functionality in Function Modules Class Definition and Implementaion in FM

0 Likes
1,684

Hi All,

I have A Z FM that is called to display an ALV popup error message whenever an error in another Z program is double clicked, I now need to add a new field to the ALV Grid  with a F4 list on one of the fields of the Function Module Pop Up message. I looked at all the Threads on SDN and they all mention the various SAP sample F$ programs like BCALV_EDIT_08.

My issue is that in these programs there needs to be Class Definitions and Implementations created Like Below (Only Partial snippet), As far as I know we cannot do this in a FM?

How can I do the same F4 functionality in a Function Module, Do I have to  create Global Versions of these Classes then call them in my FM?

This is the Function Module ALV Popup Error that requires the F4 Field added to it

Thanks,

Jim

****************************************************************

* LOCAL CLASSES: Definition

****************************************************************

*===============================================================

* class lcl_application_f4: local class to handle own F4.

*

* Definition:

* ~~~~~~~~~~~

class lcl_application_f4 definition.

   public section.

     methods:

              on_f4 for event onf4 of cl_gui_alv_grid

                importing e_fieldname

                          es_row_no

                          er_event_data

                          et_bad_cells

                          e_display.

ETC and of course the Implementation

****************************************************************

* LOCAL CLASSES: Implementation

****************************************************************

*===============================================================

* class lcl_application_f4 (Implementation)

*

class lcl_application_f4 implementation.

*§2. Implement an event handler method for event ONF4.

   method on_f4.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,346

If I have well understood your question, your biggest issue is to define a local class in your function module. You can't do it inside the function module, but you may declare it inside the function group, and use it in your function module. If your function group is named ZFUGR, you'll find a place in the include LZFUGRTOP to declare the class definition (convention is to do it inside LZFUGRD01), and a place for the implementation (convention is LZFUGRP01).

4 REPLIES 4
Read only

deepak_sharma_sap
Active Participant
0 Likes
1,346

Hi,

Basically you need to add one more field to your ALV and then implement F4.

The function that displays ALV , does it use REUSE_ALV_GRID_DISPLAY to display ALV or use ALV class-method ?

Thanks

Deepak

Read only

0 Likes
1,346

HI Deepak,

   It is using the ALV Class Method, I.E. So without being able to Define and Implement Classes as per the SAP Sample BCALV_EDIT_08. how can I get the F4 Functionality?

Thanks,

George

CREATE OBJECT co_dock_container

CALL METHOD co_grid->set_table_for_first_display

CALL METHOD co_grid->refresh_table_display


Thanks,

George.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,347

If I have well understood your question, your biggest issue is to define a local class in your function module. You can't do it inside the function module, but you may declare it inside the function group, and use it in your function module. If your function group is named ZFUGR, you'll find a place in the include LZFUGRTOP to declare the class definition (convention is to do it inside LZFUGRD01), and a place for the implementation (convention is LZFUGRP01).

Read only

0 Likes
1,346

Thank You, That sounds like it will solve the issue. I will try it and let you know.

Thanks,

Jim