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: 

Sample report code

Former Member
0 Kudos

Hi all

Can anybody send me a sample code of classical report and pls mention the purpose of that report also...

Regards,

pandu.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

i am sending you a sample classical report in which i had some functionalities like

i had 2 radiobuttons and 1 select-option and one parameter

parameter for plant and select-option for material number

in this report when you select 1st radio button then it will display plant details corresponding to the value enterd in parameter and it will enable the filed which is for material and in the same case for 1nd radiobutton also

simply in this report i am executing 2 outputs based on the input selection

and you will find code for screen modifications and screen validations

and top of page and end of page with out recahing to the bottom also you can display

REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).

*******DATA DECLARATIONS***********
DATA : BEGIN OF IT_PLANT OCCURS 0,
        MATNR LIKE MARA-MATNR,
        WERKS LIKE MARC-WERKS,
        PSTAT LIKE MARC-PSTAT,
        EKGRP LIKE MARC-EKGRP,
       END OF IT_PLANT.

DATA : BEGIN OF IT_PONO OCCURS 0,
        EBELN LIKE EKKO-EBELN,
        EBELP LIKE EKPO-EBELP,
        MATNR LIKE EKPO-MATNR,
        WERKS LIKE EKPO-WERKS,
        LGORT LIKE EKPO-LGORT,
       END OF IT_PONO.

TABLES EKKO.
*********END OF DATA DECLARATIONS**********

********SELECTION SCREEN DESIGN ***********

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B2.


*******END OF SELECTION SCREEN DESIGN*****************

**********INITIALIZATION OF SELECTION SCREEN ELEMENTS.******

INITIALIZATION.

P_WERKS = '1000'.

S_EBELN-LOW = '4500016926'.
S_EBELN-OPTION = 'EQ'.
S_EBELN-SIGN = 'I'.
APPEND S_EBELN.
CLEAR S_EBELN.

*************END OF INITIALIZATION************************

************SCREEN MODIFICATIONS********************

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
      SCREEN-INPUT = 0.
      MODIFY SCREEN.
    ENDIF.

    IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
      SCREEN-INPUT = 0.
      MODIFY SCREEN.
    ENDIF.

  ENDLOOP.



*********END OF SCREEN MODIFICATIONS******************

***************SCREEN VALIDATIONS *****************
at selection-screen.
  SELECT SINGLE *
           FROM EKKO
           INTO EKKO
           WHERE EBELN IN S_EBELN.

  IF SY-SUBRC <> 0.
    SET CURSOR FIELD 'S_EBELN-LOW'.
    MESSAGE E999 WITH TEXT-005.
  ENDIF.
*********end of screen validation******************

START-OF-SELECTION.
*set pf-status '100'.
  IF R1 EQ 'X'.

    SELECT MATNR
           WERKS
           PSTAT
           EKGRP
       FROM MARC
       INTO TABLE IT_PLANT
       WHERE WERKS = P_WERKS.

    LOOP AT IT_PLANT.


      WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
             21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
             27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
             43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.


    ENDLOOP.

  ENDIF.

  IF R2 EQ 'X'.

    SELECT EBELN EBELP MATNR WERKS LGORT
           FROM EKPO
           INTO TABLE IT_PONO
           WHERE EBELN IN S_EBELN.

    LOOP AT IT_PONO.

      WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
             12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
             18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
             37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
             44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
    ENDLOOP.
  ENDIF.

TOP-OF-PAGE.

  IF R1 EQ 'X'.

*ULINE AT /1(48).

    WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
            21 SY-VLINE , 22 'PLANT',
            27 SY-VLINE , 28 'STATUS',
            43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.

    ULINE AT /1(48).

  ENDIF.

  IF R2 EQ 'X'.

    WRITE : SY-VLINE , 2 'PO NUMBER',
           12 SY-VLINE, 13 'ITEM',
           18 SY-VLINE,19 'MATERIAL NUMBER',
           37 SY-VLINE, 38 'PLANT',
           44 SY-VLINE, 45 'GRUP',
           49 SY-VLINE.
    ULINE AT /1(50).
  ENDIF.

END-OF-PAGE.

  ULINE AT /1(50).
  WRITE :/10 'PAGE NUMBER', SY-PAGNO.

<b>Reward if usefull</b>

3 REPLIES 3

Former Member
0 Kudos

see example program t

t_code abapdocu.

Detail Lists

