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: 

problem in enabling fields in a subscreen calling from a report

Former Member
0 Kudos

Hi All,

I had report..

After output is displayed i had put one push button on the application tool bar...

Once that button clicks it should  call a screen.

I acheived this by calling a subscreen in a report as shown below.....

SELECTION-SCREEN BEGIN OF SCREEN 0101 AS SUBSCREEN.
SELECT-OPTIONS: material FOR mara-matnr.
PARAMETERS:kunnr TYPE kna1-kunnr .
SELECTION-SCREEN END OF SCREEN 0101.

I created a sub screen area in screen no 100 and wrote corresponding logic to handle subscreen..

If user did not enter kunnr and material i am throwing error message after displaying error message fields(material and kunr)  are disabled..

I need to enable the fields of both material and kunnr after displaying error message so that user can enter again.

How to acheive this..

Regards

Ram

1 ACCEPTED SOLUTION

Former Member
0 Kudos

u can make those fields(Select-options and parameters ) as obligatory.

user cant proceed with Entering Some data into those fields.

or if above does not suits you.

AT SELECTION-SCREEN.

IF MATERIAL OR KUNNR IS IN ITIAL.

MESSAGE 'Your Error Msg' type 'E'." use of this event will enable the user to fill data at selection screen again.

"use you can use these set of statements also.

*message ' Your Error Msg' type 'S' display like 'E'.

*Return.

ENDIF.

13 REPLIES 13

raymond_giuseppi
Active Contributor
0 Kudos

Put you select -option and parameter in a BLOCK and send the message in the PAI of this block (AT SELECTION-SCREEN ON BLOCK) so every fields of the block will be ready for input again when error or warning messages are raised.

Regards,

Raymond

0 Kudos

Hi Raymond...

It is giving error like 'All blocks must be concluded before SELECTION-SCREEN BEGIN/END OF SCREEN'.

I wrote like this...

SELECTION-SCREEN BEGIN OF BLOCK b.
SELECTION-SCREEN BEGIN OF SCREEN 0101 AS SUBSCREEN.
SELECT-OPTIONS: material FOR mara-matnr.
PARAMETERS:awcode TYPE kna1-kunnr .
SELECTION-SCREEN END OF SCREEN 0101.
SELECTION-SCREEN end OF BLOCK b.

Regards

Ram

Former Member
0 Kudos

u can make those fields(Select-options and parameters ) as obligatory.

user cant proceed with Entering Some data into those fields.

or if above does not suits you.

AT SELECTION-SCREEN.

IF MATERIAL OR KUNNR IS IN ITIAL.

MESSAGE 'Your Error Msg' type 'E'." use of this event will enable the user to fill data at selection screen again.

"use you can use these set of statements also.

*message ' Your Error Msg' type 'S' display like 'E'.

*Return.

ENDIF.

0 Kudos

Hi Abhishek,

This is subscreen i am displaying..

I tried by making obligatory but it did not stop...it is executing...

Regards

Ram

0 Kudos

Block are sub-area of screen and not the reverse, change your code to :

SELECTION-SCREEN BEGIN OF SCREEN 0101 AS SUBSCREEN.

  SELECTION-SCREEN BEGIN OF BLOCK b.

    SELECT-OPTIONS: material FOR mara-matnr.

    PARAMETERS:awcode TYPE kna1-kunnr .

  SELECTION-SCREEN END OF BLOCK b.

SELECTION-SCREEN END OF SCREEN 0101.

AT SELECTION-SCREEN ON BLOCK b.

* ...

Regards,

Raymond

0 Kudos

for your error of inserting block in screen .do this:

TABLES: MARA,KNA1.

SELECTION-SCREEN : BEGIN OF  SCREEN 100 AS SUBSCREEN .

SELECTION-SCREEN : BEGIN OF  BLOCK B1.

           SELECT-OPTIONS: MATERIAL FOR MARA-MATNR,

                                         KUNNR FOR KNA1-KUNNR.

SELECTION-SCREEN : END OF  BLOCK B1.

SELECTION-SCREEN : END OF  SCREEN 100.

0 Kudos

Hi Ram,

Try using LEAVE LIST PROCESSING after your error message or Leave to screen 0..

And second option is do not show an error message instead use

CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

               EXPORTING

                titel              = 'Error'(023)

                textline1          = text-024

                start_column       = 25

                start_row          = 6 .

Try these options and let me know if you still face the issue.

Thanks

Rahul

0 Kudos

then better use plan 2, i have just mentioned in my above post.

make use of Report events: at Selection-screen.

0 Kudos

Hi Raymond thanks for ur reply...

But still it is executing...

My scenario is like this..

