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

clear subscreen

Former Member
0 Likes
1,716

how can you clear a subscreen of all the data. I have a tabstrip that has 5 subscreen. the main screen which is 100 has a primary field that will use to load the data into all the 5 subscreens. when the user wants to create a new record, the subscreens should be blank. then when they push the save button, then the record will be save.

MODULE USER_COMMAND_0100 INPUT.

CASE SY-DYNNR.

CASE OK_CODE.

WHEN 'SAVE'.

perform check_projectnumber.

perform saverecord.

WHEN 'DELETE'.

perform check_projectnumber.

WHEN 'CHANGE'.

perform check_projectnumber.

WHEN 'INSERT'.

perform check_projectnumber.

WHEN 'CREATE'.

perform add_project.

when 'ENTER'.

perform check_projectnumber.

ENDCASE.

ENDCASE.

CLEAR OK_CODE.

ENDMODULE. " EXIT INPUT

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,040

If the screen fields are not part of some structure, then you will need to clear them individually.

Clear: p_fld1, p_Fld2, p_Fld3, p_fld4.

If all your fields are of a structure, then you can simple clear the structure.

Data: begin of xscreen,
      p_fld1 type c,
      p_fld2 type c,
      p_fld3 type c,
      p_fld4 type c,
      end of xscreen.

clear xscreen.

In your USER_COMMAND, simply enter the clear statement.

MODULE USER_COMMAND_0100 INPUT.
CASE SY-DYNNR.
CASE OK_CODE.
WHEN 'SAVE'.
perform check_projectnumber.
perform saverecord.
WHEN 'DELETE'.
perform check_projectnumber.
WHEN 'CHANGE'.
perform check_projectnumber.
WHEN 'INSERT'.
perform check_projectnumber.
WHEN 'CREATE'.
<b>*  Insert the CLEAR STATEMENT HERE   <---- HERE</b>
perform add_project.
when 'ENTER'.
perform check_projectnumber.
ENDCASE.
ENDCASE.
CLEAR OK_CODE.
ENDMODULE. " EXIT INPUT

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,040

I think you have to clear each field individually.

If they are a part of the same structure, then you can clear that structure at once.

Regards,

Ravi

Read only

venkata_ramisetti
Active Contributor
0 Likes
1,040

Hi,

You can use CLEAR syntax.

Eg: CLAER: V_FIELD1, V_STRCTURE1.

It is better to define all fields in 5 screens in single structure. Because it is simple to clear all the data in one instance.

Write the CLEAR statement after SAVE data.

Thanks,

Ramakrishna

Read only

0 Likes
1,040

I try to clear it using clear ZTBLCTRL_BUDGET. but when i run the transaction, give me runtime error. DYNP_COMPRESS_ILLEGAL_VALUE

The tabstrips are created in SPWizard and all the subscreens are link to a custom SAP table. I'm trying to add, delete, modify the data in the table. Is there a simple way of doing this? any help will be great appreciate.