When the system processes event blocks that are not assigned to interactive list events, and when processing dialog modules, the ABAP program writes its list output to the basic list.

The ABAP system field SY-LSIND contains the index of the list currently being created. While the basic list is being created, SY-LSIND is zero.

By default, the basic list has a standard list status and a standard page header. The TOP-OF-PAGE and END-OF-PAGE events can occur while the basic list is being created. All output in these events is placed in the page header or footer of the basic list. In executable programs, the basic list is automatically sent to the list processor and displayed at the end of the END-OF-SELECTION event. Otherwise, it is displayed after the PAI processing block on the screen from which the LEAVE TO LIST-PROCESSING statement occurred.

Creating Detail Lists

Each time the user executes an action on a list, the runtime environment checks whether there is an event block defined that corresponds to the function code. If there is, SY-LSIND is automatically increased by one, and the relevant event block is executed. Any list output arising during this event block places its data into a new list (list level) with the index SY-LSIND. In order to create a new list level, the GUI status of the basic list must allow user actions, and the relevant event blocks must be defined in the program.

All lists created during an interactive list event are detail lists. Each interactive list event creates a new detail list. With one ABAP program, you can maintain one basic list and up to 20 detail lists. If the user creates a list on the next level (that is, SY-LSIND increases), the system stores the previous list and displays the new one. The user can interact with whichever list is currently displayed.

The system displays this list after processing the entire processing block of the event keyword or after leaving the processing block due to EXIT or CHECK. By default, the new list overlays the previous list completely. However, you can display a list in a dialog box. If no other dialog status is set in the event block for the detail list, the system uses the status from the previous list level. However, there is no standard page header for detail lists (see below).

Consequences of Event Control

The fact that you program detail lists in event blocks has important consequences. You cannot nest processing blocks (see Structure of an ABAP Program). Therefore, you cannot process other events within the processing blocks of interactive lists.

Especially, you cannot

use separate processing blocks to process further interactive events. A certain user action always triggers the same processing block in your program. You must use control statements (IF, CASE) within the processing block to make sure that the system processes the desired statements. There is a range of system field that you can use for this.

use the event TOP-OF-PAGE to influence the list structure of secondary lists. To layout the page headers of the secondary lists, you must use the event TOP-OF-PAGE DURING LINE-SELECTION (see below). However, the system does process the event END-OF-PAGE in secondary lists.

use events such as GET and GET LATE to retrieve data for secondary lists, but must use SELECT statements. You can use the logical database assigned to the executable program (report) only for the basic list. If you want to use a logical database during interactive events, you must either call another executable program using SUMIT, or (better) call the logical database using a function module.

Navigating in Lists

To return from a high list level to the next-lower level (SY-LSIND), the user can choose Back from a detail list. The system releases the last list to have been displayed, and returns to the previous list level. The system deletes the contents of the released list.

To determine the list level in which the output from an event block will be displayed, you can change the value of the system fields SY-LSIND. This is one of the few exceptions to the rule that states that you must never overwrite ABAP system fields. The system accepts only index values which correspond to existing list levels. It then deletes all existing list levels whose index is greater or equal to the index you specify. For example, if you set SY-LSIND to 0, the system deletes all secondary lists and overwrites the basic list with the current secondary list.

When you change SY-LSIND, the change only takes effect at the end of the corresponding event. If you work with statements that access the list with index SY-LSIND (using the INDEX addition - for example, SCROLL), you should set the new value of SY-LISND after these statements. The best place to set it is in the last statement of the event block.

System Fields for Details Lists

After each user action on a list, the following ABAP system fields will be set in the corresponding event block:

System field

Information

SY-LSIND

Index of the list created during the current event (basic list = 0)

SY-LISTI

Index of the list level from which the event was triggered

SY-LILLI

Absolute number of the line from which the event was triggered

SY-LISEL

Contents of the line from which the event was triggered

SY-CUROW

Position of the line in the window from which the event was triggered (counting starts with 1)

SY-CUCOL

Position of the column in the window from which the event was triggered (counting starts with 2)

SY-CPAGE

Page number of the first displayed page of the list from which the event was triggered

SY-STARO

Number of the first line of the first page displayed of the list from which the event was triggered (counting starts with 1). This line may contain the page header.

SY-STACO

Number of the first column displayed in the list from which the event was triggered (counting starts with 1)

SY-UCOMM

Function code that triggered the event

SY-PFKEY

Status of the list currently being displayed.

Page Headers for Detail Lists

