i have 2 fields on selection screen of a Report along with
a check box.My requirement is initially that first field
sud be mandatory but when we click on the check box the
first field which was mandatory sud now be optional and the
second field now sud be mandatory.Please provide the
solution asap. thank u.

Answer Posted / madan

REPORT ztest2.
TABLES t001w.

SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECT-OPTIONS s_werks FOR t001w-werks OBLIGATORY.
SELECT-OPTIONS s_land FOR t001w-land1.

SELECTION-SCREEN BEGIN OF BLOCK b2.
PARAMETERS chk AS CHECKBOX USER-COMMAND click.
SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.
* This event is then triggered when a user selects an
option from CHECKBOX
IF chk = ''.
LOOP AT SCREEN.
IF screen-name = 'S_WERKS-LOW'.
screen-required = '1'.
MODIFY SCREEN. " INDEX sy-tabix.
ELSEIF screen-name = 'S_LAND-LOW'.
screen-required = ''.
MODIFY SCREEN. " INDEX sy-tabix.
ENDIF.
ENDLOOP.
ELSEIF chk = 'X'.
LOOP AT SCREEN.
IF screen-name = 'S_WERKS-LOW'.
screen-required = ''.
MODIFY SCREEN. " INDEX sy-tabix.
ELSEIF screen-name = 'S_LAND-LOW'.
screen-required = '1'.
MODIFY SCREEN. " INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDIF.


AT SELECTION-SCREEN OUTPUT.
* This event is also trigged to re-draw ABAP report screen
so can be
* used to hide or display fields

IF chk = ''.
LOOP AT SCREEN.
IF screen-name = 'S_WERKS-LOW'.
screen-required = '1'.
MODIFY SCREEN. " INDEX sy-tabix.
ELSEIF screen-name = 'S_LAND-LOW'.
screen-required = ''.
MODIFY SCREEN. " INDEX sy-tabix.
ENDIF.
ENDLOOP.
ELSEIF chk = 'X'.
LOOP AT SCREEN.
IF screen-name = 'S_WERKS-LOW'.
screen-required = ''.
MODIFY SCREEN. " INDEX sy-tabix.
ELSEIF screen-name = 'S_LAND-LOW'.
screen-required = '1'.
MODIFY SCREEN. " INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDIF.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the role of ‘refresh’ in internal table?

588


What are subroutines? : abap modularization

616


Why cant we use Normal function module for data transfer?

1695


Business scenarios related to your objects( In my case -Rulebook and Pricing work flow)

829


How do you save data in bdc tables? : abap bdc

584






What do you mean by cluster tables in sap abap? Also explain what do you mean by table cluster? : abap data dictionary

510


What are the different types of work process?

584


Why do we need to code a loop statement in both the pbo and pai events for each table in the screen?

588


What are the types of subroutines?

610


What are clustered tables?

608


What are field symbols?

629


Can you set up background processing using call transaction?

583


What are the classifications of the sap abap data classes?

608


How the at-user command serves mainly in lists?

611


What is value table? : abap data dictionary

635