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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / harsh bansal
you shud code in AT Selectin
screen event
At selection screen.
If p_checkbox is initial.
If first_field is initial.
Message e000(zmsgclass).
Endif.
Elseif p_checkbox eq 'X'.
If second_field is initial.
Message e001(zmsgclass).
Endif.
Endif.
This vl b enuf..
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / sunil kumar gautam
This example will be help full for this problem.
PARAMETERS check1 AS CHECKBOX USER-COMMAND check.
select-OPTIONS regio for kna1-regio MODIF ID mad.
select-OPTIONS kunnr for kna1-kunnr MODIF ID kad.
AT SELECTION-SCREEN .
"LOOP AT SCREEN.
if check1 = 'X'.
if kunnr is INITIAL.
Message 'Customer is manditory' type 'E'.
endif.
endif.
if check1 is INITIAL.
if regio is INITIAL.
Message 'Region is manditory' type 'E'.
endif.
endif.
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / sunil kumar gautam
This example will be help full for this problem.
PARAMETERS check1 AS CHECKBOX USER-COMMAND check.
select-OPTIONS regio for kna1-regio MODIF ID mad.
select-OPTIONS kunnr for kna1-kunnr MODIF ID kad.
AT SELECTION-SCREEN .
"LOOP AT SCREEN.
if check1 = 'X'.
if kunnr is INITIAL.
Message 'Customer is manditory' type 'E'.
endif.
endif.
if check1 is INITIAL.
if regio is INITIAL.
Message 'Region is manditory' type 'E'.
endif.
endif.
Is This Answer Correct ? | 0 Yes | 2 No |
Function Module for smart forms?
Types of updating in call tr?
Logic for using table controls in BDC?
What are system fields for secondary lists?
Can we control the sequence in which multiple implementations of a multiple use BADI are called? If yes, how?
If we will display the data by writing write statement on start of selection then what is the need of end-of- selection in classical report
What are the data classes in abap?
How will you link form with the event driven in sap scripts?
what is the unit of work
The extract statements in field groups can be used before or after processing the sort statements. State true or false. : abap modularization
What is the modification assistant?
what is DATA ,TYPES,PaRAMETERS called in ABAP terms?