On detail lists, the system does not display a standard page header and it does not trigger the event TOP-OF-PAGE. To create page headers for detail list, you must use a different TOP-OF-PAGE event:

TOP-OF-PAGE DURING LINE-SELECTION.

The system triggers this event for each detail list. If you want to create different page headers for different list levels, you must program the processing block of this event accordingly, for example by using system fields such as SY-LSIND or SY-PFKEY in control statements (IF, CASE).

As on the basic list, the page header of a detail list remains displayed even when you scroll vertically.

Messages on Detail Lists

ABAP allows you to react to incorrect or possibly-incorrect user input by displaying messages. The seriousness of the error determines how program processing continues.

In list processing, the message processing for the individual message types is as follows:

A (=Abend): Termination

The system displays the message in a dialog box. After the user confirms the message using ENTER , the system terminates the entire transaction (for example SA38).

E (=Error) or W (=Warning):

The system displays the message in the status bar. Once the user has confirmed the error by pressing ENTER, the current event block is terminated and the previous list level remains displayed. If you use an error or warning message while creating the basic list, the entire program is terminated.

I (=Information):

The system displays the message in a dialog box. Once the user has confirmed the message (ENTER), the program continues processing after the MESSAGE statement.

S (= status)

The system displays the message in the status bar of the current list.

X (= Exit) Runtime error:

This message type triggers a runtime error and generates a short dump.

Using Detail Lists

A classic report is a program that generates a single list, which must contain all of the required detail information. This procedure may result in extensive lists from which the user has to pick the relevant data. For background processing, this is the only possible method. After starting a background job, there is no way of influencing the program. The desired selections must be made beforehand and the list must provide detailed information.

For dialog sessions, there are no such restrictions. The user is present during the execution of the program and can control and manipulate the program flow directly. To be able to use all advantages of the online environment, classical reporting was developed into interactive reporting.

Interactive reporting allows the user to participate actively in retrieving and presenting data during the session. Instead of one extensive and detailed list, with interactive reporting you create a condensed basic list from which the user can call detailed information by positioning the cursor and entering commands. Interactive reporting thus reduces information retrieval to the data actually required. Detailed information is presented in detail lists.

Apart from creating detail lists, interactive reporting also allows you to call transactions or other executable programs (reports) from lists. These programs then use values displayed in the list as input values. The user can, for example, call a transaction from within a list to change the database table whose data is displayed in the list.

Examples

Creating Detail Lists

REPORT demo_list_interactive_1.

START-OF-SELECTION.

WRITE: 'Basic List, SY-LSIND =', sy-lsind.

AT LINE-SELECTION.

WRITE: 'Secondary List, SY-LSIND =', sy-lsind.

When you run the program, the basic list appears. The GUI status automatically permits the function Choose (F2). When you choose a list line, the system triggers the AT LINE-SELECTION event, and the first detail list overlays the basic list. This list has no standard page header. It also inherits the GUI status of the basic list. By choosing Choose, the user can now create up to 19 of these lists. Trying to produce more than 19 lists results in a runtime error. Using Back , the user can return to previous lists.

Navigation in detail lists.

REPORT demo_list_interactive_2.

START-OF-SELECTION.

WRITE: 'Basic List, SY-LSIND =', sy-lsind.

AT LINE-SELECTION.

IF sy-lsind = 3.

sy-lsind = 0.

ENDIF.

WRITE: 'Secondary List, SY-LSIND =', sy-lsind.

When you run the program, the basic list appears:

Basic List, SY-LSIND = 0

The GUI status automatically permits the function Choose (F2). If the user positions the cursor on the list line and chooses Choose to trigger the AT LINE-SELECTION event, the system displays a detail list that contains the following line:

Secondary List, SY-LSIND = 1

Choosing Choose again produces:

Secondary List, SY-LSIND = 2

Back leads to the previous list level. Choosing Choose for the third time produces a detail list that contains the following line (because of the IF condition):

Secondary List, SY-LSIND = 0

The system deletes list levels 1 and 2. Choosing Back returns to the point at which the list processing started. If you choose Choose, the system creates a detail list with index 1. However, the list on level 0 is no longer a basic list (no page header), but is itself a detail list.

Page Headers for Detail Lists

REPORT demo_list_interactive_3.

START-OF-SELECTION.

WRITE 'Basic List'.

AT LINE-SELECTION.

WRITE 'Secondary List'.

TOP-OF-PAGE DURING LINE-SELECTION.

