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 an update task? : abap modularization

776


What are the differences between a database index and a match code? : abap data dictionary

881


Is it possible to run host command from SAP environment? How do you run?

804


Explain the inside concept in select-options?

707


How to pass data from list to report?

739






What are the objects of the abap dictionary or what types of objects can be created in the abap dictionary? : abap data dictionary

697


any one can tell me which is the tables can store in ddic plese dont say db02l,please give me different ways of resideing the tables ?

2222


8)when u create sales report what u can see in that report ? what rthose field names or data element names? 9)when u create purchase order details report what u can see in that report ?what rthose fieldnames or dataelements? 10)when u create material stock report in material master grouped by material type and plant what u can see in report ?what rthose field names or dataelement ? 11)when u create shipping forecast report what u can see in that report ?what rthose data elements or field names?

1851


Explain the difference between float and packed data type?

990


Explain what is a logical database?

774


What is difference between check table and value table ?

812


How to find the return code of an stmt in abap programs?

820


What is an abap data dictionary? : abap data dictionary

776


What are the advantages of logical databases : abap hr

770


Where do you find info on new developments in SAP?

1736