2009 Mar 16 9:50 AM
Hi,
In ALV grid output screen has two fields are there one is edit mode.if i chage value in edit mode
and i enter enter-buttonit will do sum calculation and the output will be displayed on the next field.
for example:
closing stock quantity diffenence
20 15(10) 5(10)
30 10 20
this is the alv grid output screen.the quantity in edit mode. if i change the quantity 15(10) and i enterenter-button it will show output in difference field 10.
can you help me.
Regards,
K.Karthikeyan.
Moderator message=>
use meaningful subject for your future questions
Edited by: Vijay Babu Dudla on Mar 18, 2009 12:32 AM
2009 Mar 16 10:01 AM
Hi,
Take a field for difference in internal table and calculate the difference as per the entries.
Now you must have used this internal table to display data in alv grid.
So use this code to reflect the data as per changes in alv:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
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 pf
*&---------------------------------------------------------------------*
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
* -->RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is 'SAVE' then reflect the changes as per user
WHEN 'SAVE'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
"now at this time you have modified internal table
loop at it_final.
it_final-diff = it_final-field4 - it_final-field5. "calculate difference
modify it_final index sy-index.
endloop.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
"alv output is refreshed as per changes in internal table
ENDCASE.
ENDFORM. "USER_COMMAND
In pf-status take the function code for standard SAVE button as SAVE and when user clicks SAVE button then calculate the new difference and modify internal table.
Hope this helps you.
Regards,
Tarun
Hi,
In ALV grid output screen has two fields are there one is edit mode.if i chage value in edit mode
and i enter enter-buttonit will do sum calculation and the output will be displayed on the next field.
for example:
closing stock quantity diffenence
20 15(10) 5(10)
30 10 20
this is the alv grid output screen.the quantity in edit mode. if i change the quantity 15(10) and i enterenter-button it will show output in difference field 10.
can you help me.
Regards,
K.Karthikeyan.
Moderator message=>
use meaningful subject for your future questions
Edited by: Vijay Babu Dudla on Mar 18, 2009 12:32 AM
2009 Mar 16 9:55 AM
Hi KK,
formula is closing = stock quantity + diffenence
20 = 15 + 5
IF u make 15 -
> 10 then
20 = 10 + 10
therfore, difference is 10.
Reg,
Sachin
2009 Mar 16 9:58 AM
Hi,
there are three feilds like
closing stock
quantity
difference
but logic is correct.
Regards,
K.Karthikeyan
Edited by: Karthikeyan Krishnan on Mar 16, 2009 3:29 PM
2009 Mar 16 10:01 AM
hi after enter means after user interface run same fm for alv grid by editing the internal table.
we have fm for getting the changed data from editable alv
2009 Mar 16 10:01 AM
Hi,
Take a field for difference in internal table and calculate the difference as per the entries.
Now you must have used this internal table to display data in alv grid.
So use this code to reflect the data as per changes in alv:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
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 pf
*&---------------------------------------------------------------------*
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
*----------------------------------------------------------------------*
* -->RT_EXTAB
*----------------------------------------------------------------------*
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'.
ENDFORM. "pf
*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
*----------------------------------------------------------------------*
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is 'SAVE' then reflect the changes as per user
WHEN 'SAVE'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
"now at this time you have modified internal table
loop at it_final.
it_final-diff = it_final-field4 - it_final-field5. "calculate difference
modify it_final index sy-index.
endloop.
* refresh the ALV Grid output from internal table
l_selfield-refresh = c_check.
"alv output is refreshed as per changes in internal table
ENDCASE.
ENDFORM. "USER_COMMAND
In pf-status take the function code for standard SAVE button as SAVE and when user clicks SAVE button then calculate the new difference and modify internal table.
Hope this helps you.
Regards,
Tarun
2009 Mar 18 4:28 AM
Hi Tarun,
your answer is exactly correct.but i need one more modification.when user clicks SAVE button then calculate the new difference and modify internal table.but i need that new difference and modify in the alv output screen itself.
as per your logic it modify iternal table only.but i need both internal table and alv output screen.
Regards,
K.Karthikeyan.
2009 Mar 18 4:31 AM
Hi,
>
> Hi Tarun,
> your answer is exactly correct.but i need one more modification.when user clicks SAVE button then calculate the new difference and modify internal table.but i need that new difference and modify in the alv output screen itself.
>
> as per your logic it modify iternal table only.but i need both internal table and alv output screen.
>
> Regards,
> K.Karthikeyan.
Use:-
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
* when the function code is 'SAVE' then reflect the changes as per user
WHEN 'SAVE'.
* to reflect the data changed into internal table
DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
"now at this time you have modified internal table
loop at it_final.
it_final-diff = it_final-field4 - it_final-field5. "calculate difference
modify it_final index sy-index.
endloop.
* refresh the ALV Grid output from internal table "<--
l_selfield-refresh = 'X'. "<-- to refresh alv from internal table
"if internal table is modified then the alv output is refreshed as per changes in internal table
ENDCASE.
ENDFORM. "USER_COMMAND
2009 Mar 18 5:34 AM
Hi Tarun,
Problem sloved.thank you so much.
Regards,
K.Karthikeyan.
2009 Mar 20 7:16 AM
Hi,
I want to add purchase order field in standard T.code s_alr_87012105.
Regards,
Karthikeyan.K
2009 Apr 27 10:37 AM
Hello hw r
Can u HElp me in ALV Grid Reports.
i am making a sales exp reports in ALV grid. i am completed but it is cant give actual value of OPEN QTY, DEL QTY, AND ORDER QTY.
also hw to paste my code here to disp all. a am trying it help of code toll but i cant.
Thnks
Please Reply
Bhavesh Panchal.
2009 Mar 16 10:08 AM
Hi,
To Register Edit Events use this code as:
data w_grid TYPE REF TO cl_gui_alv_grid,
CALL METHOD w_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
Thanks & Regards,
Anagha Deshmukh
2009 Apr 27 10:35 AM
Hello hw r
Can u HElp me in ALV Grid Reports.
i am making a sales exp reports in ALV grid. i am completed but it is cant give actual value of OPEN QTY, DEL QTY, AND ORDER QTY.
also hw to paste my code here to disp all. a am trying it help of code toll but i cant.
Thnks
Please Reply
Bhavesh Panchal.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |