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 PARAMETERS field

Former Member
0 Likes
4,684

Hi. I have a small question. I have a PARAMETERS on my SELECTION-SCREEN. I'd like to set them emty when program ends and backs to SELECTION-SCREEN. How to do this? Greetings. P.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,073

Hi,

see this code.

PARAMETERS:name(10),num(2).

write:/ name.

write:/ num.

AT SELECTION-SCREEN OUTPUT.

clear name.

<b>reward if helpful</b>

rgds,

bharat.

Hi. I have a small question. I have a PARAMETERS on my SELECTION-SCREEN. I'd like to set them emty when program ends and backs to SELECTION-SCREEN. How to do this? Greetings. P.

13 REPLIES 13
Read only

Former Member
0 Likes
3,073

Try clearing it at the end of the program.

CLEAR p_xyz.

Provided there no memory id is attached to the parameter.

<b>Do Reward If Useful Answer</b>

Thanks

Vishwanath Purohit

Read only

Former Member
0 Likes
3,073

Hi,

End-of-selection.

clear p_param.

rewards if useful,

regards,

nazeer

Read only

Former Member
0 Likes
3,073

hi,

u can use clear <fieldname> .

reward if useful

ravi

Read only

former_member188827
Active Contributor
0 Likes
3,073

at end of program use:

p_field = ' '.

plz reward points if it helps

Read only

0 Likes
3,073

I try but there's no effect. Maybe it's connected with my program structure below.

REPORT zgr_package .
TABLES: zpackage.

DATA: adrnr TYPE adrnr.
DATA: internalname TYPE rs38l_fnam.
DATA: control_parameters  TYPE ssfctrlop.
INCLUDE <ICON>.

SELECTION-SCREEN begin of block b1 with frame.
  PARAMETERS werks LIKE zpackage-werks OBLIGATORY.
  PARAMETERS datum LIKE zpackage-datum  OBLIGATORY.
  PARAMETERS vendor LIKE zpackage-vendor  OBLIGATORY.
  PARAMETERS pack LIKE zpackage-pack  OBLIGATORY.
  PARAMETERS note LIKE zpackage-note.
SELECTION-SCREEN END OF BLOCK b1 .
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
  SELECTION-SCREEN COMMENT 01(20) v_icon FOR FIELD print.
  PARAMETERS: print as checkbox.
SELECTION-SCREEN END OF BLOCK b2.


INITIALIZATION.
  GET PARAMETER ID 'WRK' FIELD werks.
  datum = sy-datum.
  v_icon = '@2P@'. "icon_test.


START-OF-SELECTION.

  AUTHORITY-CHECK OBJECT 'M_BEST_WRK' ID 'WERKS' FIELD werks.
  IF sy-subrc NE 0.
    MESSAGE e398(00) WITH text-001.
  ELSE.
    SELECT SINGLE * FROM zpackage WHERE
    werks = werks AND pack = pack.
    IF sy-subrc = 0.
      MESSAGE i398(00) WITH text-002.
    ELSE.
      zpackage-werks = werks.
      zpackage-datum = datum.
      zpackage-vendor = vendor.
      zpackage-pack = pack.
      zpackage-uname = sy-uname.
      zpackage-note = note.
      IF print = 'X'.
        PERFORM PREPARE_ADDR.
        PERFORM PRINT_DOCUMENT.
      ENDIF.
      INSERT zpackage.
      MESSAGE s398(00) WITH text-003.
    ENDIF.
  ENDIF.

END-OF-SELECTION.
  CLEAR vendor.
  CLEAR note.
  pack = ''.

Read only

0 Likes
3,073

i think da probelm is dat u've declared da fields obligatory and so dey cannot be blank..

check if removing da obligatory option helps or not

plz reward points if it helps..

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
3,073

You need to use the FREE MEMORY statement at the end code execution.

Regards,

RIch Heilman

Read only

0 Likes
3,073

Try this.

END-OF-SELECTION.
  CLEAR vendor.
  CLEAR note.
 FREE MEMORY.

Regards,

RIch Heilman

Read only

0 Likes
3,073

OK. One more thing. I'd like to clear not all fields. Only note, pack and vendor. And the most important - when fields clears I'd like werks to set it's value on value which was inserted by user.

Read only

0 Likes
3,073

Ok, then we are going to have to go a different way. I'll be back.

Regards,

RIch Heilman

Read only

0 Likes
3,073

Ok, so now we also want to use parameter ids for the WERKS and DATUM fields, so that we hold the values that the user has entered, but clear everything else.



selection-screen begin of block b1 with frame.
parameters werks like marc-werks memory id zwrk obligatory .
parameters datum like sy-datum memory id zdat  obligatory.
parameters vendor like lfa1-lifnr  obligatory.
parameters pack type char20  obligatory.
parameters note type char20.
selection-screen end of block b1 .

initialization.


start-of-selection.

  write:/ 'Start-of-selection'.

end-of-selection.

  write:/ 'End-of-selection'.
  free memory.
  set parameter id 'ZWRK' field werks.
  set parameter id 'ZDAT' field datum.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
3,074

Hi,

see this code.

PARAMETERS:name(10),num(2).

write:/ name.

write:/ num.

AT SELECTION-SCREEN OUTPUT.

clear name.

<b>reward if helpful</b>

rgds,

bharat.

Read only

0 Likes
3,073

It appears that you have marked Bharat's answer as solving your problem. I can assure you that you have recieved some bad information. Why? Well, test that example solution. If you enter a value into the fields and hit enter, the NAME field will be cleared. This is no the behavior that you want, I'm sure. I strongly suggest that you use the logic in my example above, this is the only way you will get the functionality that you require.

Regards,

Rich Heilman