CASE sy-lsind.

WHEN 1.

WRITE 'First Secondary List'.

WHEN 2.

WRITE 'Second Secondary List'.

WHEN OTHERS.

WRITE: 'Secondary List, Level:', sy-lsind.

ENDCASE.

ULINE.

When you run the program, the basic list appears. The user can choose Choose to create detail lists. The detail lists have page headers that are set according to the value of SY-LSIND.

Messages on Detail Lists

REPORT demo_list_interactive_4 NO STANDARD PAGE HEADING.

AT LINE-SELECTION.

WRITE 'Basic List'.

MESSAGE s888(sabapdocu) WITH text-001.

AT LINE-SELECTION.

IF sy-lsind = 1.

MESSAGE i888(sabapdocu) WITH text-002.

ENDIF.

IF sy-lsind = 2.

MESSAGE e888(sabapdocu) WITH text-003 sy-lsind text-004.

ENDIF.

WRITE: 'Secondary List, SY-LSIND:', sy-lsind.

When the program runs, the system displays the basic list and the success message 100 in the status line. A single click triggers the AT-LINE-SELECTION event. When the system creates the first detail list, it displays a dialog box with the information message 100. You cannot create the second detail list, because the message 200 has message type E:

Message was edited by:

Karthikeyan Pandurangan

Former Member
0 Kudos

Classical Reports:

These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.

Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.

Events In Classical Reports:

INTIALIZATION: This event triggers before selection screen display.

AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.

START OF SELECTION: Start of selection screen triggers after proceesing selection screen.

END-OF-SELECTION: It is for Logical Database Reporting.

CLASSICAL REPORTS

Events in Classical report

Events associated with classical report are as follows and each one will be discussed in detail.

• INITIALIZATION

• AT SELECTION-SCREEN

• AT SELECTION-SCREEN ON <field>

• START-OF-SELECTION

• TOP-OF-PAGE

• END-OF-PAGE

• END-OF-SELECTION

In this case first three events are associated with selection screen. Rest of the events are associated with your list.

• INITIALIZATION

We have already seen how to fill default values for the selection criteria. But in many cases you need to calculate the value and then put it in selection criteria. For example, say, you are accepting date from user and you need to fill in the default value for lower range as sy-datum – 30 days and sy-datum for higher range. In this case you are calculating lower range and then filling the criteria. This can be done in INITIALIZATION event. Piece of code to do the above task would look like the following:

Tables: Sflight.

Select-options: fldate1 for sflight-fldate.

INITIALIZATION.

Data: date1 like SY-DATUM.

Date1 = sy-datum – 30.

Fldate1-low = date1.

Fldate1-high = sy-datum.

Append fldate1.

  • Here appending is required because fldate1 is int’ table

This event is triggered when you execute your program for the first time i.e., before selection screen is displayed.

• AT SELECTION-SCREEN

When user enters the values in the fields of selection screen and clicks on execute button, this event gets triggered. This event is basically for checking the values entered by the user for the fields of the selection screen i.e., data validity checking. This event is for entire selection screen. For example:

You are accepting carrid, connid, fldate from user and you don’t want to proceed if user enters no value for carrid and fldate. Using AT SELECTION-SCREEN can do this.

Select-options: carrid1 for sflight-carrid,

Connid1 for sflight-connid,

F1date1 for sflight-f1date.

AT SELECTION-SCREEN.

If carrid1-low ne ‘ ’ and fldate1-low = ‘ ’.

Error message.

Endif.

In this case, if both the fields are entered blank, then the user gets error message.

Basically, this event is for many fields on selection screen. Usually, it is for the fields which are logically related.

• AT SELECTION-SCREEN ON <field>

When you want to check for specific value of a field. For example, carrid should be in the range of ‘LH’ and ‘SQ’. This can be done in this event. Basically, this event is for checking individual fields. You can have many AT selection-screen events in your program (i.e., for each field specified in the Select-Options).

Select-Options carrid1 for sflight-carrid.

AT SELECTION-SCREEN.

If carrid1-low ne ‘LH’ and carrid1-high ne ‘SQ’.

Error message.

Endif.

Here the system will not proceed on entering wrong values.

• START-OF-SELECTION

This is the first event for your list. Once all the events are triggered for selection screen, the data is retrieved from database. Data declaration, select statements are done in this event. Consider the following example:

START-OF-SELECTION.

Data: mtype i.

Tables: sflight.

