12-03-2007 3:45 PM
Hi,
I have a requirement like ,
After doubleclicking on report output,detail output will come <b>in which two fields will be in change mode</b>.<b>When user will modify the value and press the update button database will be updated with this new value</b>.
Now my query is :-
1) I am getting out put in change mode ( using 'input in' with write statement)
<b>But,how to get the modified value in workarea ?</b>
2) and how to update that new value in database as well .
Please check your self and ehlp me with sample code.
Award is assured.
Thanks in advance.
Regards.
Srikanta.
<b></b>
12-03-2007 3:53 PM
Get the total no. of line on the list output using sy-linct.
Do sy-linct times.
Using 'Read line'(Check in online Documentation) you can read the output list hich the user has changed and update those values in your internal table first
Enddo.
The using Update dbtab you can update the values to database table from internal table.
try this sample code:
DATA: date TYPE d,
flag TYPE c LENGTH 1,
wa TYPE c LENGTH 10.
START-OF-SELECTION.
date = sy-datum.
DO 10 TIMES.
date = date + sy-index.
WRITE: / flag AS CHECKBOX, (10) date.
ENDDO.
AT LINE-SELECTION.
DO.
READ LINE sy-index FIELD VALUE flag
date INTO wa.
IF sy-subrc <> 0.
EXIT.
ELSEIF flag = 'X'.
WRITE / wa.
ENDIF.
ENDDO.
12-03-2007 4:07 PM
Can u help me with sample code for ALV.
Thanks a lot for your reply.
Regards.
Srikanta
12-03-2007 3:55 PM
You need to use the READ LINE syntax.
Like this:
DATA: date TYPE d,
flag(1) TYPE c,
wa(10) TYPE c.
START-OF-SELECTION.
date = sy-datum.
DO 10 TIMES.
date = date + sy-index.
WRITE: / flag AS CHECKBOX, (10) date.
ENDDO.
AT LINE-SELECTION.
DO.
READ LINE sy-index FIELD VALUE flag
date INTO wa.
IF sy-subrc <> 0.
EXIT.
ELSEIF flag = 'X'.
WRITE / wa.
ENDIF.
ENDDO.
Store your data from the screen into one internal table and then use MODIFY ZTAB FROM ITAB syntax to update the database table.
I would advise to make a ALV, if possible.
Regards,
Naimesh Patel
12-03-2007 3:59 PM
Hi,
try this sample code...
REPORT ztest NO STANDARD PAGE HEADING.
TABLES eban.
DATA : BEGIN OF itab OCCURS 100,
matnr LIKE eban-matnr,
menge LIKE eban-menge,
END OF itab.
DATA : itab2 LIKE itab OCCURS 0 WITH HEADER LINE.
DATA : total LIKE itab-menge.
SELECT-OPTIONS : s_matnr FOR eban-matnr.
*AT USER-COMMAND.
AT LINE-SELECTION.
"write this below sample code in AT USER-COMMAND becasue you are using
"Push button. here I'm using AT LINE-SELECTION.
READ LINE sy-lilli FIELD VALUE itab-matnr
itab-menge.
UPDATE eban SET menge = itab-menge
WHERE matnr = itab-matnr.
*----------------------------------------------------------*
* Get data from table EBAN *
*----------------------------------------------------------*
START-OF-SELECTION.
SELECT matnr menge INTO CORRESPONDING FIELDS OF TABLE itab
FROM eban UP TO 20 ROWS WHERE matnr IN s_matnr
AND matnr NE space .
SORT itab BY matnr.
LOOP AT itab.
WRITE 😕 sy-vline,
2 itab-matnr INPUT ON,
20 sy-vline,
21 itab-menge DECIMALS 0 INPUT ON,
40 sy-vline.
HIDE : itab-matnr, itab-menge.
ENDLOOP.
ULINE /(40).
12-03-2007 4:09 PM