‎2007 Nov 06 11:42 AM
I have a requirement like below :
User will input the input field value( in selection screen) and execute the transaction to get the data. The extracted data output will be displayed as list on screen. This list display of records is in display mode to avoid the multiple records locking by single user. User will select the single line from the list displayed data and open in change mode in detail. User will update one field manually and save the record.To update next record, user can select the next record of the list displayed data and open in detailed change mode.
<b>PLEASE SEND ME SOME CODE.</b>
<b>Point is assured.</b>
Thanks in advance.
Regards.
Srikanta
‎2007 Nov 06 1:29 PM
Here is a sample code. I did something like this some time ago and the solution that i used was like that. But in my problem I also update some table fields. In this code example i didin't do that. I hope is helps.
-
TABLES: marav.
TYPE-POOLS: slis.
DATA: BEGIN OF imat OCCURS 100,
matnr LIKE marav-matnr,
maktx LIKE marav-maktx,
matkl LIKE marav-matkl,
ntgew LIKE marav-ntgew,
gewei LIKE marav-gewei,
END OF imat.
DATA: i_layout TYPE slis_layout_alv,
i_repid LIKE sy-repid,
i_lines LIKE sy-tabix,
int_fcat TYPE slis_t_fieldcat_alv.
DATA: saida_pop TYPE STANDARD TABLE OF sval WITH HEADER LINE,
retcode(1) TYPE c.
----
SELECT-OPTIONS:
s_matnr FOR marav-matnr MATCHCODE OBJECT mat1.
----
START-OF-SELECTION.
read data into table imat
SELECT * FROM marav
INTO CORRESPONDING FIELDS OF TABLE imat
WHERE
matnr IN s_matnr.
CLEAR i_lines.
DESCRIBE TABLE imat LINES i_lines.
IF i_lines LT 1.
WRITE: /
'No materials found.'.
EXIT.
ENDIF.
END-OF-SELECTION.
Store report name
i_repid = sy-repid.
Create Fieldcatalogue from internal table
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = i_repid
i_internal_tabname = 'IMAT' "capital letters!
i_inclname = i_repid
CHANGING
ct_fieldcat = int_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
i_layout-zebra = 'X'.
i_layout-colwidth_optimize = 'X'.
Call for ALV list display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
i_callback_user_command = 'Z_USER_COMMAND'
i_callback_top_of_page = 'CABECALHO '
it_fieldcat = int_fcat
i_grid_title = 'ALV Title'
is_layout = i_layout
TABLES
t_outtab = imat
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE: /
'Returncode',
sy-subrc,
'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
ENDIF.
&----
*& Form user_command
&----
FORM z_user_command USING p_ucomm LIKE sy-ucomm
p_selfield TYPE slis_selfield.
refresh: saida_pop.
clear: saida_pop.
This table will displayed in a popup
saida_pop-tabname = 'MARAV'.
saida_pop-fieldname = 'MATNR'.
saida_pop-fieldtext = 'Material'.
APPEND saida_pop.
saida_pop-tabname = 'MARAV'.
saida_pop-fieldname = 'MAKTX'.
saida_pop-fieldtext = 'Description'.
APPEND saida_pop.
CASE p_ucomm.
WHEN '&IC1'.
IF p_selfield-fieldname = 'MATNR'.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
popup_title = 'Updating Fields'
IMPORTING
returncode = retcode
TABLES
fields = saida_pop
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF retcode <> 'A'.
READ TABLE imat INDEX p_selfield-tabindex.
READ TABLE saida_pop INDEX 1.
imat-matnr = saida_pop-value.
READ TABLE saida_pop INDEX 2.
imat-maktx = saida_pop-value.
MODIFY imat index p_selfield-tabindex.
ENDIF.
ENDIF.
ENDCASE.
p_selfield-refresh = 'X'.
ENDFORM.
----
FORM cabecalho *
----
........ *
----
FORM cabecalho.
*ALV Header declarations
DATA: t_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
Title
wa_header-typ = 'H'.
wa_header-info = 'Cabecalho ALV'.
APPEND wa_header TO t_header.
CLEAR wa_header.
Data
wa_header-typ = 'S'.
wa_header-key = 'Data: '.
CONCATENATE sy-datum+6(2) '/'
sy-datum+4(2) '/'
sy-datum(4) INTO wa_header-info.
APPEND wa_header TO t_header.
CLEAR: wa_header.
Hora
wa_header-typ = 'S'.
wa_header-key = 'Hora: '.
CONCATENATE sy-uzeit+0(2) ':'
sy-uzeit+2(2) ':'
sy-uzeit+4(2) INTO wa_header-info.
APPEND wa_header TO t_header.
CLEAR: wa_header.
Usuario
wa_header-typ = 'S'.
wa_header-key = 'Usuario: '.
wa_header-info = sy-uname.
APPEND wa_header TO t_header.
CLEAR: wa_header.
Total de linhas retornadas
DESCRIBE TABLE imat LINES ld_lines.
ld_linesc = ld_lines.
CONCATENATE 'Numero de linhas selecionadas: ' ld_linesc
INTO t_line SEPARATED BY space.
wa_header-typ = 'A'.
wa_header-info = t_line.
APPEND wa_header TO t_header.
CLEAR: wa_header, t_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header.
ENDFORM.
‎2007 Nov 06 1:29 PM
I forgot to say that is necessary to double click on the first column to update the line.