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

How is conversion of data types done between abap/4 & external level? : abap data dictionary

658


What is modularization and its benefits?

597


What is luw?

688


What happens when you post goods issue after delivery? How does the inventory get reduced after the delivery?

563


What does an exec sql statement do in abap? What is the disadvantage of using it?

688






Reports: Event functionality.

891


What functions does a data dictionary perform? : abap data dictionary

622


What is logo in sap script?

573


What are the types of indexes in abap?

608


What is meant by read lock? : sap abap data dictionary

565


Explain the differences between sap memory and abap memory?

538


Differentiate between abap memory and sap memory?

641


Why do we use dynamic where conditions?

878


What type of user exits have you written ?

1511


What is abap work bench?

731