2006 Oct 31 3:27 AM
hi experts,
i got some problem while working with Reuse_alv_grid_display function module, it is like this when iam displaying the grid iam able to get the output, in the output even iam able to sort the fields but when iam trying to sum the numeric fields it is going for dump,
my doubt is here whether i need to pass any parameter for this addition property, as in the previous programs i got the summation for the numeric fields without passing any parameters.
so can anyone help me out with an example to solve this problem thanks in advance
hi experts,
i got some problem while working with Reuse_alv_grid_display function module, it is like this when iam displaying the grid iam able to get the output, in the output even iam able to sort the fields but when iam trying to sum the numeric fields it is going for dump,
my doubt is here whether i need to pass any parameter for this addition property, as in the previous programs i got the summation for the numeric fields without passing any parameters.
so can anyone help me out with an example to solve this problem thanks in advance
2006 Oct 31 3:59 AM
Do you have the right data type for these columns in the field catalog? Usually if these are not of numeric type, the dump happens.
Regards,
Ravi
Note : Please mark all the helpful answers
2006 Oct 31 4:16 AM
hi ravi,
iam doing it for quantity field and netpr field which is of eket-menge and ekpo-netpr type respectively.
Even i tried with this also it is going for dump in the beginning without showing output even here "so when iam using wa-fieldcat-DO-SUM = 'X'. and append it to header"
2006 Oct 31 5:12 AM
Hi madan,
kindly check ur program, with the sample pgm in the
below link.
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
it will help u.
rgds,
anver.
<i>
if hlped pls mark points</i>
2006 Oct 31 5:51 AM
Hi madan,
Check the example below , it may be helpful to you.
The example shown here calculate the sum of the amount fields of all the records which are selected in the ALV list
1. Declare relevant data.
-
Type for internal table i_table
TYPES: BEGIN OF t_table,
The name of the field will be same of that which will be passed in the layout for the selectbox and this
field type should be of the type character 1.
chkbx(1) TYPE c, For selectbox
amount_back LIKE konp-kbetr, " amount_back
.
. OTHER FIELDS
.
END OF t_table.
Structure to store the layout details of the ALV output
DATA: is_layout TYPE slis_layout_alv,
Internal table for storing the final records
DATA: i_table TYPE STANDARD TABLE OF t_table WITH HEADER LINE
INITIAL SIZE 0.
CONSTANTS: c_pf_status_set (30) TYPE c VALUE 'F_PF_STATUS_SET', " Form for PF status
c_user_command(30) TYPE c VALUE 'F_USER_COMMAND',"Form for buttons
Declare additional mandatory data and internal tables like i_fieldcat
2. Assign the field name of the internal table to the box_fieldname field of the Layout structure and call the ALV function module
Assign the check box name
is_layout-box_fieldname = 'CHKBX'.
This should be in Capital letters. The layout with box_fieldname = <SelectBox Field> creates select box
for each row of the ALV report
Here function module for ALV Grid viewer is called and i_layout is passed
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_pf_status_set = c_pf_status_set
i_callback_user_command = c_user_command
i_grid_title = c_title
is_layout = is_layout
it_fieldcat = i_fieldcat
it_events = i_events
TABLES
t_outtab = i_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.
3. ALV report will be generated along with the PF status set in the following subroutine
*&----
*& Form f_pf_status_set
*&----
Form used to set the Custom pf-status of the Grid Display
*----
rt_extab
*----
FORM f_pf_status_set USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZST' .
ENDFORM. " f_pf_status_set
4. When the ADD button (Function Code is B1) is pressed after selecting some rows then the amount_back of each selected row is summed and displayed
----
FORM f_user_command *
----
----
--> R_UCOMM *
--> RS_SELFIELD *
----
FORM f_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Local variables and constants
CONSTANTS: c_b1 LIKE sy-ucomm VALUE 'B1'. " For Func Code for ADD button
DATA: l_sum LIKE konp-kbetr. For storing summed amount
IF r_ucomm = c_b1.
Make the sum of amount_back if that row is selected
LOOP AT i_table WHERE chkbx = X.
l_sum = l_sum + i_table-amount_back.
ENDLOOP.
Display the Sum in any Popup or in another ALV list
Perform f_display_sum.
ENDIF.
ENDFORM. " f_user_command
Regards,
Sreekanth
2006 Oct 31 5:59 AM
Hi,
Go thru this links it may help you.
http://www2.warwick.ac.uk/services/finance/sap/training/reporting4.7/output
ttp://www.sapdevelopment.co.uk/reporting/alvhome.htm
Thanks
Sunil
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |