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: 

Clear Fields Automatically instead of sscrfields-ucomm

Former Member
0 Kudos

Hi Experts,

I am doing a normal report, using screen-groups and loop at screen where

the entered data will get updated in Ztable (dbtab).

IF SY-SUBRC EQ 0.      "If all my condition satsifies (coding).

insert  ZABC.

 IF SY-SUBRC = 0.

          UPDATE ZXYZ.

          IF SY-SUBRC = 0.
            MESSAGE : I002   WITH 'RECORD CREATED SUCCESSFULLY''.
          ELSE.
            MESSAGE : E003  WITH 'SYSTEM ERROR'.
          ENDIF.

         ENDIF.
      ENDIF.
    ENDLOOP.


AT SELECTION-SCREEN.

CASE SSCRFIELDS-UCOMM.         

    WHEN 'FC01'.                    " Refresh button

 CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.

 ENDCASE.

Now my user don't want the refresh button, but he wants all the fields get cleared automatically.

After the POP-UP message ' RECORD CREATED'...( which will be displayed in seperate dialogue box )

all the fields should get cleared automatically.

Regards

Karthik

Edited by: Karthik R on Aug 28, 2009 12:00 PM

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

Hi,

I guess this wil work:-


IF SY-SUBRC EQ 0.      "If all my condition satsifies (coding).
 
insert  ZABC.
 
 IF SY-SUBRC = 0.
 
          UPDATE ZXYZ.
 
          IF SY-SUBRC = 0.
            MESSAGE : I002   WITH 'RECORD CREATED SUCCESSFULLY''.
            CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.
          ELSE.
            MESSAGE : E003  WITH 'SYSTEM ERROR'.
            CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.
          ENDIF.
 
         ENDIF.
      ENDIF.
    ENDLOOP.

Regards,

Tarun

10 REPLIES 10

Former Member
0 Kudos

hi

in the INITIALIZATION event you can clear all the fields or elaborate ur problem a bit more.

I355602
Advisor
Advisor
0 Kudos

Hi,

I guess this wil work:-


IF SY-SUBRC EQ 0.      "If all my condition satsifies (coding).
 
insert  ZABC.
 
 IF SY-SUBRC = 0.
 
          UPDATE ZXYZ.
 
          IF SY-SUBRC = 0.
            MESSAGE : I002   WITH 'RECORD CREATED SUCCESSFULLY''.
            CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.
          ELSE.
            MESSAGE : E003  WITH 'SYSTEM ERROR'.
            CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.
          ENDIF.
 
         ENDIF.
      ENDIF.
    ENDLOOP.

Regards,

Tarun

Former Member
0 Kudos

Dear Tarun,

I have already tried this , but its not working !!

Please advice me

Karthik

0 Kudos

Hi,

Can you please elaborate on your requirement.

Regards,

Tarun

Former Member
0 Kudos

Hello,

Are these fields you are talking about to be cleared the ones that are part of the selection screen or simply fields that you are using in your report and not the parameters used on the selection screen?

Regards,

Sachin

Former Member
0 Kudos

Dear Tharun,

My entire report is on the selection-screen, when user enters one input and press enter

some other fields wll be displayed using AT SELECTION-SCREEN event and I have used

AT SELECTION-SCREEN OUTPUT for * LOOP AT SCREEN* .

There are several input in my selection where the user will enter data manually and when he executes all necessary data

will go and save in my Z table. displaying a pop-up window "SUCCESSFULLY CREATED".

This pop-up window will be displayed in seperate screen, when the pop-up window is

displayed the user will press enter so that it will take to the initial screen (ie my selection-screen )

where all the fields are displayed as same as when they where displayed before the data getting saved to

my Z table.

So the user is asking that when the press enter on the pop-up window and when it takes

to the initial screen all the fields should be cleared.

all this come under Start-of-selection.

I think U are confused by my requirement.

Regards

Karthik

Former Member
0 Kudos

Hi,

Try clearing all the screen fields on your selection screen in the event AT SELECTION-SCREEN OUTPUT. Whenever you come back to your selection screen this event is triggered hence all the parameters holding the old values will be cleared whenever the screen is redisplayed.

Regards,

Sachin

0 Kudos

Hi,

I guess i understood your requirement a little bit.

If i am not wrong, you can follow the below approach to solve your problem.

First of all u r modifying the screen using AT SELECTION-SCREEN OUTPUT.

You are taking all the field values from this selection screen into the START-OF-SELECTION.

Take the value from the screen using the variables and clear the screen fields before moving to START-OF-SELECTION.


AT SELECTION-SCREEN OUTPUT

  "<<your code

  lv_field1 = field1. "<--assign screen field value to a variable
  "move all screen field values
  CLEAR : field1, field2. "<--clear all screen fields
  
START-OF-SELECTION
  "<--use all the variables populated above instead of screen fields.

Hope this helps you.

Please let me know if you have any queries.

Thanks & Regards,

Tarun

Former Member
0 Kudos

Hi ,

C the Bellow Code.It will solve ur problem.

IF SY-SUBRC EQ 0.      "If all my condition satsifies (coding).
 
insert  ZABC.
 
 IF SY-SUBRC = 0.
 
          UPDATE ZXYZ.
 
          IF SY-SUBRC = 0.
            MESSAGE : I002   WITH 'RECORD CREATED SUCCESSFULLY''.

                CLEAR: FIELD1,FIELD2, FIELD3, FIELD4, FIELD5, FIELD6, FIELD7.             " Modified 
 
          ELSE.
            MESSAGE : E003  WITH 'SYSTEM ERROR'.
          ENDIF.
 
         ENDIF.
      ENDIF.
    ENDLOOP.

Hope ur porblem resolved.

Regards,

Shankar GJ

Former Member
0 Kudos

Hi,

If you are talking about the parameters on the selection screen, then you can write the CLEAR statement in the AT SELECTION-SCREEN or AT SELECTION-SCREEN OUTPUT event.



PARAMETERS: var(10) TYPE c.

AT SELECTION-SCREEN.
  IF ( var CA sy-abcde ).
    MESSAGE 'Only Numerals' TYPE 'I'.
    CLEAR var.
ENDIF.