I had report after executing it is displaying output...I added push button in the application tool bar..

when user clicks it had to show a screen with the parameter and select options..

I did this by writing in the report..

SELECTION-SCREEN BEGIN OF SCREEN 0101 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b.
SELECT-OPTIONS: material FOR mara-matnr.
PARAMETERS:kunnr TYPE kna1-kunnr .
SELECTION-SCREEN end OF BLOCK b.
SELECTION-SCREEN END OF SCREEN 0101.
*
AT SELECTION-SCREEN ON BLOCK b.
IF MATERIAL OR kunnr IS INITIAL.
MESSAGE 'Error Msg' type 'E'.
ENDIF.

I created my own gui status for this subscreen..

Even i did not enter any values it is executing.

When i press back or cancel button it is displaying error message.

Regards

Ram

0 Kudos

Hi Rahul...

Its not working...

After displaying popup i need to stay in the same screen only but it is executing...

Regards

Ram

0 Kudos

You defined selection-screen as subscreen, so you add a CALL SUBSCREEN in  PBO and in PAI, also gui status if associated to the main screen not the subscreen, how do you call the subscreen, I supposed calling a dynpro 0100 which has a subscreen area. BACK and CNCL button must also be defined as EXIT COMMAND and so raise a method ON EXIT-COMMAND that leave to screen 0 or leave program before the call subscreen or other checks. (Check sample at Selection Screens as Subscreens.)

Regards,

Raymond

0 Kudos

I am done.

created brand new Program just to understand what is the exact problem u are facing.

first i have created a simple report to select few records from mara database table.

REPORT  ZNEW30.

TABLES : MARA.

TYPE-POOLS:SLIS.

DATA S_MARA TYPE STANDARD TABLE OF MARA WITH HEADER LINE.

START-OF-SELECTION.

   SELECT * FROM MARA INTO TABLE S_MARA UP TO 100 ROWS.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      I_CALLBACK_PROGRAM                = SY-REPID "must declare in order to call the subroutines (form...endform) of GUI Status and                                                                                    "user command.

      I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'

      I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'

      I_STRUCTURE_NAME                  = 'MARA'

    TABLES

       T_OUTTAB                          = S_MARA

    EXCEPTIONS

      PROGRAM_ERROR                     = 1

      OTHERS                            = 2

             .

   IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

here i have created custom PF-status for alv grid and user_command form. to fire function code when user press button created on apllication toolbar.

FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.

   BREAK-POINT.

SET PF-STATUS 'ZSTATUS1'.

ENDFORM.                    "set_pf_status

FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM

                                    RS_SELFIELD TYPE SLIS_SELFIELD.

   BREAK-POINT .

   IF SY-UCOMM EQ 'FIRE'.

     CALL SCREEN 0002. "screen 2 is normal screen on which subscreen area has been created!!

ENDIF.

ENDFORM.   "user_command

below is the code...which is to be declared on screen 2.(screen containing  subscreen area).

PROCESS BEFORE OUTPUT.

MODULE STATUS_0002."in this module created pf-status for the next screen(screen on which Subscreen will b displayed)

CALL SUBSCREEN SUB1 INCLUDING SY-CPROG '0003'."screen 3 is subscreen.

PROCESS AFTER INPUT.

CALL SUBSCREEN SUB1."this is the most imp declaration.(if u dont define call subscreen on PAI).then obligatory addition with                                                 " select-options and parametrs wont work.

MODULE USER_COMMAND_0002.

in the main program i have created a selection screen as subscreen.

code snippet:

SELECTION-SCREEN: BEGIN OF SCREEN 0003 AS  SUBSCREEN.

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

SELECT-OPTIONS : V_MATNR FOR MARA-MATNR OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK B1.

SELECTION-SCREEN: END OF SCREEN 0003.

finally in user_command module of screen 2.

MESSAGE 'YOU HAVE EXECUTED 2ND REPORT' TYPE 'S'.

LEAVE TO LIST-PROCESSING.

REFRESH S_MARA.

SELECT * FROM MARA INTO TABLE S_MARA WHERE MATNR IN V_MATNR.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      I_STRUCTURE_NAME                  = 'MARA'

     TABLES

       T_OUTTAB                          = S_MARA

    EXCEPTIONS

      PROGRAM_ERROR                     = 1

      OTHERS                            = 2

             .

   IF SY-SUBRC <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

i executed this code. it wont allow user to execute the 2nd report with filling values in V_MATNR.

HOPE THIS WOULD HELP!.

0 Kudos

Thanks Abhishek and Raymond....

Your replies really helped me a lot...

Points awarded for ur replies..

I am closing this thread

Regards

ram