Select * from sflight where carrid = ‘LH’.

Write: / sflight-carrid,sflight-connid.

Endselect.

• TOP-OF-PAGE

This event is triggered with first WRITE statement or whenever new page is triggered. Advantage of using this event is that, whatever you write under this event, is applicable to all the pages. If you don’t have any write statement before TOP-OF-PAGE or in START-OF-SELECTION, this event is not triggered at all. For example, if you want the name of company and column headers for all the pages, it can be written in this event.

TOP-OF-PAGE

Write: / ‘INTELLIGROUP ASIA PVT. LTD.’

Write : / 10 ‘carrid’, 20 ‘connid’, 30 ‘fldate’.

• END-OF-PAGE

This event is triggered at the end of page.

End-of-page.

Write : / ‘page number’, sy-pagno.

In this case page number will be written on every page.

Conditional triggering of EOP

Consider the following case.

REPORT ZDEMO1 line-count 15(3).

Top-of-page.

Write: ‘this line is written by top-of-page event’.

Start-of-selection.

Write: ‘this line is written by start-of-selection event’.

End-of-page.

Write : ‘this line is written by end-of-page event’.

In this case EOP will never be triggered, as end of page is never reached. The total Line-count defined for page = 15 in which 3 lines are for footer area. The output of the above code will be

This line is written by top of page event.

This line is written by start of selection event.

In output screen, only two lines are written and cursor remains still on 3rd line, the end-of-page event is not triggered. To trigger end of page event, cursor should reach at the last position, in this case on 11th line.

Such cases are quite common, and could be overcome by conditional triggering of end of page.

Sy-linct is the system variable, which gives total line count of a list.

Sy-linno is the system variable, which gives the current line number where the cursor is placed on the list.

Consider the following case:

Report zdemo1 line count 20(1).

Start-of-selection.

Data: m type i.

Write: / ‘this is first line’.

Do 5 times.

Write: / ‘the number is’, sy-index.

Enddo.

M = sy-linct, sy-linno – 1.

Skip x.

End-of-page.

Write: / ‘page end’.

The output of above example is as follows :

This is first line.

The number is 1

The number is 2

The number is 3

The number is 4

The number is 5

After skipping 10 lines

Page end

In this case, with all write statement, you don’t reach to the end of page. After all write statement, m is calculated in this case:

M = 20 – 8 – 1, So m is 12. And 11 lines are skipped after write statement and end of page is reached. (In this case you have 6 write statement so 6 lines + 1 line for page number and 1 horizontal line which is displayed for any list. So cursor is on 8th line and is subtracted from total line count i.e, 20.)

Common errors that user commits

Stating of another event denotes the end of any event. If you forget to mention the next event then everything is included in the same event. Consider the following case:

AT SELECTION-SCREEN.

If carrid1-low ne ‘ ‘.

Err. or message.

Endif.

Write: / ‘INTELLIGROUP ASIA P. LTD.’

WRITE: / 10 ‘CARRID’, 20 ‘CONNID’, 30 ‘FLDATE’.

START-OF-SELECTION.

….….

….

In this case all the write statement are included in the `at selection screen’ as top-of-page is not specified. The end of `at selection-screen’ is denoted by the starting of start-of-selection.

Though the sequence of events in program is immaterial, it is a good programming practice to write all the events in the order specified above.

Using Variants with selection criteria

In many cases you need report to execute report at regular interval for certain fixed values of selection criteria. That means each times you execute the report you need to enter its values again and again. ABAP/4 provides the facility by which you can define the values for selection screen and store it. Using VARIANTS can do this. It can be defined as group of values used for selection criteria while executing report. For a particular report, you create a variant which means variant created for particular report cannot be used for another report. The group of values for the selection criteria is saved and assigned a variant name. So every time you call a report, you need not specify the values for selection criteria but instead call the variant thus avoiding extra typing. User can have many variants for a single report. Each of them can be used as different type of information. For example, if a manager wants to see how an employee in personnel department or admin department has performed. He need not enter the department, one has to just execute the report with variant. In case he doesn’t know about the variant, which is available, he can display list of variants attached to the report and values assigned to each variant.

Creating variant

• Execute the report program. The selection screen is displayed.

• Enter the values for selection screen and click on saves.

- System displays the variant screen

• Enter the variant name and description for it.

• Save it.

Usually the variants are useful when you need to execute the report in background, which will be discussed in background processing.

also refer to the following links

