‎2008 Jan 09 1:04 AM
Hi gurus,
I have this requirement wherein a certain field in the ALV must be edited and captured. I am using a FM for the ALV (not the OOP). I also dont have a checkbox. The idea is whatever row the user choses to edit, only that row must be capture. For example I have 10 rows of data and only the second row was edited by the user. That row must be the only one considered for some other process (e.g. SAVING).
Hope you can help me.
Thanks
Andre
‎2008 Jan 09 4:08 AM
Hi Andre,
The question u r asked is very good.The answer for ur problem is, Actually u declared one internal table and that can be passed to GRID OR LIST function module.That means ur result is present in the internal table ok..U must declare another internal table with same structure and move the first internal table values into second internal table before u can pass internal table to GRID OR LIST function module.After u modify the values u can compare the values with second internal table record by record if sy-subrc <> 0. we can capture that record(we can pass that record to another internal table)..
Award points if helpful.
Kiran Kumar.G
Have a Nice Day..
‎2008 Jan 09 3:21 AM
Andre,
Try this No need of check box. Do below code.
1.First Declare a field like flag in your final internal table
Ex: flag
DATA : BEGIN OF ty_zaw_pol_plan.
DATA : flag TYPE c.
INCLUDE STRUCTURE zaw_pol_plan.
DATA : END OF ty_zaw_pol_plan.
2. Add flag to your layout
Ex: gs_layout-box_fieldname = 'FLAG'.
3. Any how we are passing our layout to below FM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_pf_status_set = 'GUI_STAT'
i_callback_user_command = 'STAT'
is_layout = gs_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_zaw_pol_plan.
FORM gui_stat USING rt_extab TYPE slis_t_extab.
***Here to create SAVE buttons or etc. you need this PF **status .Double click on this and create button
SET PF-STATUS 'STANDARD' EXCLUDING rt_extab.
SET TITLEBAR text-005.
ENDFORM.
**--Calling the subroutine when button clicked on output
FORM stat USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
DATA selfield TYPE slis_selfield.
CASE r_ucomm.
**When save pressed.Here capture your Function code of **your button.
WHEN 'SAVE'.
LOOP AT i_zaw_pol_plan WHERE flag EQ c_x.
Your logic here. to save the data.
ENDLOOP.
ENDCASE.
ENDFORM.
Don't forget to reward if useful.......
‎2008 Jan 09 3:40 AM
Hi,
Thanks for the reply. Where is the part wherin only the selected row without using a checkbox or box in the is considered.
Thanks again
Andre
‎2008 Jan 09 3:40 AM
Hi ,
The value you have edited is automatically modifed in the internal table you pass to the ALV FM ,so you need to worry about the record that is changed.
In case you want to get the row which was edited you can check the value of the parameter RS_SELFIELD in the subroutine which handles the user command.
-
REPORT ZAR_ALV .
type-pools : slis.
data : catalog type slis_t_fieldcat_alv ,
wa_catalog type slis_fieldcat_alv ,
exclude type SLIS_T_EXTAB ,
wa_exclude type slis_extab.
data : begin of it_1 occurs 0 ,
matnr type matnr ,
werks type werks_d,
end of it_1.
select matnr werks
into table it_1
up to 10 rows
from marc.
wa_catalog-fieldname = 'MATNR' .
wa_catalog-edit = 'X'.
APPEND WA_CATALOG TO CATALOG.
wa_catalog-fieldname = 'WERKS' .
APPEND WA_CATALOG TO CATALOG.
WA_EXCLUDE-FCODE = '&OL0'.
APPEND WA_EXCLUDE TO EXCLUDE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZAR_ALV'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = catalog[]
IT_EXCLUDING = EXCLUDE[]
TABLES
t_outtab = IT_1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
BREAK-POINT.
ENDFORM.
-
Regards
Arun
‎2008 Jan 09 4:08 AM
Hi Andre,
The question u r asked is very good.The answer for ur problem is, Actually u declared one internal table and that can be passed to GRID OR LIST function module.That means ur result is present in the internal table ok..U must declare another internal table with same structure and move the first internal table values into second internal table before u can pass internal table to GRID OR LIST function module.After u modify the values u can compare the values with second internal table record by record if sy-subrc <> 0. we can capture that record(we can pass that record to another internal table)..
Award points if helpful.
Kiran Kumar.G
Have a Nice Day..
‎2008 Jan 09 6:04 AM
Hi muralikrishna , arun and kiran.
Thanks for your help. You guided me well and helped solve my problem.
Thanks again,
Andre