‎2009 May 14 9:51 AM
Hi,
*I am having the below things ready with me.*
1. I have a table control ready with me, which contains 6 fields, 2 radio buttons and 1 push button.
This is for 'N' number of rows.
2. The position of the radio buttons is in between these 6 fields, exactly at the center.
The position of the push button is at the end of the row.
*I want to add the below functionality to the screen:-*
1. All the push buttons for all rows should be in disable mode.
2. After the user has entered data in first 3 fields, the radio buttons come into picture.
3. If rad1 = 'X', then the user continues entering data for remaining 3 fields and goes
to the next row to the next row to enter more data or else he/she presses save and
the data is saved in the Internal Table.
If rad2 = 'X', then the push button for that row gets enabled.
4. When the Push button is clicked, a pop-up screen is populated and the
user enters more info for that row.
5. After entering data in the pop-screen , the user presses enter and the data is saved for that row.
6. Like this the process has to continue as long as the user wants to enter data for each row.
7. Please do stress on how to save the data from screen to Internal table.
screen looks like :-
field1 field2 field3 Rad1 Rad2 field4 field5 field6
-- -- -- -- -- --- --- ---
Please recommend what I need to do.
Regards,
Mamta Gupta.
‎2009 May 14 9:53 AM
Hi,
Please refer the code below.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE.