ALV Grid Display - Dump when exporting (via right click)
Hi,
We have an ALV filled with a dynamic table because we needed dynamic columns. Our ALV has totals and subtotals. When exporting ALV via right click I get the following error:
OBJECTS_OBJREF_NOT_ASSIGNED
I observed two facts:
1.- If I disable subtotals and totals (commentig wa_cat-do_sum = 'X') export works properly, otherwise I get the dump.
2.- Having totals and subtotals enabled, if I use export icon (top toolbar) the export works properly, but using right-click export gets the same dump.
Our fieldcat is like this:
CLEAR wa_cat.
wa_cat-fieldname = g_cols.
wa_cat-seltext_s = gi_subdiv-btrtl.
wa_cat-seltext_l = gi_subdiv-btrtl.
wa_cat-datatype = 'INT4'.
wa_cat-do_sum = 'X'.
wa_cat-outputlen = '6'.
APPEND wa_cat TO fs_fldcat.
and we call ALV:
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
i_callback_program = v_repid
is_layout = s_layout
i_callback_user_command = 'USER_COMMAND'
it_sort = t_sort
* i_callback_top_of_page = 'F_TOP_OF_PAGE'
i_save = 'X'
TABLES
t_outtab = <t_dyntable>.
Any help will be appreciated!
Thanks,
Josep
Hi kat_k,
I tried to do what you say, but I still get the same error!
More ideas?
Thanks!
Josep
Similar Messages
-
Dump when summing up CURR field in ALV GRID display
Hi All,
I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23. I am using classes and methods to display alv grid.
I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
Here is the part it is throwing dump:
ls_lvc_data-value = space.
clear ls_lvc_data-style.
loop at it_fcat_local assigning <ls_fcat>
where tech ne 'X' and no_out ne 'X'.
if l_invisible eq 'X'.
clear l_invisible.
if <ls_fcat>-do_sum is initial.
continue.
else.
clear ls_lvc_data-col_pos.
endif.
endif.
add 1 to ls_lvc_data-col_pos.
assign component <ls_fcat>-fieldname
of structure <ls_data> to <l_field_value>.
_if sy-subrc ne 0.
message x000(0k).
endif._
Regards,
GuruThomas,
Here is the dump:
Runtime Errors MESSAGE_TYPE_X
Date and Time 10/22/2010 23:30:53
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Long text of error message:
Technical information about the message:
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"SAPLSLVC" or "LSLVCF36"
"FILL_DATA_TABLE"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
Source Code Extract
Line
SourceCde
2708
is_subtottxt_info = ls_subtot_info
2709
ip_subtot_line = lr_data
2710
changing
2711
c_subtottxt = l_subtottxt.
2712
ls_lvc_data-value = l_subtottxt.
2713
2714
append ls_lvc_data to ct_lvc_data.
2715
endif.
2716
2717
2718
Column per Fieldcat Entry
2719
2720
ls_lvc_data-value = space.
2721
clear ls_lvc_data-style.
2722
loop at it_fcat_local assigning <ls_fcat>
2723
where tech ne 'X' and no_out ne 'X'.
2724
if l_invisible eq 'X'.
2725
clear l_invisible.
2726
if <ls_fcat>-do_sum is initial.
2727
continue.
2728
else.
2729
clear ls_lvc_data-col_pos.
2730
endif.
2731
endif.
2732
2733
add 1 to ls_lvc_data-col_pos.
2734
2735
assign component <ls_fcat>-fieldname
2736
of structure <ls_data> to <l_field_value>.
2737
if sy-subrc ne 0.
>>>>>
message x000(0k).
2739
endif.
2740
2741
*... work on average
2742
if <ls_fcat>-do_sum eq 'C'.
2743
Initialize average result and entries
2744
<l_field_value> = 0.
2745
clear l_entries.
2746
2747
retrive unit from fieldcatalog
2748
assign space to <l_unit>.
2749
if not <ls_fcat>-cfieldname is initial.
2750
assign component <ls_fcat>-cfieldname
2751
of structure <ls_data> to <l_unit>.
2752
endif.
2753
if not <ls_fcat>-qfieldname is initial.
2754
assign component <ls_fcat>-qfieldname
2755
of structure <ls_data> to <l_unit>.
2756
endif.
2757 -
Leading Zeros Missing - When exporting data from ALV grid display to Excel
Hi,
Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
(eg) in ALV o/p - 0029.
in Excel - Only 29 is appearing.
As per the requiement i have to show the leading zeros in excel also.
Pls help on this issue.
Thanks in advance..Hi ,
Please set the property :
wa_fieldcat-lzero = 'X' .
when you are creating field catalog for display alv data .
your prob will solved .
Regards ,
Nilesh Jain -
ALV GRID Display Column Width problem when filtering
Hello All,
When i displaying ALV Grid Display ,i selected one column and set filter for that.
the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
Thanks
Sandeep.Ghello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
FORM fill_fieldcat USING p_field TYPE slis_fieldcat_alv-fieldname
p_text TYPE slis_fieldcat_alv-seltext_l
p_flag TYPE c.
wa_fieldcat-fieldname = p_field.
wa_fieldcat-seltext_l = p_text.
wa_fieldcat-no_out = p_flag.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat. -
How to devide the top of page in alv grid display
hi all
in the alv grid display am getting the page number and total number of pages in the left hand side
but what i need is i need in the right hand side
how to get thatHi,
PLease refer to the code below:
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*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,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
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 = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
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_events
is_print = gd_prntparams
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
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 ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
* Form TOP-OF-PAGE *
* ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
* Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
* Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
* Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
* i_logo = 'Z_LOGO'.
endform.
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
* Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
* Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
Thanks,
Sriram Ponna. -
Field Catolgue in alv grid display
Hi Abapers,
I need to display the percentage rows with decimals and other rows without decimal . Is their any option in field catalog to do like this. Or tell me any other alternative to achieve this.
sno total col1 col2 col3
1 220 100 20 100
2 320 120 50 150
tot 540 220 70 250
per 40.74 1.87 and so on
or ,
I have two different internal tables how can i put it in one field catalog to pass it to alv grid display.
Regards,
PriyaDon't do total by your self in the Pogram.
in the Fieldcatalog there is an Attribute which will do total & Average .
Enable it so that from one internal table data it self it will do good.
example program
Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
display it using the basic ALV grid functionality(including column total). The example details the main
sections of coding required to implement the ALV grid functionality:
Data declaration
Data retrieval
Build fieldcatalog
Build layout setup
REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*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.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
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 = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
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_ekko
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 ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
gowri
Message was edited by:
Gowri Krishna -
Hi,
I used ALV grid display to generate a report, the end-user will select a record from the report and press a push button so that the value will be changed automatically and will be reflected in the alv.
I have done this by recalling the alv function module. The problem is when alv FM is recalled the changed data is displayed in a new screen and when i select to GO BACK by pressing [ F3 ] im getting the old alv display screen, but i want the controll to go to the selection screen. Please help me to fix this,
Points will be awarded for helpful replies,
Regds,
Sarath.Crefer to this sample - I ve just written and is working -
*& Report ZSKC_TEST4
REPORT ZSKC_TEST4.
TYPE-POOLS : SLIS.
DATA : ITAB LIKE T100 OCCURS 0 WITH HEADER LINE.
DATA : G_REPID TYPE SY-REPID.
START-OF-SELECTION.
SELECT * UP TO 10 ROWS
FROM T100
INTO TABLE ITAB
WHERE SPRSL = SY-LANGU.
CHECK SY-SUBRC EQ 0.
G_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = 'SUB_PF_STAT'
I_CALLBACK_USER_COMMAND = 'SUB_USER_CMD'
I_STRUCTURE_NAME = 'T100'
TABLES
T_OUTTAB = ITAB[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
ENDIF.
FORM SUB_USER_CMD USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CHECK R_UCOMM EQ 'PROC'.
*Insert 2 blank lines.
append itab.
append itab.
RS_SELFIELD-REFRESH = 'X'.
ENDFORM.
FORM SUB_PF_STAT USING rt_extab TYPE slis_t_extab.
* Copy from a Standard Prog - SAPLKKBL - STANDARD_FULLSCREEEN.
* USe SE80 and right click on the PF-STAT and copy.
SET PF-STATUS 'PF_ALV'.
ENDFORM. -
Kindly help to develop alv grid display
Hi ,
I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap) display with print version etc hidden and buttons at the top of ALV. Kindly help
Highly rewarded
Kindly help
Regards,
Lakshmi
Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PMWell Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid). You have very little control over the look of the column headers. In fact you can only manipulate what is available via the Portal Theme.
There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers. This gives them a little more depth:
http://www.flickr.com/photos/tjung/3068850120/
The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering. This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/ -
Update values in AlV grid display after entering value
Hi,
I have an issue in ALV grid display.
Let me explain.
i have 8 fields to display in which one is editiable.
Fields are: date
material,
material Description,
Opening Stock,
Closing stock- ( this field is editiable)
Closing stock,
Received Stock,
Actual production.
Actual production = Closing stock + removal stock
- receipt stock - opening stock.
when i change the value of closing stock and press enter, actual production should get update, the new values should display.
Thany you in advance.Hi,
Please refer the code below:
REPORT z_demo_alv_jg.*******************************************************************
* TYPE-POOLS *
TYPE-POOLS: slis. *******************************************************************
* INTERNAL TABLES/WORK AREAS/VARIABLES *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
w_field TYPE slis_fieldcat_alv,
p_table LIKE dd02l-tabname,
dy_table TYPE REF TO data,
dy_tab TYPE REF TO data,
dy_line TYPE REF TO data.*******************************************************************
* FIELD-SYMBOLS *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa> TYPE ANY,
<dyn_field> TYPE ANY,
<dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
* SELECTION SCREEN *
PARAMETERS: tabname(30) TYPE c,
lines(5) TYPE n.*******************************************************************
* START-OF-SELECTION *
START-OF-SELECTION.* Storing table name
p_table = tabname.* Create internal table dynamically with the stucture of table name
* entered in the selection screen
CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_table->* TO <dyn_table>.
IF sy-subrc <> 0.
MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-PROCESSING.
ENDIF.
* Create workarea for the table
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.* Select data from table
SELECT * FROM (p_table)
INTO TABLE <dyn_table>
UP TO lines ROWS. REFRESH <dyn_tab_temp>.* Display report
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'SET_PF_STATUS'
TABLES
t_outtab = <dyn_table>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc <> 0. ENDIF.*&-----------------------------------------------------------------*
*& Form SET_PF_STATUS
* Setting custom PF-Status
* -->RT_EXTAB Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. "SET_PF_STATUS*&----------------------------------------------------------------*
*& Form user_command
* Handling custom function codes
* -->R_UCOMM Function code value
* -->RS_SELFIELD Info. of cursor position in ALV
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.* Local data declaration
DATA: li_tab TYPE REF TO data,
l_line TYPE REF TO data.* Local field-symbols
FIELD-SYMBOLS:<l_tab> TYPE table,
<l_wa> TYPE ANY.* Create table
CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
ASSIGN li_tab->* TO <l_tab>.* Create workarea
CREATE DATA l_line LIKE LINE OF <l_tab>.
ASSIGN l_line->* TO <l_wa>. CASE r_ucomm.* When a record is selected
WHEN '&IC1'.* Read the selected record
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
rs_selfield-tabindex. IF sy-subrc = 0.* Store the record in an internal table
APPEND <dyn_wa> TO <l_tab>.* Fetch the field catalog info
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'Z_DEMO_PDF_JG'
i_structure_name = p_table
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc = 0.* Make all the fields input enabled except key fields
w_field-input = 'X'. MODIFY i_fieldcat FROM w_field TRANSPORTING input
WHERE key IS INITIAL. ENDIF.* Display the record for editing purpose
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_structure_name = p_table
it_fieldcat = i_fieldcat
i_screen_start_column = 10
i_screen_start_line = 15
i_screen_end_column = 200
i_screen_end_line = 20
TABLES
t_outtab = <l_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2. IF sy-subrc = 0.* Read the modified data
READ TABLE <l_tab> INDEX 1 INTO <l_wa>.* If the record is changed then track its index no.
* and populate it in an internal table for future
* action
IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
<dyn_wa> = <l_wa>.
i_index = rs_selfield-tabindex.
APPEND i_index.
ENDIF.
ENDIF. ENDIF.* When save button is pressed
WHEN 'SAVE'.* Sort the index table
SORT i_index.* Delete all duplicate records
DELETE ADJACENT DUPLICATES FROM i_index. LOOP AT i_index.* Find out the changes in the internal table
* and populate these changes in another internal table
READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
IF sy-subrc = 0.
APPEND <dyn_wa> TO <dyn_tab_temp>.
ENDIF. ENDLOOP.* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3. IF sy-subrc = 0.* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>. REFRESH <dyn_tab_temp>.* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table. ENDIF.
ENDCASE. rs_selfield-refresh = 'X'.ENDFORM. "user_command
Thanks,
Sriram Ponna. -
How to capture the checkbox status in ALV Grid display
I need some immediate help regarding Grid ALV.
My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
Kinldy suggest how to go about it.
I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
Regards,
NamrataHere is a Sample code , it might help you
TABLES : sflight.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
w_repid = sy-repid.
DATA: BEGIN OF it_sflight OCCURS 0,
checkbox(1),
carrid LIKE sflight-carrid,
END OF it_sflight.
*layout
DATA: wa_layout TYPE slis_layout_alv.
*field catalog
DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
wa_fieldcatalog TYPE slis_fieldcat_alv.
START-OF-SELECTION.
SELECT carrid FROM sflight
INTO CORRESPONDING FIELDS OF TABLE it_sflight.
END-OF-SELECTION.
CLEAR it_fieldcatalog.
REFRESH it_fieldcatalog.
wa_fieldcatalog-fieldname = 'CHECKBOX'.
wa_fieldcatalog-outputlen = '3'.
wa_fieldcatalog-col_pos = '1'.
wa_fieldcatalog-seltext_m = 'Chk'.
wa_fieldcatalog-checkbox = 'X'.
wa_fieldcatalog-edit = 'X'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
wa_fieldcatalog-fieldname = 'CARRID'.
wa_fieldcatalog-outputlen = '10'.
wa_fieldcatalog-col_pos = '2'.
wa_fieldcatalog-seltext_m = 'Carrid'.
APPEND wa_fieldcatalog TO it_fieldcatalog.
CLEAR wa_fieldcatalog.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = wa_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcatalog
TABLES
t_outtab = it_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
*& Form USER_COMMAND
FORM user_command USING p_ucomm TYPE sy-ucomm
p_selfld TYPE slis_selfield.
CASE p_ucomm.
WHEN '&DATA_SAVE'.
DATA ref1 TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref1.
CALL METHOD ref1->check_changed_data.
LOOP AT it_sflight WHERE checkbox = 'X'.
DELETE it_sflight INDEX sy-tabix.
ENDLOOP.
p_selfld-refresh = 'X'.
ENDCASE.
ENDFORM. "user_command -
Error in field catalog in ALV grid display using classes at do_sum = "X'.
Hi,
I'm using classes in ALV Grid display.
the code for the field catalog is going to dump because of the statement in the field catalog for field 'netwr',do_sum = 'X'.
that do_sum = 'X' is not working and going to dump when executed.with out that do_sum it is working fine. the error in dump analysys is showing sap standard incude LSLVCF01.
assign component
<ls_fieldcat>-fieldname of structure rt_data to <g_field>.
if sy-subrc ne 0.
message x000(0k).
endif.
sy-subrc is 4 when the program is being executed.
CODE:
FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
DATA ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'VBELN1'.
ls_fcat-ref_field = 'VBELN'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Invoice No'.
ls_fcat-seltext = 'Invoice No'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'BUDAT'.
ls_fcat-ref_table = 'BKPF'.
ls_fcat-coltext = 'Invoice Date'.
ls_fcat-seltext = 'Invoice Date'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
ENDFORM.
can u please look in the code and rectify the error,
would appeciate ur response.
regards,
veera.Hi,
try this..
ls_fcat-fieldname = 'NETWR'.
ls_fcat-ref_field = 'NETWR'.
ls_fcat-ref_table = 'VBRK'.
ls_fcat-coltext = 'Value of Invoice'.
ls_fcat-seltext = 'Value of Invoice'.
ls_fcat-datatype = 'CURR'.
ls_fcat-do_sum = 'X'.
<b>ls_fcat-cfieldname = 'WAERS'.</b>
APPEND ls_fcat TO pt_fieldcat.
CLEAR ls_fcat.
Regards
vijay -
Problem with ALV Grid Display screen Back Button
Dear Friends ,
I have an ALV Grid Display,Here am facing a problem for my 'Back' button,i haven't defined any PF Status and is using the standard one.But after the Display when i press Back Button a blank Screen is appearing n then again i have to press back button to go to my Selection Screen.
Please Suggest if i have to take care of something else.
I want my Selection Screen when i press Back on my Display Screen.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
Thanks and Regards,
AshwiniHi Vijay ,
No i dont have any write statement in my proggram.
Here it is
REPORT ZRMMPD01A NO STANDARD PAGE HEADING.
TABLES : EQUI,SER03,MKPF,OBJK.
TYPE-POOLS : SLIS.
DATA IT_EQUI LIKE EQUI OCCURS 0 WITH HEADER LINE.
DATA IT_OBJK LIKE OBJK OCCURS 0 WITH HEADER LINE..
DATA IT_SER03 LIKE SER03 OCCURS 0 WITH HEADER LINE.
DATA IT_MKPF LIKE MKPF OCCURS 0 WITH HEADER LINE .
DATA : BEGIN OF IT_DISPLAY OCCURS 0,
MATNR LIKE EQUI-MATNR,
SERNR LIKE EQUI-SERNR,
BWART LIKE SER03-BWART,
WERK LIKE SER03-WERK,
CHARGE LIKE SER03-CHARGE,
LAGERORT LIKE SER03-LAGERORT,
MBLNR LIKE SER03-MBLNR,
MJAHR LIKE SER03-MJAHR,
ZEILE LIKE SER03-ZEILE,
BUDAT LIKE MKPF-BUDAT,
BKTXT LIKE MKPF-BKTXT,
USNAM LIKE MKPF-USNAM,
XBLNR LIKE MKPF-XBLNR,
END OF IT_DISPLAY.
DATA : WA_DISPLAY LIKE IT_DISPLAY.
DATA IT_FINAL LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA IT_TEMP LIKE IT_DISPLAY OCCURS 0 WITH HEADER LINE.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :I_LAYOUT TYPE SLIS_LAYOUT_ALV,
I_EVENTS TYPE SLIS_T_EVENT.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_MATNR FOR EQUI-MATNR MATCHCODE OBJECT MCD,"OBLIGATORY
S_SERNR FOR EQUI-SERNR, "MATCHCODE OBJECT MCD OBLIGATORY
S_MBLNR FOR SER03-MBLNR MATCHCODE OBJECT MCD,
S_BWART FOR SER03-BWART MATCHCODE OBJECT MCD,
S_WERK FOR SER03-WERK MATCHCODE OBJECT MCD,
S_LAGET FOR SER03-LAGERORT MATCHCODE OBJECT MCD,
S_BUDAT FOR MKPF-BUDAT MATCHCODE OBJECT MCD,
S_XBLNR FOR MKPF-XBLNR MATCHCODE OBJECT MCD.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X',
R2 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
START-OF-SELECTION.
*Fetch Data.
PERFORM GET_DATA.
*Fill Display Fields.
PERFORM FILL_TABLE.
*Segregate data according to radio button selection.
PERFORM SELECT_CONDITION.
*Fill The Feild catalog.
PERFORM FIELD_CATALOG.
*Display Output.
PERFORM OUTPUT_DISPLAY..
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA.
SELECT * FROM EQUI INTO TABLE IT_EQUI
WHERE MATNR IN S_MATNR
AND SERNR IN S_SERNR.
SELECT * FROM OBJK INTO TABLE IT_OBJK
FOR ALL ENTRIES IN IT_EQUI
WHERE EQUNR = IT_EQUI-EQUNR.
SELECT * FROM SER03 INTO TABLE IT_SER03
FOR ALL ENTRIES IN IT_OBJK
WHERE OBKNR = IT_OBJK-OBKNR
AND MBLNR IN S_MBLNR
AND BWART IN S_BWART
AND WERK IN S_WERK
AND LAGERORT IN S_LAGET.
SELECT * FROM MKPF INTO TABLE IT_MKPF
FOR ALL ENTRIES IN IT_SER03
WHERE MBLNR = IT_SER03-MBLNR
AND BUDAT IN S_BUDAT
AND XBLNR IN S_XBLNR.
ENDFORM. " GET_DATA
*& Form FILL_TABLE
text
--> p1 text
<-- p2 text
FORM FILL_TABLE.
LOOP AT IT_EQUI.
LOOP AT IT_OBJK.
IF IT_OBJK-EQUNR <> IT_EQUI-EQUNR.
SKIP.
ELSE.
READ TABLE IT_SER03 WITH KEY OBKNR = IT_OBJK-OBKNR.
IF SY-SUBRC = 0.
WA_DISPLAY-MATNR = IT_EQUI-MATNR.
WA_DISPLAY-SERNR = IT_EQUI-SERNR.
WA_DISPLAY-BWART = IT_SER03-BWART.
WA_DISPLAY-WERK = IT_SER03-WERK.
WA_DISPLAY-CHARGE = IT_SER03-CHARGE.
WA_DISPLAY-LAGERORT = IT_SER03-LAGERORT.
WA_DISPLAY-MBLNR = IT_SER03-MBLNR.
WA_DISPLAY-MJAHR = IT_SER03-MJAHR.
WA_DISPLAY-ZEILE = IT_SER03-ZEILE.
READ TABLE IT_MKPF WITH KEY MBLNR = IT_SER03-MBLNR.
IF SY-SUBRC = 0.
WA_DISPLAY-BUDAT = IT_MKPF-BUDAT.
WA_DISPLAY-BKTXT = IT_MKPF-BKTXT.
WA_DISPLAY-USNAM = IT_MKPF-USNAM.
WA_DISPLAY-XBLNR = IT_MKPF-XBLNR.
ENDIF.
ENDIF.
ENDIF.
IF NOT WA_DISPLAY IS INITIAL.
APPEND WA_DISPLAY TO IT_DISPLAY.
CLEAR WA_DISPLAY.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. " FILL_TABLE
*& Form FIELD_CATALOG
text
--> p1 text
<-- p2 text
FORM FIELD_CATALOG.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MATNR'.
FIELDCAT-SELTEXT_M = 'Material Number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'SERNR'.
FIELDCAT-SELTEXT_M = 'Serial number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MBLNR'.
FIELDCAT-SELTEXT_L = 'Number of material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BWART'.
FIELDCAT-SELTEXT_M = 'Movement type'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'WERK'.
FIELDCAT-SELTEXT_M = 'Plant'.
FIELDCAT-OUTPUTLEN = 5.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'CHARGE'.
FIELDCAT-SELTEXT_M = 'Batch number'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'LAGERORT'.
FIELDCAT-SELTEXT_M = 'Storage Location'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'MJAHR'.
FIELDCAT-SELTEXT_M = 'Material doc. year'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'ZEILE'.
FIELDCAT-SELTEXT_L = 'Item in material document'.
FIELDCAT-OUTPUTLEN = 18.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BUDAT'.
FIELDCAT-SELTEXT_L = 'Posting date in the document'.
FIELDCAT-OUTPUTLEN = 10.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'BKTXT'.
FIELDCAT-SELTEXT_L = 'Document header text'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'USNAM'.
FIELDCAT-SELTEXT_M = 'User name'.
FIELDCAT-OUTPUTLEN = 15.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
FIELDCAT-TABNAME = 'IT_DISPLAY'.
FIELDCAT-FIELDNAME = 'XBLNR'.
FIELDCAT-SELTEXT_L = 'Reference document number'.
FIELDCAT-OUTPUTLEN = 25.
APPEND FIELDCAT TO IT_FIELDCAT.
CLEAR FIELDCAT.
ENDFORM. " FIELD_CATALOG
*& Form DISPLAY_OUTPUT
text
--> p1 text
<-- p2 text
FORM OUTPUT_DISPLAY.
IF R1 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_DISPLAY
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.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ELSEIF R2 = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZRMMPD01A'
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
TABLES
T_OUTTAB = IT_FINAL
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.
REFRESH IT_DISPLAY.
CLEAR IT_DISPLAY.
ENDIF.
ENDFORM. " DISPLAY_OUTPUT
*& Form SELECT_CONDITION
text
--> p1 text
<-- p2 text
FORM SELECT_CONDITION.
IF R2 = 'X'.
CLEAR WA_DISPLAY.
SORT IT_DISPLAY BY MATNR SERNR MBLNR ZEILE.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY WHERE ZEILE = '0002'.
READ TABLE IT_DISPLAY WITH KEY MATNR = IT_DISPLAY-MATNR
SERNR = IT_DISPLAY-SERNR ZEILE = '0001'.
IF SY-SUBRC = 0.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
SORT IT_DISPLAY BY MATNR SERNR BWART MBLNR.
DELETE ADJACENT DUPLICATES FROM IT_DISPLAY.
LOOP AT IT_DISPLAY.
IF WA_DISPLAY IS INITIAL.
WA_DISPLAY = IT_DISPLAY.
ENDIF.
LOOP AT IT_DISPLAY WHERE MATNR = WA_DISPLAY-MATNR
AND SERNR = WA_DISPLAY-SERNR.
IF IT_DISPLAY-BUDAT > WA_DISPLAY-BUDAT.
WA_DISPLAY = IT_DISPLAY.
ELSE.
DELETE IT_DISPLAY.
ENDIF.
ENDLOOP.
APPEND WA_DISPLAY TO IT_TEMP.
CLEAR WA_DISPLAY.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM IT_TEMP.
IF NOT IT_TEMP[] IS INITIAL.
IT_FINAL[] = IT_TEMP[].
ENDIF.
ENDIF.
ENDFORM. " SELECT_CONDITION
Regards,
Ashwini -
Hi,
I'm modifying a program with ALV Grid Display.There are lot of Classes and Methods which i don't understand.
In my program, the Program is executes and displays an Output. Now in the O/P , when I dbl click a field of a row a POP up is displayed with the existing value.now i can edit this value or Update with a new value.After closing the POP up the edited valueor the new value is displayed in the field. The program works good upto here.Now if my O/P has 20 Pages and if i edit a field in the 18 page, then after closing the popup the cursor ( or display ) is displayed in the 1 page( the 1 page of the O/P is displayed). Now, again, if i want to edit a field in the 18 page i have to scroll to the 18 page. Is there any way to hold the display at the 18 page after closing the POPUP.
I arrived at using CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
EXPORTING
IS_ROW_ID = <structure of type LVC_S_ROW >
IS_COLUMN_ID = <structure of type LVC_S_COL >
IS_ROW_NO = <structure of type LVC_S_ROID >.
can some one help me how to pass values to is_row_id and all the parameters.
Is there any other way?Thanks in advance.
Thanks,
Bhaskar.Dear Bhaskar,
To acheieve this follow the below steps:
1. On double click first get the scroll information using the method GET_SCROLL_INFO_VIA_ID of class CL_GUI_ALV_GRID.
CALL METHOD go_alv_grid->get_scroll_info_via_id
IMPORTING
es_row_no = gv_s_roid
es_row_info = gv_s_row
es_col_info = gv_s_col.
2. Again at the end of your double click event call the method SET_SCROLL_INFO_VIA_ID to set the scroll.
CALL METHOD go_alv_grid->set_scroll_info_via_id
EXPORTING
is_row_info = gv_s_row
is_col_info = gv_s_col
is_row_no = gv_s_roid.
Regards
Kesava -
ALV grid display the subtotal not getting for one column at the output
Hi,
I am working one report ALV grid display and subtotal is not getting for one paricular coulumn.
Eventhough that column has some values.
So can anyone give the proper solution.
Waiting quick response.
Best Regards,
BansiHi
see this link .
https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALinALV
or try this program.
REPORT zalv.
DATA:
t_sflight TYPE TABLE OF sflight,
fs_sflight TYPE sflight.
DATA:
r_container TYPE REF TO cl_gui_custom_container,
r_grid TYPE REF TO cl_gui_alv_grid.
*FIELD CATALOG
DATA:
t_fcat TYPE lvc_t_fcat,
fs_fcat TYPE lvc_s_fcat.
*SORTING THE BASIC LIST
DATA:
t_sort TYPE lvc_t_sort,
fs_sort TYPE lvc_s_sort.
fs_fcat-fieldname = 'PRICE'.
fs_fcat-do_sum = 'X'.
APPEND fs_fcat TO t_fcat.
fs_sort-spos ='1'.
fs_sort-fieldname = 'CARRID'.
fs_sort-down = 'X'.
fs_sort-group = '*'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO t_sort.
SELECT * FROM sflight INTO TABLE t_sflight.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN1'.
SET TITLEBAR 'TITLE1'.ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
**& Module HANDLER OUTPUT
MODULE list OUTPUT.
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_fieldcatalog = t_fcat
it_outtab = t_sflight
it_sort = t_sort.
ENDMODULE. "list OUTPUT
Regards
Hareesh Menon -
TO enable the menu button in ALV Grid Display
Hi Mates,
I have a peculiar problem while doing ALV Grid display for screens.
In the main Screen i have Three coloumns.The 1st coloum will interacted
next screen 101 and 2nd coloum will interacted to screen 102.
Now the problem is in the menu of ALV Grid display,the Total button was enabled for screen
101 and same button is disabled in screen 102.
But the code semms to be fine .
Below i have pasted the code and please have a look and help to come out of this cris.
My Code :
FORM CREATE_ALV_GRID USING R_SCREEN.
DATA: LS_LAYOUT TYPE LVC_S_LAYO,
ITAB_FUNCTIONS TYPE UI_FUNCTIONS. "MHTK903257(+)(add)
CASE R_SCREEN.
*--> SCREEN 9000
WHEN C_SCREEN_9000.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' 'WADAT' 'Due date'(004) 'X' 'D' ' ' ' ' ' ' 'C100',
*'ITAB_OVERVIEW' 'HU_UNLOAD' 'Unloaded HU'(005) 'X' 'I' '15' ' ' ' ' 'C500', "MHTK903257(-)
'ITAB_OVERVIEW' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',
GMTK901103: REMOVE HOTSPOT ON ESTIMATED TO:
'ITAB_OVERVIEW' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.
LOOP AT ITAB_INB_LOC WHERE OUTPUT = 'X'.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' ITAB_INB_LOC-FIELDNAME
ITAB_INB_LOC-Z_INBND_LOC 'X' '' ' ' ' ' 'R' 'C500'. "MHTK903418
ENDLOOP.
LOOP AT ITAB_STORAGE_TYPE WHERE OUTPUT = 'X'.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_9000
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_OVERVIEW' ITAB_STORAGE_TYPE-FIELDNAME
ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
ENDLOOP.
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1000
EXPORTING
I_PARENT = PT_DOCK_1000.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1000
CHANGING LS_LAYOUT-GRID_TITLE.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1000->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_OVERVIEW
IT_FIELDCATALOG = ITAB_FIELDCAT_9000.
*--> SCREEN 9100
WHEN C_SCREEN_1100.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETIAL' 'WAUHR' 'Due time'(007) ' ' 'T' ' ' 'X' ' ' 'C100',
'ITAB_DETAIL' 'TOT_TO' 'Total TO'(006) 'X' 'I' ' ' ' ' ' ' 'C30',
'ITAB_DETAIL' 'EST_TO' 'Estim TO'(030) ' ' 'I' ' ' ' ' ' ' 'C500'.
CLEAR ITAB_INB_LOC.
LOOP AT ITAB_INB_LOC WHERE SELECTED = 'X'.
CHECK SY-SUBRC EQ 0.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETAIL' ITAB_INB_LOC-FIELDNAME
ITAB_INB_LOC-Z_INBND_LOC '' '' ' ' ' ' 'R' 'C500'.
ENDLOOP.
CLEAR: ITAB_STORAGE_TYPE.
LOOP AT ITAB_STORAGE_TYPE WHERE SELECTED = 'X'.
CHECK SY-SUBRC EQ 0.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1100
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_DETAIL' ITAB_STORAGE_TYPE-FIELDNAME
ITAB_STORAGE_TYPE-LGTYP 'X' 'I' ' ' ' ' 'R' 'C500'.
ENDLOOP.
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1100
EXPORTING
I_PARENT = PT_DOCK_1100.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS "MHTK903257(+)(add)
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1100
CHANGING LS_LAYOUT-GRID_TITLE.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1100->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_DETAIL
IT_FIELDCATALOG = ITAB_FIELDCAT_1100.
screen 1300 TO detail.
*--> SCREEN 9300
WHEN C_SCREEN_1300.
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1300
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_TO2' 'TANUM' 'TO'(020) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_TO2' 'NLPLA' 'Location'(021) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'LETY1' 'SUT'(013) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',
'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1300
EXPORTING
I_PARENT = PT_DOCK_1300.
*-- Exclude the non-applicable functions from the ALV grid.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1300
CHANGING LS_LAYOUT-GRID_TITLE.
SORT ITAB_TO2 BY TANUM VBELN POSNR.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1300->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_TO2
IT_FIELDCATALOG = ITAB_FIELDCAT_1300.
screen 9400 Pre Processing detail.
*--> SCREEN 9400
WHEN C_SCREEN_9400. "MHTK903418(BEgin Of change)
*-- Build the field catalog for the ALV grid.
PERFORM BUILD_FIELD_CATALOG TABLES ITAB_FIELDCAT_1400
USING:
*ref_table|fieldname|coltext|hotspot|inttype|outputlen|lzero|just|color
'ITAB_PRE_PROC2' 'Z_PRE_PROC' 'Pre Processing Number'(030) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_PRE_PROC2' 'Z_PRE_PROC_LN' 'Pre Processing Number'(035) ' ' 'C' ' ' ' ' ' ' 'C100',
'ITAB_PRE_PROC2' 'MATNR' 'Material'(035) ' ' 'C' ' ' ' ' ' ' 'C500',
'ITAB_PRE_PROC2' 'Z_PSH_QTY' 'Quantity'(035) ' ' 'C' ' ' ' ' ' ' 'C500'.
*'ITAB_TO2' 'MATNR' 'Material'(016) ' ' 'C' ' ' ' ' ' ' 'C500',
*'ITAB_TO2' 'NSOLM' 'Quantity'(017) ' ' 'I' ' ' ' ' ' ' 'C500',
*'ITAB_TO2' 'NLTYP' 'Storage type'(014) ' ' '' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
**'ITAB_TO2' 'POSNR' 'Line'(015) ' ' 'C' ' ' ' ' ' ' 'C500'. "MHTK903257(-)
*-- Create the ALV grid object.
CREATE OBJECT PT_ALV_1400
EXPORTING
I_PARENT = PT_DOCK_1400.
*-- Exclude the non-applicable functions from the ALV grid.
PERFORM EXCLUDE_FUNCTIONS TABLES ITAB_FUNCTIONS
USING R_SCREEN.
*-- Get the title of the ALV grid.
PERFORM GET_ALV_GRID_TITLE USING C_SCREEN_1400
CHANGING LS_LAYOUT-GRID_TITLE.
SORT ITAB_PRE_PROC2 BY Z_PRE_PROC.
*-- Display the ALV grid.
CALL METHOD PT_ALV_1400->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = LS_LAYOUT
IT_TOOLBAR_EXCLUDING = ITAB_FUNCTIONS
CHANGING
IT_OUTTAB = ITAB_PRE_PROC2
IT_FIELDCATALOG = ITAB_FIELDCAT_1400. "MHTK903418(End of change)
ENDCASE.Hi
U copy from standard program and paste ur report ...It will work..'
Regards:
Prabu
Maybe you are looking for
-
HI, I have an HP LaserJet CM415fnw. I would like to print only with the black cartridge even if I want to print from a phone or tablet, or for anyone that wants to use the printer and doesn't know how to set up the printer to print only in black.
-
Colorchecker Passport not working in Lightroom 5.6
I have been using the colorchecker passport while photographing my art for about a year now and have not had problems with it until recently. Now Lightroom 5.6 will not show my profiles in the camera calibration area nor will it create a new profile
-
Okay, let me try to explain just one more time... I currently have a website published through iweb and I used godaddy to set up my personal domain name for the website. I now would like to create a totally different site using a completely different
-
HT4623 how can i lock my iphone
how can i lock my iphone so no one can ge in it
-
Get twitter feeds directly in After Effects compositions with Google Sheets
Hey All, I'm posting a follow up to a thread I started a while ago on this forum about seeking beta testers for a new plugin I started to develop, called Templater, for producing dynamic renders out of After Effects. I want to thank all the beta tes