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: 

Radiobutton needs to change text/date range -- need help!

former_member210148
Participant
0 Kudos

Good day, everyone!

I've been trying to get this to work for a few hours now, and I'm stuck. I tried researching several terms on SDN, but I've not found a message that seems to address what I need. Here's the situation:

I have two radiobuttons, followed by a date field with no interval (single date only). This is the default for radiobutton 1. If radiobutton 2 is selected, I need the description for the date field to change, and now the date field needs to have an interval so the user can enter a range. So, it's like this:

Case 1:

(X) Date1

( ) Date 2

Date1: [ ]

Case 2:

( ) Date1

(X) Date 2

Date2: [ ] to [ ]

I've tried making the Date1/Date2 text a comment to change the text based on the button selected, but I can't figure out how to change the date field itself to accept just one date vs. an interval.

Does anyone have any ideas on how to solve this? As always, points awarded for ALL helpful answers.

Thanks in advance,

Dave

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos

Why don't you use two different fields like DATE_1 for the parameter, and DATE_2 for the range. This will make your selection also simpler in your following codes.

REPORT ZTEST_NP.

TABLES: BKPF.

PARAMETERS: P_R1 RADIOBUTTON GROUP G11 DEFAULT 'X' USER-COMMAND USR1,

P_R2 RADIOBUTTON GROUP G11.

PARAMETERS: P_DATE TYPE SY-DATUM MODIF ID GP1.

SELECT-OPTIONS: S_DATE FOR BKPF-BUDAT MODIF ID GP2.

AT SELECTION-SCREEN OUTPUT.

IF P_R1 = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GP2'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF P_R2 = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'GP1'.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Regards,

Naimesh Patel

Message was edited by:

Naimesh Patel

Former Member
0 Kudos

hi pls find the below code.

PARAMETERS: P_R1 RADIOBUTTON GROUP G11 DEFAULT 'X' USER-COMMAND USR1,

P_R2 RADIOBUTTON GROUP G11.

parameters: p_date like sy-datum.

select-options: s_date for sy-datum.

AT SELECTION-SCREEN OUTPUT.

IF P_R1 = 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'P_DATE' or

screen-name = '%_P_DATE_%_APP_%-TEXT'.

SCREEN-ACTIVE = 1.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_DATE-LOW' OR

SCREEN-NAME = 'S_DATE-HIGH' OR

SCREEN-NAME = '%_S_DATE_%_APP_%-VALU_PUSH' or

screen-name = '%_S_DATE_%_APP_%-TEXT'.

screen-ACTIVE = 0.

modify screen.

endif.

ENDLOOP.

ELSEIF P_R2 = 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'P_DATE' or

screen-name = '%_P_DATE_%_APP_%-TEXT'.

screen-ACTIVE = 0.

modify screen.

endif.

IF SCREEN-NAME = 'S_DATE-LOW' OR

SCREEN-NAME = 'S_DATE-HIGH' or

SCREEN-NAME = '%_S_DATE_%_APP_%-VALU_PUSH' or

screen-name = '%_S_DATE_%_APP_%-TEXT'.

screen-ACTIVE = 1.

modify screen.

endif.

ENDLOOP.

ENDIF.

pls reward.

former_member210148
Participant
0 Kudos

Neither reply really answered what I was after, but both gave me helpful information that I didn't already know. Points awarded to both.

Thanks!

0 Kudos

Ok. I have tried to chnage the "text" as per the radiobutton selection .. it was working in this way:

REPORT  ZTEST_NP.

TABLES: BKPF.

TYPE-POOLS SSCR.

PARAMETERS: P_R1 RADIOBUTTON GROUP G11 DEFAULT 'X' USER-COMMAND USR1,
            P_R2 RADIOBUTTON GROUP G11.

*PARAMETERS: P_DATE TYPE SY-DATUM MODIF ID GP1.

selection-screen: begin of line,
COMMENT 1(30) l_text,
POSITION 32.
SELECT-OPTIONS: S_DATE FOR BKPF-BUDAT MODIF ID GP2.
SELECTION-SCREEN: end of line.


at selection-screen output.
  if p_r1 = 'X'.
    l_text = 'Date1'.
  elseif p_r2 = 'X'.
    l_text = 'Date2'.
  endif.

start-of-selection.

I was also trying to toggle the select-options and parameters for same field.. but it is not working.

Regards,

Naimesh Patel