Re: filters in ALV
Hi all !!
When using standard filter (F4) on ALV grid (called with fm 'Reuse_alv_grid_display') it is genreated the choosing-list.
But values on that list are shorter than should be.
For example: for char value 'ABCDEFGHIJ' diplayed on alv list, only 'ABCD' is visible. After choosing it only 'ABCD' is set in filter what is of course unacceptable.
thanks rich heilman for your reply
i given the outputlen as 40 but in output it is displaying full contents while setting filter the pop is not displaying full contents but it is truncated.
hi rich i am taking NAME1_ZS TYPE KNA1-NAME1.
name1_zs as shipper name. the length of name1 in kna1 table is 35.i given the outputlen as 35. in the output it is coming but when setting the filter it is not coming
please help me in this regard
thanks
sun
Message was edited by: sun deep
Message was edited by: sun deep
HI,
IAM GIVING THE ANSWER TO THE BEST OF MY KNOWLEDGE.
Setting and Deleting Filters
Use
You can choose to display only those rows that meet certain criteria in one or more columns.
Procedure
Setting Filters
To set a filter:
Select one or more columns.
Choose .
Alternatively:
Select one or more columns.
Right-click a column header.
Choose Set filter.
The Set Values for Filter Criteria screen appears.
If you selected a cell using the right mouse button and set a filter, the Set Values for Filter Criteria screen appears with the contents of the cell you selected as the value of the relevant filter criteria. After confirming this screen, the column is filtered according to this value.
To specify the values or ranges displayed in your list, enter the From/To values for each column selected.
Only one filter is active at one time in a list. This filter consists of one or more filter criteria. To filter several columns in a list, set a filter with multiple filter criteria.
To apply your settings, choose .
To include more than one value or range for a column, choose . The Multiple Selection for ... screen appears. To enter additional values, you have the following options:
To enter additional values for the filter criterion, use the Individual values tab (green traffic light).
To enter additional from/to values for the filter criterion, use the Ranges tab (green traffic light).
To enter additional values to exclude from the filter criterion, use the Individual values tab (red traffic light).
To enter additional from/to values to exclude from the filter criterion, use the Ranges tab (red traffic light).
The number of entries for each tab are displayed in the tab description:
To set the selection options when entering a value, double-click the pushbutton to the left of the input field. For more information about selection options, see Overview of Functions in Dialog Boxes.
To apply your changes, choose .
Overview of Functions in Dialog Boxes
To check whether your entries are correct (that they are in the correct format), choose .
To add a line, choose .
To delete a value entered for the filter criterion, select the relevant line and choose .
To delete all values entered for all filter criteria, choose .
To set the selection options for a value entry, choose . The Maintain Selection Options screen appears.
If you have set a filter without having selected a column first, the following dialog box appears:
Selection Options
Selection options allow you to describe your filter settings. You begin with the values set in the previous dialog box; the selected entries match the settings you made on the Maintain Selection Options screen.
To negate settings, such as change Less than to Not less than, choose Exclude from selection. To restore the initial setting, choose Select.
To apply your settings, choose . Your settings are displayed on the initial screens.
A legend describes the symbols displayed next to the values. To display this information, place the cursor on the relevant symbol.
Procedure Without Column Selection
If you have not selected a column and chosen ® Set filter, or used the right mouse button menu, the Define Filter Criteria window appears. Specify the columns to be filtered. To do this, proceed as follows:
Select the corresponding entries in Available columns.
To add the selected entries to Filter criteria, choose .
Alternatively:
Select the relevant entries in Available columns.
Click the selected entry or entries again and hold the mouse button. The cursor appears with a small square.
Drag the entries to Filter criteria and drop them there.
To search for terms, choose .
To change the filter sequence, proceed as follows:
Select one or more entries.
Click the selected entry or entries again and hold the mouse button. The cursor appears with a small square.
Drag the entries to the desired position.
The entry is added in front of the line marking.
Alternatively:
Select one or more entries.
Choose from the following:
To move one entry up, choose
To move one entry down, choose
To move an entry to the first position in the filter sequence, choose
To move an entry to the last position in the filter sequence, choose .
To remove the entries from the filter criteria, choose .
To apply your settings, choose .
Result
If a column is filtered, this is indicated by a small black filter in the column header.
Deleting Filters
As only one filter is active in a list at one time, the function Delete filter deletes the entire filter and not just individual filter criteria. Selecting individual columns therefore has no affect on the Delete filter function. To delete individual filter criteria, follow the procedure for setting a filter and delete the relevant filter criteria.
To delete the filter, choose ® Delete filter.
Alternative Procedure in Full-Screen Mode
In addition to the procedures described, in full-screen mode you can execute the functions from the menus:
To set a filter, proceed as follows:
Select one or more columns.
Choose Edit ® Set filter.
Similar Messages
-
To deactivate filters in ALV grid
Hi all,
Please help me to deactivate the filters in ALV grid.
Thanks in Advance,
Regards,
ShajuHi,
you can exclude buttons from ALV toolbar in your program.
Check these links -
Re: ALV Exclude Functions
Re: How we will exclude some buttons from alv list display
Re: ALV classes - exclude function codes
Regards,
Amit
Reward all helpful replies. -
Hi,
Please give me complete code for using filters in alv reporting.
Regards,
SureshCheck the sample code.
REPORT ZLAV.
TYPE-POOLS: slis. " ALV Global types
CONSTANTS:
c_x VALUE 'X',
c_eb9 TYPE syucomm VALUE '&EB9'.
TYPES :
BEGIN OF ty_vbak,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
netwr TYPE vbak-netwr, " Net Value of the Sales Order
waerk TYPE vbak-waerk, " Document currency
END OF ty_vbak,
BEGIN OF ty_vbap,
vkorg TYPE vbak-vkorg, " Sales organization
kunnr TYPE vbak-kunnr, " Sold-to party
vbeln TYPE vbak-vbeln, " Sales document
posnr TYPE vbap-posnr, " Sales document item
matnr TYPE vbap-matnr, " Material number
arktx TYPE vbap-arktx, " Short text for sales order item
kwmeng TYPE vbap-kwmeng, " Order Quantity
netwr TYPE vbap-netwr, " Net value of the order item
waerk TYPE vbap-waerk, " SD document currency
END OF ty_vbap.
DATA:
g_flag TYPE i VALUE 1,
gs_print_k TYPE slis_print_alv,
gs_print_p TYPE slis_print_alv,
gs_layout_k TYPE slis_layout_alv,
gs_layout_p TYPE slis_layout_alv,
gt_sort_k TYPE slis_t_sortinfo_alv,
gt_sort_p TYPE slis_t_sortinfo_alv,
gt_filter_k TYPE slis_t_filter_alv,
gt_filter_p TYPE slis_t_filter_alv,
gt_fieldcat_k TYPE slis_t_fieldcat_alv,
gt_fieldcat_p TYPE slis_t_fieldcat_alv.
DATA:
vbak TYPE vbak,
gt_vbak TYPE TABLE OF ty_vbak,
gt_vbap TYPE TABLE OF ty_vbap.
SELECT-OPTIONS :
s_vkorg FOR vbak-vkorg, " Sales organization
s_kunnr FOR vbak-kunnr, " Sold-to party
s_vbeln FOR vbak-vbeln. " Sales document
SELECTION-SCREEN :
SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
v_1 = 'Maximum of records to read'.
START-OF-SELECTION.
PERFORM f_read_data.
PERFORM f_display_data.
* Form f_read_data
FORM f_read_data.
* Read Sales Document: Header Data
SELECT vkorg kunnr vbeln netwr waerk
UP TO p_max ROWS
INTO TABLE gt_vbak
FROM vbak
WHERE kunnr IN s_kunnr
AND vbeln IN s_vbeln
AND vkorg IN s_vkorg.
CHECK NOT gt_vbak[] IS INITIAL.
* Read Sales Document: Header Data and items
SELECT vkorg kunnr k~vbeln posnr matnr arktx kwmeng p~netwr p~waerk
INTO CORRESPONDING FIELDS OF TABLE gt_vbap
FROM vbak AS k
INNER JOIN vbap AS p
ON k~vbeln = p~vbeln
FOR ALL ENTRIES IN gt_vbak
WHERE k~vbeln = gt_vbak-vbeln.
ENDFORM. " F_READ_DATA
* Form f_display_data
FORM f_display_data.
DEFINE m_fieldcat_k.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-do_sum = &3.
ls_fieldcat-cfieldname = &4.
append ls_fieldcat to gt_fieldcat_k.
END-OF-DEFINITION.
DEFINE m_fieldcat_p.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-do_sum = &3.
ls_fieldcat-cfieldname = &4.
append ls_fieldcat to gt_fieldcat_p.
END-OF-DEFINITION.
DATA:
l_exit,
ls_fieldcat TYPE slis_fieldcat_alv,
ls_event_exit TYPE slis_event_exit,
lt_event_exit TYPE slis_t_event_exit.
m_fieldcat_k 'VKORG' 'VBAK' '' ''.
m_fieldcat_k 'KUNNR' 'VBAK' '' ''.
m_fieldcat_k 'VBELN' 'VBAK' '' ''.
m_fieldcat_k 'NETWR' 'VBAK' c_x 'WAERK'.
m_fieldcat_k 'WAERK' 'VBAK' '' ''.
m_fieldcat_p 'VKORG' 'VBAK' '' ''.
m_fieldcat_p 'KUNNR' 'VBAK' '' ''.
m_fieldcat_p 'VBELN' 'VBAK' '' ''.
m_fieldcat_p 'MATNR' 'VBAP' '' ''.
m_fieldcat_p 'ARKTX' 'VBAP' '' '' .
m_fieldcat_p 'KWMENG' 'VBAP' '' ''.
m_fieldcat_p 'NETWR' 'VBAP' c_x 'WAERK'.
m_fieldcat_p 'WAERK' 'VBAP' c_x ''.
gs_layout_k-zebra = c_x.
gs_layout_k-cell_merge = c_x.
gs_layout_k-colwidth_optimize = c_x.
gs_layout_k-group_change_edit = c_x.
gs_layout_p = gs_layout_k.
* Activate switch button
CLEAR ls_event_exit.
ls_event_exit-ucomm = c_eb9. " Button switch
ls_event_exit-after = c_x.
APPEND ls_event_exit TO lt_event_exit.
gs_print_k-no_print_selinfos = c_x. " Display no selection infos
gs_print_k-no_print_listinfos = c_x. " Display no listinfos
gs_print_p = gs_print_k.
l_exit = c_x.
WHILE l_exit = c_x.
IF g_flag = 1.
* Display Header Data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
is_layout = gs_layout_k
is_print = gs_print_k
it_fieldcat = gt_fieldcat_k
it_sort = gt_sort_k
it_filter = gt_filter_k
it_event_exit = lt_event_exit
i_save = 'A'
IMPORTING
e_exit_caused_by_caller = l_exit
TABLES
t_outtab = gt_vbak.
ELSE.
* Display Item Data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'PF_STATUS_SET'
is_layout = gs_layout_p
is_print = gs_print_p
it_fieldcat = gt_fieldcat_p
it_sort = gt_sort_p
it_filter = gt_filter_p
it_event_exit = lt_event_exit
i_save = 'A'
IMPORTING
e_exit_caused_by_caller = l_exit
TABLES
t_outtab = gt_vbap.
ENDIF.
g_flag = g_flag * -1.
ENDWHILE.
ENDFORM. " F_DISPLAY_DATA
* FORM USER_COMMAND *
FORM user_command USING u_ucomm TYPE syucomm
us_selfield TYPE slis_selfield. "#EC CALLED
CASE u_ucomm.
WHEN c_eb9.
us_selfield-exit = c_x.
IF g_flag = 1.
* Read and Save current ALV list information
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
es_layout = gs_layout_k
et_fieldcat = gt_fieldcat_k
et_sort = gt_sort_k
et_filter = gt_filter_k
es_print = gs_print_k
EXCEPTIONS
no_infos = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
* Read and Save current ALV list information
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
es_layout = gs_layout_p
et_fieldcat = gt_fieldcat_p
et_sort = gt_sort_p
et_filter = gt_filter_p
es_print = gs_print_p
EXCEPTIONS
no_infos = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND
* FORM PF_STATUS_SET *
FORM pf_status_set USING ut_extab TYPE slis_t_extab. "#EC CALLED
* Display switch button
DELETE ut_extab WHERE fcode = c_eb9.
SET PF-STATUS 'STANDARD_FULLSCREEN' OF PROGRAM 'SAPLKKBL'
EXCLUDING ut_extab.
ENDFORM. " PF_STATUS_SET -
hai all..
how can we set the filters in alv .
and like standard report how can we get ...
Tanx in advance...Hi ,
Do like this...
here git_sloc is internal table on which we are setting filter..suppose if we have 10 records , out of which we want 5 records,then do like this..
When all the entries on screen are selected
WHEN '&SALL'.
REFRESH lit_filter[].
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lv_ref1.
CALL METHOD lv_ref1->check_changed_data.
*Get the filter criteria
CALL METHOD lv_ref1->get_filter_criteria
IMPORTING
et_filter = lit_filter.
IF NOT lit_filter[] IS INITIAL.
FIELD-SYMBOLS: <lfs_sloc> LIKE LINE OF git_sloc.
DATA: lv_field TYPE char255.
FIELD-SYMBOLS: <lfs_any> TYPE ANY.
DATA: lwa_filter LIKE LINE OF lit_filter.
DATA: lv_sel TYPE c.
RANGES: r_val FOR tcclgt-txt20.
LOOP AT git_sloc ASSIGNING <lfs_sloc>.
CLEAR lv_sel.
LOOP AT lit_filter INTO lwa_filter.
CLEAR r_val.
REFRESH r_val[].
r_val-sign = lwa_filter-sign.
r_val-option = lwa_filter-option.
r_val-low = lwa_filter-low.
r_val-high = lwa_filter-high.
APPEND r_val.
CLEAR lv_field.
CONCATENATE '<lfs_sloc>-' lwa_filter-fieldname INTO lv_field.
ASSIGN (lv_field) TO <lfs_any>.
IF <lfs_any> IN r_val.
lv_sel = 'X'.
ELSE.
CLEAR lv_sel.
ENDIF.
IF <lfs_sloc>-check IS INITIAL.
<lfs_sloc>-check = lv_sel.
ENDIF.
ENDLOOP.
<lfs_sloc>-check = lv_sel.
ENDLOOP.
rs_selfield-refresh = gc_x.
ELSE.
READ TABLE git_sloc INTO gwa_sloc INDEX sy-index.
IF gwa_sloc-check = ' '.
IF sy-subrc EQ 0.
gwa_sloc-check = gc_x.
MODIFY git_sloc FROM gwa_sloc TRANSPORTING check WHERE check = ' '.
ENDIF.
CLEAR gwa_sloc-check.
rs_selfield-refresh = gc_x.
ENDIF.
ENDIF.
Hoping the above code helps in ur requirement..
Regards,
Nagaraj -
Change of count on the header on filtering the ALV
Hi Gurus!
I have this ALV report which gives the sales order report, in the output right on the top the report shows the count of all the distinct sales order displayed when the report is run based ona selection criteria. Is it possible to show the total count of teh sales order in the report to change and show teh number of distinct sales doc when we use filter on teh report. Suppose if we run the report based on a particular selection criteria and it gives a count of 30 . In the output if we put filter on a particular column and the report shows fewer lines , which will reduce the number of sales doc, is it possible to show this number which for eg will be say 20 , is it possible to show the number 20 after filetr on ALV instead of that 30 remainiung constant. I am wanting the report to show the change in count of distinct sales doc when I put filter on any columnh.
report zsales_orders message-id zsd no standard page heading.
* For ALV usage
type-pools: slis.
data: gs_layout type slis_layout_alv,
ta_events type slis_t_event_exit,
tp_event type slis_event_exit,
tp_print type slis_print_alv,
gt_sort type slis_t_sortinfo_alv,
gt_events type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv with header line,
repid type syrepid, " ABAP Program.
gt_list_top_of_page type slis_t_listheader, " Top of page text.
gs_list_top_of_page type slis_listheader,
alv_variant type disvariant. " Customize Disp. Variant
data: w_field type slis_fieldcat_alv.
data: count type i.
data: count1 type i.
tables: vbak, vbap, vbpa, knvv.
* Definition of selection screen *
* By plant, storage location, sold-to customers, material and *
* posting date of the sales orders *
selection-screen begin of block one with frame title text-001.
parameters: p_vkorg type vkorg obligatory memory id vko,"DEVK906677
p_vtweg type vtweg obligatory default '01',
p_spart type spart obligatory default '01'.
select-options: s_vkbur for vbak-vkbur, " Sales Office "DEVK906677
s_kunnr for vbak-kunnr. " Sold-to customer number.
select-options: s_shipto for vbap-oid_ship, " Ship-to customer number.
s_billto for vbpa-kunnr, " bill-to from S.O. header.
s_load for vbpa-kunnr, " Load confirmation contact.
s_truck for vbap-oid_extbol. " Trucking ticket number.
select-options: s_werks for vbap-werks obligatory no intervals. " Plant.
select-options: s_lgort for vbap-lgort. " Storage location.
select-options: s_matnr for vbap-matnr. " Material number.
select-options: s_konda for knvv-konda. " price group
selection-screen skip 1.
select-options: s_vdatu for vbak-vdatu default sy-datum.
selection-screen end of block one.
* ALV display layout
selection-screen begin of block layout with frame title text-003.
parameters: pa_vari type slis_vari default ' '. " Display variant.
selection-screen end of block layout.
selection-screen begin of block two with frame title text-028.
selection-screen comment: /1(79) text-029.
selection-screen comment: /1(79) text-030.
selection-screen comment: /1(79) text-031.
selection-screen comment: /1(79) text-032.
selection-screen comment: /1(79) text-033.
selection-screen comment: /1(79) text-034.
selection-screen comment: /1(79) text-035.
selection-screen comment: /1(79) text-036.
selection-screen end of block two.
* Data Definitions *
* Storing Extracted Info.
types: begin of t_extract,
vbeln type vbeln_va, " Sales order number.
augru type augru, " order reason
vdatu type edatu_vbak, " Requested delivery date.
kunnr type kunag, " Sold-to customer number.
soldto_name type name1_gp, " Sold-to name.
posnr type posnr_va, " Item number.
matnr type matnr, " Material number.
vrkme type vrkme, " Sales UoM.
mseh3 type mseh3, " UoM text.
netwr type netwr_ap, " Net value of the order item.
kwmeng type p length 13 decimals 1, " Quantity.
werks type werks_d, " Plant.
lgort type lgort_d, " Storage location.
oid_extbol type oid_extbol, " External BOL or truck ticker header.
maktx type maktx, " Material description.
oid_ship type kunwe, " Ship-to customer number.
shipto_name type name1_gp, " Ship-to name.
billto type kunre, " Bill-to customer number.
billto_name type name1_gp, " Bill-to name.
load_contact type kunnr, " Load confirmation contact.
load_name type name1_gp, " Load confirmation contact name.
truck type kunnr, " Truck company number.
truck_name type name1_gp, " Truck company name.
bstkd type bstkd, " PO number.
ihrez type ihrez, " AFE number per the contract/sales order.
delivery type vbeln_vl, " Delivery number.
posnr_vl type posnr_vl, " Delivery item number.
bill_vbeln type vbeln_vf, " Invoice number.
bill_posnr type posnr_vf, " Invoice item number.
bill_netwr type netwr_fp, " Invoice net value.
statu type stats, " Document status.
auart type auart, " order type
vkorg type vkorg, " sales org.
vtweg type vtweg, " distrbtn channel
spart type spart, " division
vkbur like vbak-vkbur, " Sales Office DEVK906677
konda type konda, " price group
tdline type tdline, " text for customer account reference
count type i,
end of t_extract.
data : it_extract type table of t_extract with header line,
it_extract2 type table of t_extract with header line.
data: it_text type table of tline with header line.
data: w_index type sy-index,
w_tdname type tdobname.
constants: c_minus1 type netwr_ap value '1.00-'.
*RANGES: r_auart FOR vbak-auart.
data: r_auart type range of t_extract-auart,
r_auart_line like line of r_auart.
* initialization
initialization.
tp_event-ucomm = '&ILT'. " Filter event.
tp_event-after = 'X'.
append tp_event to ta_events.
gs_layout-colwidth_optimize = 'X'.
tp_print-no_print_listinfos = 'X'.
tp_print-no_coverpage = 'X'.
perform set_fieldcat.
perform alv_eventtab_build using:
** Event name Form to execute Event internal table
'TOP_OF_PAGE' 'TOP_OF_PAGE' gt_events[].
* changed to exclude following order types
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZEQ'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* credit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* debit memo
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZPRD'.
clear r_auart_line-high.
append r_auart_line to r_auart.
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZDR'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Industry sales order correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZSOC'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield FF correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCF'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* oilfield WP correction
r_auart_line-sign = 'I'.
r_auart_line-option = 'EQ'.
r_auart_line-low = 'ZOCW'.
clear r_auart_line-high.
append r_auart_line to r_auart.
* Dropdown list for all created ALV layouts, global or user-specific
at selection-screen on value-request for pa_vari.
perform alv_variant_f4 changing pa_vari.
* Main BODY of processing logic
start-of-selection.
perform extract_data.
end-of-selection.
if not it_extract[] is initial.
* Build headings for report.
perform build_top_of_page using gt_list_top_of_page[].
perform call_alv.
endif.
*& Form EXTRACT_KEY_DATA
* Retreive the data for the report.
form extract_data.
clear: it_extract. refresh: it_extract.
* orders
select vbak~vbeln vbak~auart vbak~augru vbak~vkorg vbak~vtweg
vbak~spart vbak~vdatu vbak~kunnr vbak~vkbur
vbap~posnr vbap~matnr vbap~vrkme vbap~netwr vbap~kwmeng
vbap~werks vbap~lgort vbap~oid_extbol vbap~oid_ship
into corresponding fields of table it_extract
from vbak inner join vbap
on vbak~mandt = vbap~mandt
and vbak~vbeln = vbap~vbeln where
vbak~auart not in r_auart and
vbak~vkorg eq p_vkorg and
vbak~vtweg eq p_vtweg and
vbak~spart eq p_spart and
vbak~vkbur in s_vkbur and "DEVK906677
vbak~vdatu in s_vdatu and
vbak~kunnr in s_kunnr and
vbap~matnr in s_matnr and
vbap~werks in s_werks and
vbap~lgort in s_lgort and
vbap~oid_extbol in s_truck and
vbap~oid_ship in s_shipto.
if sy-subrc <> 0.
message i000 with text-002 ' ' ' ' ' '.
endif.
sort it_extract by vbeln.
check sy-subrc = 0.
loop at it_extract.
* Retrieve and select by load confirmation contacts from header
select single kunnr from vbpa into it_extract-load_contact
where vbeln = it_extract-vbeln
and posnr = '000000'
and parvw = 'ZB'.
if it_extract-load_contact in s_load.
it_extract-load_name = zcl_kna1=>get_name1( it_extract-load_contact ).
else.
delete it_extract.
continue.
endif.
* Retrieve and select by sales order bill-to on header level
* as well as lookup bill-to customer name/description
select single kunnr from vbpa into it_extract-billto
where vbeln = it_extract-vbeln
and posnr = '000000'
and parvw = 'RE'.
if sy-subrc = 0.
if s_billto is initial.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
if it_extract-billto in s_billto.
it_extract-billto_name = zcl_kna1=>get_name1( it_extract-billto ).
else.
delete it_extract.
continue.
endif.
endif.
else.
* Newalta - always has bill-to, following will not occur but included
* as good programming practice.
it_extract-billto_name = it_extract-billto.
endif.
* Retrieve and select by price group of sold-to
select single konda from knvv into it_extract-konda
where kunnr = it_extract-kunnr
and vkorg = it_extract-vkorg
and vtweg = it_extract-vtweg
and spart = it_extract-spart.
if sy-subrc = 0.
if not ( it_extract-konda in s_konda ).
delete it_extract.
continue.
endif.
endif.
* Retrieve trucking company customer
select single kunnr from vbpa into it_extract-truck where
vbeln = it_extract-vbeln and
posnr = '000000' and
parvw = 'ZT'.
if sy-subrc = 0.
it_extract-truck_name = zcl_kna1=>get_name1( it_extract-truck ).
endif.
* Retrieve sold-to name
it_extract-soldto_name = zcl_kna1=>get_name1( it_extract-kunnr ).
* Retrieve ship-to name
it_extract-shipto_name = zcl_kna1=>get_name1( it_extract-oid_ship ).
* lookup P.O.
select single bstkd ihrez from vbkd into (it_extract-bstkd, it_extract-ihrez)
where vbeln = it_extract-vbeln
and posnr = '000000'.
* Retreive the material description.
it_extract-maktx = zcl_material=>get_maktx( it_extract-matnr ).
* cosmetic change of material number, donot display leading zeros.
shift it_extract-matnr left deleting leading '0'.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
w_tdname = it_extract-vbeln.
* read customer account reference which is under 'text'
call function 'READ_TEXT'
exporting
client = sy-mandt
id = 'Z010'
language = sy-langu
name = w_tdname
object = 'VBBK'
* ARCHIVE_HANDLE = 0
* LOCAL_CAT = ' '
* IMPORTING
* HEADER =
tables
lines = it_text
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
if sy-subrc = 0.
read table it_text index 1.
if sy-subrc = 0.
it_extract-tdline = it_text-tdline.
else.
clear it_extract-tdline.
endif.
else.
clear it_extract-tdline.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
* Get the delivery item.
call method zcl_vbap=>get_delivery
exporting
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
importing
etp_vbeln = it_extract-delivery
etp_posnr = it_extract-posnr_vl.
if it_extract-delivery is not initial.
perform process_deliveries.
else.
perform invoice_process.
endif.
it_extract-count = 1 .
move-corresponding it_extract to it_extract2.
append it_extract2.
at new vbeln.
count1 = count1 + 1.
endat.
endloop.
endform. " EXTRACT_DATA
*& Form SET_FIELDCAT
* Create the field catalogue.
form set_fieldcat .
clear w_field.
clear t_fieldcat. refresh t_fieldcat.
w_field-col_pos = 1 .
w_field-fieldname = 'VBELN'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Document.Nbr'.
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 2 .
w_field-fieldname = 'POSNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Item'(023).
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 3 .
w_field-fieldname = 'VDATU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Req. Del. Date'(005).
append w_field to t_fieldcat.
w_field-col_pos = 4. "DEVK909658
w_field-fieldname = 'KUNNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sold-to.'(038).
append w_field to t_fieldcat.
w_field-col_pos = 5 .
w_field-fieldname = 'SOLDTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sold-to'(006).
append w_field to t_fieldcat.
w_field-col_pos = 6 .
w_field-fieldname = 'MATNR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Material'(007).
append w_field to t_fieldcat.
w_field-col_pos = 7 .
w_field-fieldname = 'KWMENG'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Quantity'(008).
append w_field to t_fieldcat.
w_field-col_pos = 8.
w_field-fieldname = 'MSEH3'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'UOM'(009).
append w_field to t_fieldcat.
w_field-col_pos = 9 .
w_field-fieldname = 'BILL_VBELN'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Invoice #'(010).
w_field-emphasize = 'X'.
w_field-hotspot = 'X'.
append w_field to t_fieldcat.
clear w_field.
w_field-col_pos = 10 .
w_field-fieldname = 'BILL_NETWR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Values'(011).
append w_field to t_fieldcat.
w_field-col_pos = 11.
w_field-fieldname = 'WERKS'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Plant'(012).
append w_field to t_fieldcat.
w_field-col_pos = 12.
w_field-fieldname = 'LGORT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Storage Loc'(013).
append w_field to t_fieldcat.
w_field-col_pos = 13 .
w_field-fieldname = 'MAKTX'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Description'(014).
append w_field to t_fieldcat.
w_field-col_pos = 14. "DEVK909658
w_field-fieldname = 'OID_SHIP'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ship-to.'(039).
append w_field to t_fieldcat.
w_field-col_pos = 15 .
w_field-fieldname = 'SHIPTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ship-to'(015).
append w_field to t_fieldcat.
w_field-col_pos = 16. "DEVK909658
w_field-fieldname = 'BILLTO'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to .'(040).
append w_field to t_fieldcat.
w_field-col_pos = 17 .
w_field-fieldname = 'BILLTO_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Bill-to'(016).
append w_field to t_fieldcat.
w_field-col_pos = 18 .
w_field-fieldname = 'LOAD_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Load Contact'(017).
append w_field to t_fieldcat.
w_field-col_pos = 19 .
w_field-fieldname = 'TRUCK_NAME'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Truck Comp.'(018).
append w_field to t_fieldcat.
w_field-col_pos = 20 .
w_field-fieldname = 'BSTKD'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'P.O.'(019).
append w_field to t_fieldcat.
w_field-col_pos = 21 .
w_field-fieldname = 'IHREZ'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'AFE Nbr'(020).
append w_field to t_fieldcat.
w_field-col_pos = 22 .
w_field-fieldname = 'OID_EXTBOL'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Truck Ticket'(021).
append w_field to t_fieldcat.
w_field-col_pos = 23.
w_field-fieldname = 'STATU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Status'(022).
append w_field to t_fieldcat.
w_field-col_pos = 24.
w_field-fieldname = 'AUGRU'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Ord.Reason'(024).
append w_field to t_fieldcat.
w_field-col_pos = 25.
w_field-fieldname = 'TDLINE'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'cstmr.acct.ref.'(027).
append w_field to t_fieldcat.
w_field-col_pos = 26 . "DEVK906678
w_field-fieldname = 'VKBUR'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Sales Office'(037).
append w_field to t_fieldcat.
w_field-col_pos = 27. "DEVK909658
w_field-fieldname = 'COUNT'.
w_field-tabname = 'IT_EXTRACT2'.
w_field-seltext_l = 'Count'(041).
w_field-do_sum = 'X'.
append w_field to t_fieldcat.
endform. " SET_FIELDCAT
*& Form CALL_ALV
* Call the ALV Grid function.
form call_alv .
sort it_extract by lgort vbeln.
* repid is necessary since the ALV F.M. does not work properly with
* sy-repid.
repid = sy-repid.
alv_variant-variant = pa_vari.
alv_variant-report = sy-repid.
alv_variant-username = sy-uname.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = t_fieldcat[]
it_sort = gt_sort[]
i_default = 'X'
i_save = 'A'
is_variant = alv_variant
it_events = gt_events[]
it_event_exit = ta_events[]
is_print = tp_print
tables
t_outtab = it_extract2
exceptions
program_error = 1
others = 2.
if sy-subrc ne 0.
message w000 with text-004 ' ' ' ' ' '.
endif.
endform. " CALL_ALV
*& Form build_top_of_page
* Build heading for report. *
* -->P_GT_LIST_TOP_OF_PAGE[] Header stuff for report
form build_top_of_page using e04_lt_top_of_page type slis_t_listheader.
data: ls_line type slis_listheader. "Header table for top of page
* construct 'top of page' info. to display. In this case, one line.
data: w_selections(40) type c,
w_date_from(10) type c,
w_date_to(10) type c.
write: s_vdatu-low to w_date_from dd/mm/yyyy.
if s_vdatu-high is not initial.
write: s_vdatu-high to w_date_to dd/mm/yyyy.
clear w_selections.
concatenate 'Del.Req.Date: ' w_date_from 'To' w_date_to
into w_selections separated by space.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
append ls_line to e04_lt_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = ' Total Number of Sales Documents'.
append gs_list_top_of_page to gt_list_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = count1.
append gs_list_top_of_page to gt_list_top_of_page.
else.
clear w_date_to.
concatenate 'Del.Req.Date: ' w_date_from
into w_selections separated by space.
clear ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
append ls_line to e04_lt_top_of_page.
endif.
endform. " build_top_of_page
*& Form alv_eventtab_build
* Pass list of events to be triggered by the ALV function module
form alv_eventtab_build using u_name type slis_alv_event-name
u_form type slis_alv_event-form
alv_lt_events type slis_t_event.
data: ls_event type slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
append ls_event to alv_lt_events.
endform. " alv_eventtab_build
* FORM TOP_OF_PAGE *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'NEWALTA_LOGO'
it_list_commentary = gt_list_top_of_page.
endform. " TOP_OF_PAGE
*& Form process_deliveries
* Process the delivery related records.
form process_deliveries .
data:
ltp_date type wadat_ist, " Goods movement date.
ltp_vbtyp type vbtyp_n,
ltp_mtart type mtart, " Material type.
w_lfimg type lfimg, " Actual quantity delivered (in sales units).
w_vrkme type vrkme. " Sales unit of measure.
* Read delivery quantity and uom.
select single lfimg vrkme into (w_lfimg, w_vrkme)
from lips where
vbeln = it_extract-delivery and
posnr = it_extract-posnr_vl.
* these fields have values from vbap. override with lips values
if sy-subrc = 0.
it_extract-kwmeng = w_lfimg.
it_extract-vrkme = w_vrkme.
* translate unit of measure
it_extract-mseh3 = it_extract-vrkme.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
endif.
* Determine STATUS by reading 'service confirmation', R (goods movemt)
* it is possible to have multiple 'service confirmation' records for
* one item. ie. delivery 80010390 in PRD.
* As long as there is at least one 'service confirmation' record,
* status is considered 'complete'.
* Validate the created on date of the goods movement or service confirmation.
ltp_mtart = zcl_material=>get_mtart( it_extract-matnr ).
* ltp_date = zcl_lips=>get_goods_movement_date( itp_vbeln = it_extract-delivery
* itp_posnr = it_extract-posnr_vl itp_mtart = ltp_mtart ).
call method zcl_lips=>get_goods_mvt_info
exporting
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
itp_mtart = ltp_mtart
importing
rtp_date = ltp_date
rtp_vbtyp = ltp_vbtyp.
* 'h' is cancel goods issue
if ltp_vbtyp = 'h'.
it_extract-statu = 'Incomplete'(025).
else.
if ltp_date is not initial.
it_extract-statu = 'COMPLETE'(026).
endif.
endif.
* Retrieve the invoice/billing document item.
call method zcl_lips=>get_invoice
exporting
itp_vbeln = it_extract-delivery
itp_posnr = it_extract-posnr_vl
importing
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
if it_extract-bill_vbeln is not initial.
* retrieve net value from the invoice.
clear it_extract-bill_netwr.
select single netwr into it_extract-bill_netwr from vbrp
where vbeln = it_extract-bill_vbeln
and posnr = it_extract-bill_posnr.
else.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
endif.
endform. " process_deliveries
*& Form user_command
* Process the user command.
* -->R_UCOMM User command
* -->RS_SELFIELD Field selected
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
data: ltp_vbeln type vbeln. " Sales document number.
case r_ucomm.
when '&IC1'.
if ( rs_selfield-fieldname = 'VBELN'
or rs_selfield-fieldname = 'BILL_VBELN' )
and rs_selfield-value is not initial. " Display sales document.
ltp_vbeln = rs_selfield-value.
zcl_sales_doc=>display( ltp_vbeln ).
endif.
when '&ILT'.
data:
lta_filt type slis_t_filtered_entries.
break rdrury.
call function 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
importing
* es_layout = gs_layout
* et_fieldcat = t_fieldcat[]
* et_sort = gt_sort[]
* ES_LAYOUT =
* ET_FIELDCAT =
* ET_SORT =
* ET_FILTER =
* ES_LIST_SCROLL =
* ES_VARIANT =
* E_WIDTH =
* ET_MARKED_COLUMNS =
et_filtered_entries = lta_filt
* ET_FILTERED_ENTRIES_HEADER =
* ET_FILTERED_ENTRIES_ITEM = lta_filt
* TABLES
* et_outtab =
* ET_OUTTAB_HEADER =
* et_outtab_item =
* ET_COLLECT00 =
* ET_COLLECT01 =
* ET_COLLECT02 =
* ET_COLLECT03 =
* ET_COLLECT04 =
* ET_COLLECT05 =
* ET_COLLECT06 =
* ET_COLLECT07 =
* ET_COLLECT08 =
* ET_COLLECT09 =
exceptions
no_infos = 1
program_error = 2
endcase.
endform. "user_command
*& Form invoice_process
* Process for orders without deliveries. *
form invoice_process .
* Translate unit of measure.
select single mseh3 from t006a into it_extract-mseh3
where spras = sy-langu
and msehi = it_extract-vrkme.
* Retrieve the invoice/billing document item.
call method zcl_vbap=>get_invoice
exporting
itp_vbeln = it_extract-vbeln
itp_posnr = it_extract-posnr
importing
rtp_vbeln = it_extract-bill_vbeln
rtp_posnr = it_extract-bill_posnr.
if it_extract-bill_vbeln is not initial.
* retrieve net value from the invoice.
clear it_extract-bill_netwr.
select single netwr into it_extract-bill_netwr from vbrp
where vbeln = it_extract-bill_vbeln
and posnr = it_extract-bill_posnr.
else. " If no Invoice, then status becomes 'incomplete'.
it_extract-bill_netwr = it_extract-netwr. " Use order net value.
it_extract-statu = 'Incomplete'(025).
endif.
endform. " invoice_process
*& Form alv_variant_f4
* Get the display variant.
* <--CTP_VARI Variant name
form alv_variant_f4 changing ctp_vari type slis_vari.
alv_variant-report = sy-repid. " Report ID
alv_variant-username = sy-uname. " User ID
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = alv_variant
i_save = 'A'
importing
es_variant = alv_variant
exceptions
others = 1.
if sy-subrc = 0.
ctp_vari = alv_variant-variant.
endif.
endform. " alv_variant_f4I have used all the FM modules mentioned but I am not able to get the total of the sales doc on the top of the page to chnage when filtering of data is done . I just want to see this count of sales document (distict ) and to see it change as filtering is done , be it at any place in teh ALV , its not necessary that it has to be on the top of the ALV output. Could I get some inputs please. As you can see I used the below mentioned FM but on debugging I find the gt_stack is empty still.
*& Form build_top_of_page
* Build heading for report. *
* -->P_GT_LIST_TOP_OF_PAGE[] Header stuff for report
FORM build_top_of_page USING e04_lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader. "Header table for top of page
* construct 'top of page' info. to display. In this case, one line.
DATA: w_selections(40) TYPE c,
w_date_from(10) TYPE c,
w_date_to(10) TYPE c.
WRITE: s_vdatu-low TO w_date_from DD/MM/YYYY.
IF s_vdatu-high IS NOT INITIAL.
WRITE: s_vdatu-high TO w_date_to DD/MM/YYYY.
CLEAR w_selections.
CONCATENATE 'Del.Req.Date: ' w_date_from 'To' w_date_to
INTO w_selections SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
APPEND ls_line TO e04_lt_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = ' Total Number of Sales Documents'.
append gs_list_top_of_page to gt_list_top_of_page.
gs_list_top_of_page-typ = 'S'.
gs_list_top_of_page-info = count1.
append gs_list_top_of_page to gt_list_top_of_page.
ELSE.
CLEAR w_date_to.
CONCATENATE 'Del.Req.Date: ' w_date_from
INTO w_selections SEPARATED BY space.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = w_selections.
APPEND ls_line TO e04_lt_top_of_page.
ENDIF.
ENDFORM. " build_top_of_page
*& Form alv_eventtab_build
* Pass list of events to be triggered by the ALV function module
FORM alv_eventtab_build USING u_name TYPE slis_alv_event-name
u_form TYPE slis_alv_event-form
alv_lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event. " structure for event handling
ls_event-name = u_name.
ls_event-form = u_form.
APPEND ls_event TO alv_lt_events.
ENDFORM. " alv_eventtab_build
* FORM TOP_OF_PAGE *
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'NEWALTA_LOGO'
it_list_commentary = gt_list_top_of_page.
Data:lt_FILTERED_ENTRIES type SLIS_T_FILTERED_ENTRIES,
wa_filter like line of lt_FILTERED_ENTRIES.
data: count2 type i.
data: it_fieldcat type slis_t_fieldcat_alv with header line.
CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
IMPORTING
ET_FILTERED_ENTRIES = lt_FILTERED_ENTRIES
EXCEPTIONS
NO_INFOS = 1
PROGRAM_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
MESSAGE i000 WITH count1 .
ENDIF.
loop at lt_FILTERED_ENTRIES into wa_filter.
* if sy-tabix <> 0.
if sy-subrc = 0 .
count2 = count2 + 1.
*count3 = count1 - count2 .
* write:/ 'Total number of Sales Documents =', count3 .
endif.
endloop.
ENDFORM. " TOP_OF_PAGE
I tried using it at user-command level too but it dosent help.
Thanks -
Filtering the ALV List Display
Hi all.
We had a requirement like filtering ALV List display.
Suppose my ALV list dispaly contains 100 records and by using the standard filtering option ,I restricted it to 50 records and by clicking a check box for 20 records and delete button(Customized) ,I should ideally get 30 records.
But according to standard SAP functionality buttons ,all 80 Records will be displayed .But i need 30 records.
Any function module or code will be available to achieve this one?
In this case which will be the preferable method to go further?
What will be the best method(Normal ALV/OOALV) ?
Any pointers in this regard are very much helpful.
Regards,
SSR.While selecting the records on each condition , perform the select based on ur condition so dat dat select only those records directly.
-
Short dump while filtering an ALV report
Hi ,
I have an ALV report which gives me short dump when I filter any of the 'P' type field. I tried to implement sap note 839839 in debug mode but in vain. Should I implement this note first and then check the chnage?
the short dump error "..........
Error in ASSIGN: Memory protection error.
The current program "SAPLSSEL " uses the ASSIGN statement.
However, the offset of the segment (20208) plus the length (69)
is greater than the length of the segment (20264).
This is not allowed.
If the error is in one of your own ABAP programs or an SAP program that
you have modified, try to correct it.
Reduce the offset and/or length that you are using.
If the error occurred in a non-modified SAP program, you may be
able to find a solution in the SAP note system.
If you have access to the note system yourself, use the following
search criteria:
"ASSIGN_OFFSET+LENGTH_TOOLARGE"
"SAPLSSEL " or "LSSELFDI "
"FILL_DYN_FROM_FIELD_SEL" ........."
I appreciate ur inputs.
thanks in advance,
regards,
shanHi Guys,
I found the answer. I had to define all P type fields with eaxact length of 16 . Its working fine.
thanks for all your help.
regards,
shan -
Error filtering with ALV standard
Hi to all,
In my WD ABAP application I have a ALV.
For show us this error I'm going to use the estandar WD example -> WDT_ALV
I execute the application, then press settings - filter - add 2 columns of filter: column ID and column Apt.
Then I save the view -> Save as - MyDescription and check Initial View
Then I execute again the application.
There is an error because the Apt column shows the filter row with AA;SFO
If I create a filter with columns: ID, Apt and Airfare; it generates a dump (Unable to interpret AA as a number).
Can anybody help me? Can anybody tell me a sap NOTE about this (I don't find it)?
Thank a lot.Can anybody help me?
-
Filter not working in ALV Report....
Hi All,
I have developed an ALV Report using REUSE_ALV_GRID_DISPLAY.
Everything is working perfectly except Filtering...
When i enter data for filtering, the ALV list will become empty. Then if i choose to delete the entry made in filter window, the filter input shows only first 4 digits of the entered value.......If i delete that value, again the data will be displayed in the ALV Screen.....
All other standard Functions like sort, export to excel sheet are working fine...
What might be the reason for this bug..?????
Please Help me...
Regards
PavanThanks Prasanth,
This is the code...
It has been observed that few columns can be filtered...Like date, Quantity and few more...
But there is a column for Production Order number, which can not be filtered...
What might be the reason..?????
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
it_sort = t_sort[]
i_default = c_x
is_variant = v_variant
i_save = c_a
it_events = t_events
is_print = wa_prntparams
TABLES
t_outtab = i_aufk
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. -
ALV - Editing a Row after Sorting - REAL HEADACHE.....
Hi,
I have a ALV table with a DropDown in one of the columns. The user can enter a value in the dropdown boxes.
Now the proble is, lets say I have SORTED the table by another column. Now the user enters a value in one of the rows of the dropdown and clicks the SAVE Button.
How do i find out, which Row the User Has entered the value ?
I tried using the table it_modified_cells in the event handler for ON_DATA_CHECK . However it gives wrong row indexes, that is if, the row number '10' is Row number '1', after sorting, and if this row is modified, then it_modified_cells table gives Row '1' as modified rather than Row '10'.
So ina nut shell, after sorting , if a row is edited, How to find out which is this row...... ?Nithya,
Look at this thread of mine....
Re: ALV - Lead Selection of Node When FILTERS ACTIVE
I had this issue when after filtering in ALV Table, th e bound Node wtill held original records......
So is it something likeSORTING Updates the context,,,,,FILTERING does not ?
Thanks
Anand -
Problem in ALV during Filter for display of no. of records on header
Hi
In one of the ALV report I am using FM: 'reuse_alv_grid_display' by passing the final internal table t_final. Also I am using the FM: 'reuse_alv_commentary_write' for header and displaying the No. of records by describing the t_final internal table.
If the user does Filtering in the ALV output and displays the filtered records, the no. of records count is not getting changed and showing up the total no. of records that displayed originally. How can I display the No. of records that are filtered in the header after filtering in ALV output. I appreciate if any one throw light to resolve this problem.
Thanks
Usha
Edited by: usha k on Jan 16, 2008 3:20 PM
Edited by: usha k on Jan 16, 2008 3:21 PMHi Usha, check this,
I am using REUSE_ALV_LIST_DISPLAY to display a report. The sample report as below :
Matnr qty1 qty2
1234 1.00 0.00
ABCD 0.00 0.00
5678 0.00 1.00
After display of the report, user wants to filter on the quantity fields where qty1 = 0.00 AND qty2 = 0.00.
User will execute the report. Output is displayed. Then user clicks on qty1 and qty2 field heading. Then user clicks on filter (funnel) button. Then a small popup will appear which will display two filter fields qty1 and qty2. Then user will enter filter criteria for qty1/qty2 columns as :
qty1 = 0.00 (here '=' symbol is in red meaning 'exclude' the rows having zeroes
in qty1 column)
qty2 = 0.00 (here '=' symbol is in red meaning 'exclude' the rows having zeroes
in qty2 column)
Once the user presses the enter button of this popup window, the filter criteria is applied and the whole report is becoming empty. Because in the above example all the three rows are having the zeroes in qty1 or qty2 columns. So logically the filter criteria applied was qty1 = 0.00 OR qty2 = 0.00
The expected output after applying the filter was just one row like below because both qty1 and qty2 are having zeroes. Logically the filter criteria applied should have been qty1 = 0.00 AND qty2 = 0.00
Matnr qty1 qty2
ABCD 0.00 0.00
cheers,
Hema. -
Re:Problem in displaying the output by using filters
hi to all,
when using filters in ALV i am getting a problem of displaying the <b>full contents of a particular field while going for F4 option</b>.
even i using <b>ls_fieldcat-outputlen = field length</b> it is not coming .
please help me in this issue.
thanks
sun
Message was edited by: sun deepHello,
set ST_FIELDCAT-OUTPUTLEN to the actual lenght of the field.
regards,
Naimesh -
Hi Friends,
We have one Z report that output is displayed in ALV. We are using the standard FM 'REUSE_ALV_GRID_DISPLAY.
We have requirement to remove leading zeros for the field like Material Number (MATNR), Equipment Number (EQUNR) etc. We did the changes by applying the field catalog properties as below.
lw_fieldcat-lzero = space.
lw_fieldcat-no_zero = 'X'.
After this, the MATNR and EQUNR is displayed correctly in the ALV. (Leading zeros are suppressed). But, when we do filter for these fields, in the filter window it displays all the values with leading zeros.
1. We don't understand why it is showing in the Filter widow with all leading zeros. All it shows all the records instead of unique items.
Later on, we removed the above fieldcat coding. Then, we have called the CONVERSION_EXIT routines (in the domain) for the fields to remove leading zeros.
Now, the MATNR and EQUNR is displayed correctly (without leading zeros) in ALV. When we do filter, it is also doing filtering correctly. But, when we do filter which have EQUNR having long values (after zero suppression), it is not working correctly. i.e no items are displayed in the ALV.
Not only for this items. If we filter character columns which have long text, it is not filtering correctly.
2. It is not able to understand why the filtering is not working for long items. But in the standard report, the filtering is working correctly.
We are using SAP ECC 6.0.
Friends, can you clarify the about doubts. It is surprising for me.
Kind regards,
Jegathees P.
Our customer is asked to remove the leading zeros for the numeric fieldHi Clemens Li
I agreed on your point. When we define the Internal table the type for element EQUNR & QUMNR , we are referring the SAP data element for EQUNR, QMNUM field.
Our doubt is even though we refer the standard data element, in the ALV display, it shows with leading zeros and also it creates problems in the filtering and in the filter window all values instead of unique nos.
Hi Abhii
I have given below the fieldcat coding.
Friends, can you kindly clarify the above said problems. Since we use SAP ECC 6.0 any notes or patches apply is required. ( this is the basic functionality in ALV, that is my doubt).
wls_fieldcat-col_pos = wpv_pos.
wls_fieldcat-fieldname = wpv_champ.
wls_fieldcat-tabname = wlc_tabname.
wls_fieldcat-seltext_s = wls_fieldcat-seltext_m
wls_fieldcat-seltext_l = wpv_libelle.
wls_fieldcat-ddictxt = 'L'.
wls_fieldcat-no_out = wv_no_out.
APPEND wls_fieldcat TO gt_fieldcat.
Kind regards,
Jegathees P. -
Sub:Filtering is not working in ALV Grid
Hi All,
I developed a new ALV report,where in the out put i can set filtering for other columns(ex:Date,Number),but i can'nt able to set Filtering for one of the column which is CHAR type.
But when we went to table for this field filtering is working,but not in the ALV Grid of our report.
Regards,
Seshadri Ghi,
1) for filtering, we create an internak table of type <b>LVC_T_FILT</b>,
U can assign fields to the above created internal as per u requirements.
2) passing the above internal table to CHANGING parameter of method SET_TABLE FORFIRST_DISPLAY in ALV GRID.
<b>IT_FILTER = < internal table TYPE LVC_T_FLIT>.</b>
<u><b>OR call this method for setting filter criteria as per u r requirement.</b></u>
Set current filter settings. A row of the table describes the selection conditions for column entries that are not to be displayed.
You should never manually set up the internal table with the filter settings. Use this method only to set filter criteria that you got using get_filter_criteria or a layout.
Features
CALL METHOD <ref. var. to CL_GUI_ALV_GRID > ->set_filter_criteria
EXPORTING
IT_FILTER = <internal table of type LVC_T_FILT > .
Parameter
Meaning
IT_FILTER
Table with filter settings
regards,
AshokReddy.
Message was edited by:
Ashok Reddy
Message was edited by:
Ashok Reddy -
The filtering , sorting , totaling action on ALV report is lost
Hi ,
I have an Interactive ALV report which i sort it , filter it and total it before I enter into my Z customised screen, from my Z cusomised screen when I come back to the ALV report, the report is no more sorted, no more filtered and no more totaled.
Please help me on this its a bit urgent.*& Report ZALV_SUM
REPORT ZNNR_ALV_SUM.
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_vbap,
vbeln TYPE vbap-vbeln,
matnr TYPE vbap-matnr,
netwr TYPE vbap-netwr,
waerk TYPE vbap-waerk,
END OF t_vbap.
DATA: it_vbap TYPE STANDARD TABLE OF t_vbap INITIAL SIZE 0,
wa_vbap TYPE t_vbap.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-cfieldname = 'WAERK'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'WAERK'.
fieldcatalog-seltext_m = 'Price Curr'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_vbap
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.
endform. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select vbeln matnr netwr waerk
up to 50 rows
from vbap
into table it_vbap.
endform. " DATA_RETRIEVAL
Maybe you are looking for
-
Excel import export using Office Control
Hi, We have the requirement to provide a feature like an excel uplaod and download in our UI (WD ABAP).Basically we have some WD table view and we need to collect all the data in each cell and then download the data in an excel file.Similarly we need
-
Multiple connections in one app
Hi, I have a web app and am using JDev 10.1.3.2 with ADFBC. Some of the data will come from SQL2000 while other info will come from Oracle 10g. My UI will require presentation of a mix. But I am only able (it appears) to use one db connection in one
-
How to do GI and GR in PI sheet
Dear all, Please explain me clearly how to do Goods Issue and Goods Recipt in Using PI Sheet. If i use call function using process instruction TA_CALL t code migo that particular process orde no will not come automatically how to do pls explain me s
-
[SOLVED] Error '/usr/lib64 exists' while installing adol-c
I just tried to install adol-c from the AUR. At the end of the install I ran into this error message: error: failed to commit transaction (conflicting files) adol-c: /usr/lib64 exists in filesystem Errors occurred, no packages were upgraded. The inst
-
I was trying to import my pics from my iPhone to Mac Air ...it started importing and then it stopped after about a 1000 (I have total 1400ish)...and it's stuck...I unplugged my iPhone...and tried to exit the app but it won't let me close...it says pl