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

Query on selection screen

0 Likes
578

Hi all,

Please give me the solutions to the following in selection screen:

1. In selection-screen there is one select-options and one parameter.

Now,if the select-opotions range is given 30 to 40 then, the parameter should be populated with 'A'.

If the select -options is given the value 50, then the value should be 'P'.

If the select-optons is given the value 65,then the value should be 'X'.

if the select-options is given the value 87, then the value should be 'N'.

2) In the selection - screeen there is one check box and select-options.

By default the check-box will be deselected and select-options will be defaulted with system date.

Now, when the checkbox is selected the select-options should be empty.

And again, when the checkbox is deselected then again the select-optons should be populated with system date.

Please let me know solutions to the above asap.

All points will be awarded.

Thanking you in advance.

Regards,

A.Srinivas

1 ACCEPTED SOLUTION
Read only

awin_prabhu
Active Contributor
0 Likes
549

Hi Srinu,

Try below code. I have used matnr in select-options. Change it according to your data element.

TABLES: mara.

SELECT-OPTIONS: s_matnr FOR mara-matnr.

PARAMETERS: p_c TYPE c.

PARAMETERS: p_chk AS CHECKBOX USER-COMMAND chk.

SELECT-OPTIONS: s_date FOR sy-datum DEFAULT sy-datum.

AT SELECTION-SCREEN.

IF p_chk = 'X'.

CLEAR s_date[].

ELSE.

s_date-low = sy-datum.

APPEND s_date.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF s_date[] IS NOT INITIAL.

p_chk = ''.

ENDIF.

LOOP AT s_matnr.

IF s_matnr-low = '000000000000000030' AND s_matnr-high = '000000000000000040'.

p_c = 'A'.

exit.

ENDIF.

CASE s_matnr-low.

WHEN '000000000000000050'.

p_c = 'P'.

WHEN '000000000000000065'.

p_c = 'X'.

WHEN '000000000000000087'.

p_c = 'N'.

ENDCASE.

ENDLOOP.

4 REPLIES 4
Read only

awin_prabhu
Active Contributor
0 Likes
550

Hi Srinu,

Try below code. I have used matnr in select-options. Change it according to your data element.

TABLES: mara.

SELECT-OPTIONS: s_matnr FOR mara-matnr.

PARAMETERS: p_c TYPE c.

PARAMETERS: p_chk AS CHECKBOX USER-COMMAND chk.

SELECT-OPTIONS: s_date FOR sy-datum DEFAULT sy-datum.

AT SELECTION-SCREEN.

IF p_chk = 'X'.

CLEAR s_date[].

ELSE.

s_date-low = sy-datum.

APPEND s_date.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF s_date[] IS NOT INITIAL.

p_chk = ''.

ENDIF.

LOOP AT s_matnr.

IF s_matnr-low = '000000000000000030' AND s_matnr-high = '000000000000000040'.

p_c = 'A'.

exit.

ENDIF.

CASE s_matnr-low.

WHEN '000000000000000050'.

p_c = 'P'.

WHEN '000000000000000065'.

p_c = 'X'.

WHEN '000000000000000087'.

p_c = 'N'.

ENDCASE.

ENDLOOP.

Read only

0 Likes
549

Hey dear, small correction to your code.

REPORT ZTEST_PROGRAM.
TABLES: MARA.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
PARAMETERS: P_C TYPE C.
PARAMETERS: P_CHK AS CHECKBOX USER-COMMAND CHK.

SELECT-OPTIONS: S_DATE FOR SY-DATUM DEFAULT SY-DATUM.

AT SELECTION-SCREEN.
  IF P_CHK = 'X'.
    CLEAR S_DATE[].
  ELSE.
    CLEAR S_DATE[]."Clearing selection table.
    S_DATE-LOW = SY-DATUM.
    APPEND S_DATE.
  ENDIF.

AT SELECTION-SCREEN OUTPUT.
  IF S_DATE[] IS NOT INITIAL.
    P_CHK = ''.
  ENDIF.
  LOOP AT S_MATNR.
    IF S_MATNR-LOW = '000000000000000030' AND S_MATNR-HIGH = '000000000000000040'.
      P_C = 'A'.
      EXIT.
    ENDIF.
    CASE S_MATNR-LOW.
      WHEN '000000000000000050'.
        P_C = 'P'.
      WHEN '000000000000000065'.
        P_C = 'X'.
      WHEN '000000000000000087'.
        P_C = 'N'.
    ENDCASE.
  ENDLOOP.
Thanks Venkat.O

Read only

Former Member
0 Likes
549

Hi Srinu ,

You can achive the same by using events of report.

Search in google or sdn for details.

You can also use F1 help on at selection-screen , initialization etc.

Read only

Former Member
0 Likes
549

hi,

Try this

 TABLES: vbak.

SELECT-OPTIONS: so_vbeln FOR vbak-vbeln.
PARAMETER: p_value TYPE c.

SELECT-OPTIONS: so_date FOR sy-datum DEFAULT sy-datum.
PARAMETER: p_chk AS CHECKBOX.



AT SELECTION-SCREEN OUTPUT.

  LOOP AT so_vbeln.
    IF so_vbeln-low = '0000000030'.
      p_value = 'A'.
    ENDIF.
    IF so_vbeln-low = '0000000050'.
      p_value = 'P'.
    ENDIF.

    IF so_vbeln-low = '0000000065'.
      p_value = 'X'.
    ENDIF.

    IF so_vbeln-low = '0000000087'.
      p_value = 'N'.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN.
  IF p_chk = 'X'.
    REFRESH so_date.

  ENDIF.
  IF p_chk <> 'X'.
    so_date-low = sy-datum.
    APPEND so_date.
  ENDIF. 

Edited by: Jk on Sep 10, 2009 6:27 AM