Application Development 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: 

Converting a Report to a Function Group

bbalci
Contributor
0 Kudos

Hello,

Our customer have a big and old ABAP report which includes many useful subroutine forms and classes about their business, now they need some functionalities and screens to be used in other programs and also in RFC functions,
so I started to work on converting this report to a new Function Group.

The old ABAP report starts with a selection screen for data filtering and continues with START-OF-SELECTION event an other dialog screen calls in END-OF-SELECTION event. I started by moving all routines and local classes to top include of new Function Group now.

My question is :

I want the transaction code of this program to work as before in new Function Group, without changing anything.
I just want to be able to use form subroutines and local classes in some new Function Modules to call from other programs.

But selection screen 1000 (default sel. screen) is not allowed in Function Group and also report events START-OF-SELECTION , END-OF-SELECTION is not being triggered.


Is there any quick way to make the transaction code work in new Function Group
without manually calling selection the screen and re-arranging the queue of events ?

Thank you

1 ACCEPTED SOLUTION

bbalci
Contributor
0 Kudos

For those interested in the solution ,

It was easy to solve :

1- I've collected all the ABAP code in report events into FORM routines, "initialization", "start_of_selection" and "end_of_selection"

2- I've a created a copy of Selection Screen of Report in function group with number 1001
by using " selection-screen begin of screen ..." and " selection-screen end of screen .." statements

3- In a Function Module I've called everything in a loop as below :

  DO.

    PERFORM initialization.

    CALL SELECTION-SCREEN 1001.

    IF sy-subrc NE 0.
      EXIT.
    ENDIF.

    PERFORM start_of_selection.

    if gv_hata EQ 'X'.
      CONTINUE.
    ENDIF.

    PERFORM end_of_selection.

  ENDDO.

2 REPLIES 2

DoanManhQuynh
Active Contributor
0 Kudos

you could simple create one function module per subroutine, or if it possible group those subroutine to one function module depend on it purpose.

for selection screen, you cant create it in function group, create a dynpro instead. then in SE93, place the function group main program + that screen.

bbalci
Contributor
0 Kudos

For those interested in the solution ,

It was easy to solve :

1- I've collected all the ABAP code in report events into FORM routines, "initialization", "start_of_selection" and "end_of_selection"

2- I've a created a copy of Selection Screen of Report in function group with number 1001
by using " selection-screen begin of screen ..." and " selection-screen end of screen .." statements

3- In a Function Module I've called everything in a loop as below :

  DO.

    PERFORM initialization.

    CALL SELECTION-SCREEN 1001.

    IF sy-subrc NE 0.
      EXIT.
    ENDIF.

    PERFORM start_of_selection.

    if gv_hata EQ 'X'.
      CONTINUE.
    ENDIF.

    PERFORM end_of_selection.

  ENDDO.