0% found this document useful (0 votes)
167 views5 pages

Form ALV

This document defines the forms and logic for displaying the results of processing membership data. It includes: 1) A DISPLAY_RESULT form that sets up a SALV table to display the final processed data, configuring columns and display settings. 2) A RECORD_PROCESS form that processes the membership data, counting duplicates and aggregating the results. 3) A RECORD_FETCH form that retrieves the source membership data. 4) A DISPLAY_HEADER form that generates a header for the results display with counts of total records, correct records, and errors.

Uploaded by

Sachin Adak
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views5 pages

Form ALV

This document defines the forms and logic for displaying the results of processing membership data. It includes: 1) A DISPLAY_RESULT form that sets up a SALV table to display the final processed data, configuring columns and display settings. 2) A RECORD_PROCESS form that processes the membership data, counting duplicates and aggregating the results. 3) A RECORD_FETCH form that retrieves the source membership data. 4) A DISPLAY_HEADER form that generates a header for the results display with counts of total records, correct records, and errors.

Uploaded by

Sachin Adak
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

*&---------------------------------------------------------------------*

*&
Form DISPLAY_RESULT
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM display_result .
DATA : lr_table TYPE REF TO cl_salv_table,
lr_functions TYPE REF TO cl_salv_functions,
lr_dsettings TYPE REF TO cl_salv_display_settings,
lr_columns TYPE REF TO cl_salv_columns,
lr_column TYPE REF TO cl_salv_column.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = lr_table
CHANGING
t_table
= gt_final.
lr_functions = lr_table->get_functions( ).
lr_functions->set_all( abap_true ).
lr_dsettings = lr_table->get_display_settings( ).
lr_dsettings->set_striped_pattern( cl_salv_display_settings=>true ).
lr_dsettings->set_list_header( text-005 ).
*--Column 1
lr_columns = lr_table->get_columns( ).
lr_column ?= lr_columns->get_column( 'MEMS_GUID' ).
lr_column->set_long_text( text-007 ).
lr_column->set_medium_text( text-007 ).
lr_column->set_short_text( text-008 ).
*--Column 2
lr_columns = lr_table->get_columns( ).
lr_column ?= lr_columns->get_column( 'MEMB_GUID' ).
lr_column->set_long_text( text-009 ).
lr_column->set_medium_text( text-009 ).
lr_column->set_short_text( text-011 ).

*--Column 3

lr_columns = lr_table->get_columns( ).
lr_column ?= lr_columns->get_column( 'COUNT' ).
lr_column->set_long_text( text-010 ).
lr_column->set_medium_text( text-010 ).
lr_column->set_short_text( text-010 ).
lr_columns->set_optimize( 'X' ).
PERFORM display_header.
* Set the element top_of_list
lr_table->set_top_of_list( lr_grid ).
lr_table->display( ).
ENDFORM.
" DISPLAY_RESULT
*&---------------------------------------------------------------------*
*&
Form RECORD_PROCESS
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM record_process .
gt_mbrshp1[] = gt_membshp[].
DELETE ADJACENT DUPLICATES FROM gt_membshp COMPARING memb_guid .
DELETE ADJACENT DUPLICATES FROM gt_mbrshp1 COMPARING mems_guid .
SORT gt_membshp BY memb_guid ASCENDING.
SORT gt_mbrshp1 BY memb_guid ASCENDING.
LOOP AT gt_membshp INTO wa_membshp .
READ TABLE gt_membshp INTO wa_membshp WITH KEY memb_guid = wa_membshpmemb_guid BINARY SEARCH.
IF sy-subrc EQ 0.
lv_index = sy-tabix.
ENDIF.
LOOP AT gt_mbrshp1 INTO wa_mbrshp1 FROM lv_index.
IF wa_membshp-memb_guid EQ wa_mbrshp1-memb_guid
gv_count = gv_count + 1 .

wa_final-mems_guid = wa_mbrshp1-mems_guid .
wa_final-memb_guid = wa_mbrshp1-memb_guid .
APPEND wa_final TO gt_final.
** To avoid modify For peformance Issues, Parallel curosr menthod is used.
READ TABLE gt_final INTO wa_final WITH KEY memb_guid = wa_membshpmemb_guid.
CLEAR wa_final.
lv_ind = sy-tabix.

LOOP AT gt_final INTO wa_final FROM lv_ind .


wa_final-count = gv_count.
MODIFY gt_final FROM wa_final TRANSPORTING count.
ENDLOOP.
ELSE.
** To avoid modify For peformance Issues ,Parallel curosr menthod is used.
READ TABLE gt_final INTO wa_final WITH KEY memb_guid = wa_membshpmemb_guid.
CLEAR wa_final.
lv_ind = sy-tabix.
LOOP AT gt_final INTO wa_final FROM lv_ind .
wa_final-count = gv_count.
MODIFY gt_final FROM wa_final TRANSPORTING count.
ENDLOOP.
EXIT.
ENDIF.
CLEAR wa_mbrshp1.
CLEAR wa_final.
ENDLOOP.
CLEAR gv_count.
CLEAR wa_membshp.
ENDLOOP.

SORT gt_final ASCENDING BY memb_guid mems_guid.


DELETE ADJACENT DUPLICATES FROM gt_final COMPARING memb_guid mems_guid.
DELETE gt_final WHERE count = 1 .
DESCRIBE TABLE gt_final LINES gv_eror.
gv_corr = gv_tot - gv_eror .
ENDFORM.
" RECORD_PROCESS
*&---------------------------------------------------------------------*
*&
Form RECORD_FETCH
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM record_fetch .
SELECT mems_guid memb_guid
FROM loyd_msh_ms_memb PACKAGE SIZE 100000
APPENDING CORRESPONDING FIELDS OF TABLE gt_membshp
WHERE memb_guid IN s_member.
ENDSELECT.
DESCRIBE TABLE gt_membshp LINES gv_tot.
ENDFORM.
" RECORD_FETCH

*&---------------------------------------------------------------------*
*&
Form DISPLAY_HEADER
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM display_header .
* Set the top of list
DATA:lr_gridx TYPE REF TO cl_salv_form_layout_grid,
lr_flow TYPE REF TO cl_salv_form_layout_flow,
lr_pict TYPE REF TO cl_salv_form_picture,
lr_logo TYPE REF TO cl_salv_form_layout_logo,
lr_label TYPE REF TO cl_salv_form_label,
lr_text TYPE REF TO cl_salv_form_text.
*

data: lv_eror(10) TYPE c.


CREATE OBJECT lr_grid.
lr_grid->create_header_information( row = 1 column = 1
text =
text-001 " 'Result'
tooltip = text-001 ).
lr_gridx = lr_grid->create_grid( row = 2 column = 1 ).
lr_label = lr_gridx->create_label( row = 2 column = 1
text = text-002
tooltip = text-002 ).

lr_text

= lr_gridx->create_text(

row = 2 column = 2
text = gv_tot
tooltip = gv_tot ).

lr_label = lr_gridx->create_label( row = 4 column = 1


text = text-003
tooltip = text-003 ).
lr_text = lr_gridx->create_text( row = 4 column = 2
text = gv_corr tooltip = gv_corr ).
*lv_eror = GV_TOT - GV_TOTAL_REC .
lr_label = lr_gridx->create_label( row = 5 column = 1
text = text-004
tooltip = text-004 ).
lr_text = lr_gridx->create_text( row = 5 column = 2

text =
gv_eror
tooltip = gv_eror

ENDFORM.

" DISPLAY_HEADER

).

You might also like