http://wiki.ittoolbox.com/index.php/FAQ:How_many_types_of_reports_are_there_in_ABAP_and_what_is_the_...

http://www.sapdevelopment.co.uk/reporting/alvhome.htm

http://www.sapmaterial.com/?gclid=CN322K28t4sCFQ-WbgodSGbK2g

Former Member
0 Kudos

Hi

i am sending you a sample classical report in which i had some functionalities like

i had 2 radiobuttons and 1 select-option and one parameter

parameter for plant and select-option for material number

in this report when you select 1st radio button then it will display plant details corresponding to the value enterd in parameter and it will enable the filed which is for material and in the same case for 1nd radiobutton also

simply in this report i am executing 2 outputs based on the input selection

and you will find code for screen modifications and screen validations

and top of page and end of page with out recahing to the bottom also you can display

REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).

*******DATA DECLARATIONS***********
DATA : BEGIN OF IT_PLANT OCCURS 0,
        MATNR LIKE MARA-MATNR,
        WERKS LIKE MARC-WERKS,
        PSTAT LIKE MARC-PSTAT,
        EKGRP LIKE MARC-EKGRP,
       END OF IT_PLANT.

DATA : BEGIN OF IT_PONO OCCURS 0,
        EBELN LIKE EKKO-EBELN,
        EBELP LIKE EKPO-EBELP,
        MATNR LIKE EKPO-MATNR,
        WERKS LIKE EKPO-WERKS,
        LGORT LIKE EKPO-LGORT,
       END OF IT_PONO.

TABLES EKKO.
*********END OF DATA DECLARATIONS**********

********SELECTION SCREEN DESIGN ***********

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.
SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK B2.


*******END OF SELECTION SCREEN DESIGN*****************

**********INITIALIZATION OF SELECTION SCREEN ELEMENTS.******

INITIALIZATION.

P_WERKS = '1000'.

S_EBELN-LOW = '4500016926'.
S_EBELN-OPTION = 'EQ'.
S_EBELN-SIGN = 'I'.
APPEND S_EBELN.
CLEAR S_EBELN.

*************END OF INITIALIZATION************************

************SCREEN MODIFICATIONS********************

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
      SCREEN-INPUT = 0.
      MODIFY SCREEN.
    ENDIF.

    IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
      SCREEN-INPUT = 0.
      MODIFY SCREEN.
    ENDIF.

  ENDLOOP.



*********END OF SCREEN MODIFICATIONS******************

***************SCREEN VALIDATIONS *****************
at selection-screen.
  SELECT SINGLE *
           FROM EKKO
           INTO EKKO
           WHERE EBELN IN S_EBELN.

  IF SY-SUBRC <> 0.
    SET CURSOR FIELD 'S_EBELN-LOW'.
    MESSAGE E999 WITH TEXT-005.
  ENDIF.
*********end of screen validation******************

START-OF-SELECTION.
*set pf-status '100'.
  IF R1 EQ 'X'.

    SELECT MATNR
           WERKS
           PSTAT
           EKGRP
       FROM MARC
       INTO TABLE IT_PLANT
       WHERE WERKS = P_WERKS.

    LOOP AT IT_PLANT.


      WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
             21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
             27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
             43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.


    ENDLOOP.

  ENDIF.

  IF R2 EQ 'X'.

    SELECT EBELN EBELP MATNR WERKS LGORT
           FROM EKPO
           INTO TABLE IT_PONO
           WHERE EBELN IN S_EBELN.

    LOOP AT IT_PONO.

      WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
             12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
             18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
             37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
             44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
    ENDLOOP.
  ENDIF.

TOP-OF-PAGE.

  IF R1 EQ 'X'.

*ULINE AT /1(48).

    WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
            21 SY-VLINE , 22 'PLANT',
            27 SY-VLINE , 28 'STATUS',
            43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.

    ULINE AT /1(48).

  ENDIF.

  IF R2 EQ 'X'.

    WRITE : SY-VLINE , 2 'PO NUMBER',
           12 SY-VLINE, 13 'ITEM',
           18 SY-VLINE,19 'MATERIAL NUMBER',
           37 SY-VLINE, 38 'PLANT',
           44 SY-VLINE, 45 'GRUP',
           49 SY-VLINE.
    ULINE AT /1(50).
  ENDIF.

END-OF-PAGE.

  ULINE AT /1(50).
  WRITE :/10 'PAGE NUMBER', SY-PAGNO.

<b>Reward if usefull</b>