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 |
What are V1 & V2 updates within the SAP LUW? Why & How they occur?
If u use US Database server? How can access the client?
what are parameters of DDCinsert fun module ?
in views..date base view can be used instead of join state ment in a program..it is one of reusable technique..is it correct???
What has to be done to the packed fields before submitting to a BDC session.
What is step-loop? Explain all the steps?
Describe the data classes?
What are smart forms?
how can we do performance tuning after coding?
What are the disadvantages of using explicit enhancement?
how to create f1 help and where f1 help is stored
Which transaction code is used executing a report (type 1 program)? : abap data dictionary