Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Total column not changed between Header & Detl screen on diff header record

Former Member
0 Likes
776

I have a report with header data contains contracts information and detailed data contains orders, debit credit memo related to the contracts. I write the report using CL_SALV_TABLE to display contract value, usage in full ALV_GRID. When I double click on a contract line, it will go to the second screen to show all orders related to that contract. The second screen with orders information will be in a screen on a container with all standard function ( Export list to Excel, Word format etc..), sort, total and sub total) and a push button to go back to first screen.

The report works fine but when I am on the second screen, I total and sub total the amount on that screen in order to check with total value in header record and it total up correctly by currency.

But when I go back to the first screen, select a different contract record, double click on the line to get to the order info screen, all order data display correctly except that the total column still show amount from the previous detailed screen. If I select the column again and click the total, it will total correctly.

I did refresh the data in the screen before go back to first screen but it does not solve the problem.

DOES ANYONE HAVE A SIMILAR SYMPTON LIKE THIS?

Thanks for your advice. I also post this in ABAP Object forum.

FYI, On the order detailed screen, I create a container with screen 100 and write PAI, PBO like this:

Screen 100:

process before output.

module status_0100.

module load_data_to_control. "Load usage data to screen

-


process after input.

module user_command_0100.

-


module status_0100 output.

set pf-status 'PF100'. set titlebar 'T100'.

endmodule.

-


module load_data_to_control output.

if gr_cont is not bound.

create object gr_cont

exporting container_name = 'CONTAINER_100'

exceptions others = 1.

if sy-subrc 0.

message a052(zvn) with ' No container object found'.

endif.

Try.

cl_salv_table=>factory( exporting

r_container = gr_cont

importing r_salv_table = gr_alv_2

changing t_table = gt_orders ).

catch cx_salv_msg into gr_error.

endtry.

perform set_functions. " Set all standard function in screen 100

perform set_column_order using gr_alv_2. "Set column format, display

perform handle_events. "Register events for selection mode & user commands

  • Display order screen 0100

gr_alv_2->display( ).

else.

gr_alv_2->refresh( ).

endif.

-


module user_command_0100 input.

data: wa_d type gt_dtab,

ls_contract type vbeln,

ls_order type vbeln,

ls_invoice type vbeln,

ls_belnr type belnr_d,

ls_row type char10.

data: l_text type char128.

case sy-ucomm.

when 'RETURN' or 'BACK' or 'EXIT' or 'CANCEL'.

*... refresh the table in order to see the new data

gr_alv_2->refresh( ).

leave to screen 0.

when others.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
716

While calling second screen


  data: lr_aggregations type ref to cl_salv_aggregations.

  lr_aggregations = gr_table->get_aggregations( ).
  lr_aggregations->add_aggregation( 'PRICE' ).    " Mention all column which you want SUM or TOTAL 

  lr_aggregations->add_aggregation( 'QUANTITY' ).

5 REPLIES 5
Read only

former_member194669
Active Contributor
0 Likes
717

While calling second screen


  data: lr_aggregations type ref to cl_salv_aggregations.

  lr_aggregations = gr_table->get_aggregations( ).
  lr_aggregations->add_aggregation( 'PRICE' ).    " Mention all column which you want SUM or TOTAL 

  lr_aggregations->add_aggregation( 'QUANTITY' ).

Read only

0 Likes
716

Thanks for the quick response but I still get same problem.

The records are total correctly but when I go to another header record and double click to go to second screen, the total column still showed data from previous detailed screen unless I click on the summary button two times (first time, the summary line disappear, second time it show the correct summary).

I did put the code you mentioned, but it did not solve the problem.

Read only

0 Likes
716

Then you need to clear aggregations for before calling second header record this way


  data:
   lr_aggregations type ref to cl_salv_aggregations.
   lr_aggregations = gr_table->get_aggregations( ).
   lr_aggregations->clear( ). "<<=====
  try.
      lr_aggregations->add_aggregation( columnname = 'PRICE' ).
      catch cx_salv_not_found cx_salv_data_error cx_salv_existing.
  endtry.

Read only

0 Likes
716

And also clear all SORT


  data:
    lr_sorts type ref to cl_salv_sorts.  
   lr_sorts = gr_table->get_sorts( ).
  lr_sorts->clear( ).                   

Read only

0 Likes
715

Thanks. It works now. Points are awarded.