‎2007 Jan 22 7:36 AM
Hi all,
I have to add a check box to the previous report, I need to fetch the data based on the checkbox. Please tell me how to proceed further with flag set.
Thanx and Regards,
Line.
‎2007 Jan 22 8:04 AM
Hi Friends,
I need to add two fields to my report based on the check box on the selection screen, Can any one help me how to do it. Or any sample program which helps me out.
Thanx in advance,
Line
‎2007 Jan 22 8:17 AM
if ui want to add check box
there is a command
data: chk_1 as checkbox.
use this command
bye
see u
‎2007 Jan 22 9:57 AM
Hi,
In selection screen write as below
parameters : cb_box as checkbox.Then in
START-OF-SELECTION.
IF cb_box = 'X'.
perform get_data.
ELSE.
perform get_data2.
ENDIF.In get data you can use an internal table without those two fields and in the get_data2 u can have the two fields in teh different internal table.
Or else while dispalying
IF cb_box = 'X'.
WRITE:/ itab-matnr,
itab-matkl,
itab-posnr.
ELSE.
WRITE:/ itab-posnr.
ENDIF.Hope this solves ur problem.
Please reward points for those who have answered for ur query.
‎2007 Jan 22 8:16 AM
Hi Line,
For this you need to use LOOP AT SCREEN.
in the Event AT SELECTION-SCREEN OUTPUT event, you need to write this coe.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF CHECK_BOX = 'X'.
IF SCREEN-GROUP1 = 'SC1'.
SCREEN-INPUT = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
Look at the link below
http://www.sap-img.com/abap/change-the-input-fields-dynamically-in-a-screen.htm
Regards
Sudheer
‎2007 Jan 22 8:19 AM
declare 2 fields in select-options with no-display mode. then based on ur check box selection...
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF CHECK_BOX = 'X'.
IF SCREEN-GROUP1 = 'SC1'.
SCREEN-INPUT = '1'.
ENDIF.
IF SCREEN-GROUP1 = 'SC2'.
SCREEN-INPUT = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
also check below....
Change the Input Fields Dynamically in a Screen
ABAP Dialog Programming Questions:
How to change the input fields dynamically in a screen which consists of 9 text fields?
Moreover the user must not enter values in some of the input fields where the values are given.
1.If you want to change the input fields on some user input then use 'user-command ac' after the field on which you want the action.
2.Specify the modif id 'xxx' for each screen object.
3.Then in the event 'AT SELECTION-SCREEN ON OUTPUT' loop at screen. check the screen-group1(modif id ) of screen objects and change the status of the object.
4.You can view all the screen attribute from se11.
The following example may help you:
SELECTION-SCREEN BEGIN OF BLOCK 001.
PARAMETERS: P_MRU RADIOBUTTON GROUP SEL DEFAULT 'X' USER-COMMAND AC,
P_PART RADIOBUTTON GROUP SEL.
SELECT-OPTIONS P1 FOR <field> MODIF ID PRT.
SELECT-OPTIONS G1 FOR <field> MODIF ID MRU.
SELECTION-SCREEN END OF BLOCK 001.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF P_MRU = 'X'.
IF SCREEN-GROUP1 = 'PRT'.
SCREEN-INPUT = '0'.
ENDIF.
IF SCREEN-GROUP1 = 'MRU'.
SCREEN-INPUT = '1'.
ENDIF.
ELSEIF P_PART = 'X'.
IF SCREEN-GROUP1 = 'MRU'.
SCREEN-INPUT = '0'.
ENDIF.
IF SCREEN-GROUP1 = 'PRT'.
SCREEN-INPUT = '1'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
‎2007 Jan 22 8:26 AM
check this code.
REPORT zforum12.
parameters : p_matnr like mara-matnr.
parameters : cb as checkbox user-command r .
selection-screen begin of block b1 with frame.
parameters : p_werks like marc-werks modif id abc,
p_lgort like mard-lgort modif id abc.
selection-screen end of block b1.
at selection-screen output.
if cb ne ' '.
loop at screen.
if screen-group1 = 'ABC'.
screen-active = '1'.
modify screen.
endif.
endloop.
elseif cb eq ' '.
loop at screen.
if screen-group1 = 'ABC'.
screen-active = '0'.
modify screen.
endif.
endloop.
endif.Please elaborate the query with data reference incase if the logic is not meeting your requirement.
hope this helps,
regards,
vijay.
‎2007 Jan 22 8:39 AM
Hi..
1) do u want this? if checkbox is not checked then no data is read from database and if checked then only data wil be fetched -
tables pa0001.
parameters p_check as checkbox.
data: begin of itab occurs 0.
include structure pa0001.
data end of itab.
start-of-selection.
if p_check = 'X'.
perform read_data.
endif.
if itab[] is not initial.
loop at itab.
write:/ itab-pernr.
endloop.
else.
write: 'No data fetched from database,may be u need to check the Checkbox'.
endif.
&----
*& Form read_data
&----
text
----
--> p1 text
<-- p2 text
----
FORM read_data .
select * from pa0001 into table itab up to 20 rows.
ENDFORM. " read_data
2) Adding fields based on Chekbox -
parameters: p_check AS CHECKBOX MODIF ID ABC USER-COMMAND CH.
parameters: p_pernr like pa0001-pernr modif ID ABD,
P_DATE LIKE PA0001-BEGDA MODIF ID ABD.
Check sy-ucomm = 'CH'.
AT SELECTION-SCREEN OUTPUT.
loop at screen.
if p_CHECK = 'X'.
if screen-group1 = 'ABD'.
SCREEN-ACTIVE = '1'.
MODIFY SCREEN.
ENDIF.
ELSE.
if screen-group1 = 'ABD'.
SCREEN-ACTIVE = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.