How we can select two records in alv report
how we can select two records in alv report
Hello,
You can use the method <b>get_selected_rows</b>.
CALL METHOD gv_alv->get_selected_rows
IMPORTING
ET_INDEX_ROWS =
et_row_no = lt_selected_rows.
READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
The table <b>lt_selected_rows</b> will contain all the selected rows.
Regards,
Beejal
**reward if this helps
Similar Messages
-
How to Print Selection-Screen along with ALV Report output
Hi,
I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
Basically i need to print the ALV output along with selection screen.
Could you plz suggest me the way.
Regards,
NitinHi,
My selection Screen is a very big one. It contains around 30 select-options.
So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
Regards,
Nitin -
How to display selected table fields in ALV report.
Hi,
I am displaying data from table EKPO using ALV through this query.
select * from ekpo into table itab_ekpo up to 25 rows.
bt if i need to display selected fields like
select ebeln matnr netpr from ekpo into table itab_ekpo up to 25 rows.
IT gives error GETWA_NOT_ASSIGNED.
FIELD SYMBOL HAS NOT YET BEEN ASSIGNED
CAN ANYONE PLZ HELP ME.Hi ,
I am pasting the code in which i am getting the error.Plz help.
REPORT ZHALV.
tables:ekpo.
data itab_ekpo type ekpo occurs 100 with header line.
types: begin of itab_new,
f_ebeln type ekpo-ebeln,
f_matnr type ekpo-matnr,
f_netpr type ekpo-netpr,
end of itab_new.
data itab1 TYPE STANDARD TABLE OF itab_new initial size 0.
type-pools: slis.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lf_fieldcat TYPE slis_fieldcat_alv.
DATA: ws_repid TYPE sy-repid VALUE 'ZHALV'.
DATA: l_layout TYPE slis_layout_alv.
selection-screen Begin of block block1 with frame title text-111.
select-options : S_EBELN for EKPO-EBELN.
selection-screen end of block block1.
INITIALIZATION.
start-of-selection.
select ebeln matnr netpr from ekpo into table itab1 up to 10 rows WHERE EBELN IN S_EBELN.
*select * from ekpo into table itab_ekpo up to 25 rows.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM GET_DETAILS.
end-of-selection.
*& Form build_fieldcatalog
text
FORM build_fieldcatalog .
PURCHASING DOCUMENT NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'EBELN'.
lf_fieldcat-ref_tabname = 'EKKO'.
lf_fieldcat-ref_fieldname = 'EBELN'.
MATERIAL NUMBER
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'MATNR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'MATNR'.
APPEND lf_fieldcat TO lt_fieldcat.
NET PRICE IN PURCHASING DOCUMENT
CLEAR lf_fieldcat.
lf_fieldcat-fieldname = 'NETPR'.
lf_fieldcat-ref_tabname = 'EKPO'.
lf_fieldcat-ref_fieldname = 'NETPR'.
lf_fieldcat-cfieldname = 'WAERS'.
lf_fieldcat-do_sum = 'X'.
APPEND lf_fieldcat TO lt_fieldcat.
ENDFORM. " build_fieldcatalog
*& Form GET_DETAILS
text
FORM GET_DETAILS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = ws_repid
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 = 'EKPO'
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
IT_FIELDCAT = lt_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = 'A'
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = itab1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
WRITE: 'SY-SUBRC: ', SY-SUBRC .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*append itab_ekpo to i_tab.
ENDFORM. "GET_DETAILS -
How can we sort records in alv, give example
how can we sort records in alv, give example
Hi
<b>Setting Sort Conditions</b>
It is possible to set sort conditions for the table data. This is achieved by filling an internal table of structure LVC_T_SORT which consists of the sort criteria. To have an initial sorting, pass it to the parameter IT_SORT of the method set_table_for_first_display.
FORM prepare_sort_table CHANGING pt_sort TYPE lvc_t_sort .
DATA ls_sort TYPE lvc_s_sort .
ls_sort-spos = '1' .
ls_sort-fieldname = 'CARRID' .
ls_sort-up = 'X' . "A to Z
ls_sort-down = space .
APPEND ls_sort TO pt_sort .
ls_sort-spos = '2' .
ls_sort-fieldname = 'SEATSOCC' .
ls_sort-up = space .
ls_sort-down = 'X' . "Z to A
APPEND ls_sort TO pt_sort .
ENDFORM. " prepare_sort_table
<b>Preparing the table for sorting settings</b>
We have two important points to tell about this topic. First one is that, be ready for a short dump if any one of the fields given to be sorted is not in the content of the field catalog. Secondly, when you make ALV Grid to sort data, by default it vertically merges fields having the same content. To avoid from this for all of the columns, you can set no_merging field of the layout structure to X. If you want to disable merging for just some columns, set no_merging field of the field catalog row corresponding to that column.
You can get and set sort criteria applied whenever you want by using methods get_sort_criteria and set_sort_criteria, respectively.
<b>
Sort Using FACTORY CLASSES</b>
<b>Sorts CL_SALV_SORTS</b>
we can add some sorting to the ALV grid. Create the object reference variable and receive the object using the GET_SORTS method of the GR_TABLE object. Next, add the sort by calling the ADD_SORT method of the GR_SORTS object.
report zalvom_demo1.
data: ispfli type table of spfli.
data: gr_table type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table.
data: gr_column type ref to cl_salv_column_table.
data: gr_sorts type ref to cl_salv_sorts.
data: color type lvc_s_colo.
start-of-selection.
select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ).
gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ).
gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ).
gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'.
color-int = '1'.
color-inv = '0'.
gr_column->set_color( color ).
gr_sorts = gr_table->get_sorts( ).
gr_sorts->add_sort 'CITYTO' ).
gr_table->display( ).
Regards
Ravish
<b><i>
Reward if useful to you</i></b>
Message was edited by:
Ravish Garg -
How to add a checkbox to dynamic itab so that i can select some records
How to add a checkbox to dynamic itab so that i can select some records in the alv and can display them in another alv using a button
I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)Hi,
I tried and finally i got it , Just try for it.
type-pools : slis.
PARAMETERS : p_tab type dd02l-tabname.
data : ref_tabletype type REF TO cl_abap_tabledescr,
ref_rowtype TYPE REF TO cl_abap_structdescr.
field-symbols : <lt_table> type standard TABLE ,
<fwa> type any,
<field> type abap_compdescr.
data : lt_fcat type lvc_t_fcat,
ls_fcat type lvc_s_fcat,
lt_fldcat type SLIS_T_FIELDCAT_ALV,
ls_fldcat like line of lt_fldcat.
data : ref_data type REF TO data,
ref_wa type ref to data.
ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
TRY.
CALL METHOD cl_abap_tabledescr=>create
EXPORTING
p_line_type = ref_rowtype
receiving
p_result = ref_tabletype.
CATCH cx_sy_table_creation .
write : / 'Object Not Found'.
ENDTRY.
*creating object.
create data ref_data type handle ref_tabletype.
create data ref_wa type handle ref_rowtype.
*value assignment.
ASSIGN ref_data->* to <lt_table>.
assign ref_wa->* to <fwa>.
loop at ref_rowtype->components ASSIGNING <field>.
ls_fcat-fieldname = <field>-name.
ls_fcat-ref_table = p_tab.
append ls_fcat to lt_fcat.
if lt_fldcat[] is INITIAL.
ls_fldcat-fieldname = 'CHECKBOX'.
ls_fldcat-checkbox = 'X'.
ls_fldcat-edit = 'X'.
ls_fldcat-seltext_m = 'Checkbox'.
append ls_fldcat to lt_fldcat.
endif.
clear ls_fldcat.
ls_fldcat-fieldname = <field>-name.
ls_fldcat-ref_tabname = p_tab.
append ls_fldcat to lt_fldcat.
endloop.
loop at lt_fldcat into ls_fldcat.
if sy-tabix = 1.
ls_fldcat-checkbox = 'X'.
ls_fldcat-edit = 'X'.
modify lt_fldcat FROM ls_fldcat
TRANSPORTING checkbox edit.
endif.
endloop.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fcat[]
IMPORTING
ep_table = ref_data.
assign ref_data->* to <lt_table>.
select * FROM (p_tab) into table <lt_table>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = lt_fldcat[]
TABLES
t_outtab = <lt_table>.
Thanks & Regards,
Raghunadh .K -
How to select multiple records in ALV with out pressing ctrl
Hi Experts,
Is there a way to select multiple records in ALV with out pressing ctrl button on the key board?
Selection and deselection should allow multiple records.
any clue is highly appreciated.
regards,
AjayThe keyboard always plays a role, although with the Shift key you can select blocks of records.
○ CTRLclick, CTRLspacebar
Toggles a selection.
○ SHIFTclick, CTRLshift
Selects the area from the lead selection to the row selected. If no lead selection is set, the selection starts from the first row. In the multiNoLead mode, the selection starts from the row last selected -
How we can display two list if not using blocked alv ,not scr painter
how we can display two list if not using blocked alv ,not scr painter
1. Once the cell number/service on the 3GS is transfered to the 5, the 3S will become basically an iPod touch until a new sim is in place, correct? We can still use wi-fi and the apps on the phone, and still be able to sync to iTunes, correct? iOS has been upgraded to 6.
1a. With a new Sim, any issue with losing any data/apps on the phone? I dont' think so.
1. Yes. without a sim it has no service, but all other features should be useable normally.
1.a Nope, Data and Apps are independent of the Sim.
2. Once the 5 is activated on the new carrier, how do I share the apps within iTunes? Is it as easy as using iCloud (which we haven't "activated" yet) and/or plugging both phones into iTunes and transferring between devices (authorizing both)? Photos? There are photos on the 3S that we will need on the 5.
2. As long as both Phones use the same Apple ID, the applications can be synced to each through iTunes. Also any downloads on one phone should appear in the other. Again as long as both phones are using the same Apple ID.
3. Reverse order for new apps purchased (understand that not all the iphone 5 apps will work on the 3GS)?
3. If they can be run on the iPhone3GS they should be synced automatically.
4. My husband also has a new iPad, any complications there with three devices? To date, he has not "shared" apps between his 3S and the iPad. He does not have iCloud set up, but plugs into his computer to backup and transfer photos.
4. If all 3 Devices share the same Apple ID all should be synced.
As a word of warning, if all 3 devices use the same Apple ID, messages recieved using iMessage will appear on all 3 devices.
And Conctacts may get overwritten if synced to iCloud (thogh you say he doesn't have one), or merged together. -
How i can take all record that start for Epi using a select?
How i can take all record that start for Epi using a select?
exemple
select objnr from jest where objnr = 'Epi*' -
so don't goIs case important? Can it be "EPI"?
I think case is important, so do it like Shakir showed you, but put it in upper case.
Rob
Message was edited by:
Rob Burbank -
How to refresh after delete the records in ALV report ?
Hi Friends,
How to refresh after delete the records in ALV report.
I am deleting records in ALV report .
After successful delete the screen should refresh.
u201C Deleted records should not appear in the screen u201C.
Please guide me.
Regards,
SubashHi subhash,
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
WHEN 'BACK'.
Refresh the internal table from the ALV grid
PERFORM update_alv_tab.
ENDFORM. "user_command
FORM update_alv_tab .
DATA : e_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = e_grid.
CALL METHOD e_grid->check_changed_data.
"update_alv_tab
CALL METHOD e_grid->refresh_table_display.
ENDFORM. " UPDATE_ALV_TAB
Then see in Debug mode is it updating or not..
Please confirm .
And please paste the code if you can.
Regards. -
I have an old iphone 3 32gb and don't use it to make calls as I have a 4s but would like to use the 3 for music any suggestions as to how I can sync two phones with I tunes
Plug the device into the computer.
Select the content desired to sync.
Sync. -
How to do choose one record in alv screen from dyn_table ?
Experts: How to do choose one record in alv screen from <dyn_table> ?
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: V_COUNT TYPE I.
CLEAR: V_COUNT,<dyn_wa>.
LOOP AT <dyn_table> INTO <dyn_wa>. "WHERE <?????> = 'X'. I should how to do write ?
V_COUNT = V_COUNT + 1.
ENDLOOP.
if not rs_selfield-tabindex eq 0 AND V_COUNT NE 0.
IF R_UCOMM = '&CHANGE'.
IF sy-subrc = 0.
IF V_COUNT = 1.
CALL SCREEN 100.
perform dny_field_value_update.
rs_selfield-refresh = 'X'.
ENDIF.
ENDIF.
endif.
endif.
ENDFORM. "USER_COMMANDAnyways which version of SAP are you using ? As of SAPNW 7.0 Release 2 you can specify dynamic tokens with LOOP ... WHERE statement.
My sap product is ecc5.0. Still thanks!
Now I have solved it.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: V_COUNT TYPE I.
CLEAR: V_COUNT,<dyn_wa>,IT_TOTAL.
SY-INDEX = rs_selfield-tabindex.
READ TABLE <dyn_table> INTO <dyn_wa> INDEX SY-INDEX.
ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <DYN_WA> TO <dyn_field>.
CONDENSE <DYN_FIELD> NO-GAPS.
IT_TOTAL-KUNNR = <DYN_FIELD>.
ASSIGN COMPONENT 'PLANTNO' OF STRUCTURE <DYN_WA> TO <dyn_field>.
CONDENSE <DYN_FIELD> NO-GAPS.
IT_TOTAL-MATNR = <DYN_FIELD>.
ASSIGN COMPONENT 'CUSTOMERNO' OF STRUCTURE <DYN_WA> TO <dyn_field>.
CONDENSE <DYN_FIELD> NO-GAPS.
IT_TOTAL-CUSTOMERNO = <DYN_FIELD>.
ASSIGN COMPONENT 'ZPERSON' OF STRUCTURE <DYN_WA> TO <dyn_field>.
CONDENSE <DYN_FIELD> NO-GAPS.
IT_TOTAL-ZPERSON = <DYN_FIELD>.
IF SY-SUBRC = 0.
"CHECK <dyn_field> = 'X'.
V_COUNT = V_COUNT + 1.
ENDIF.
if not rs_selfield-tabindex eq 0 AND V_COUNT NE 0.
IF R_UCOMM = '&CHANGE'.
IF sy-subrc = 0.
IF V_COUNT = 1.
CALL SCREEN 100.
perform dny_field_value_update.
rs_selfield-refresh = 'X'.
"exit.
ENDIF.
ENDIF.
endif.
endif.
Edited by: andy1982999 on Apr 2, 2010 8:42 AM -
How to apply List box for multiple selection of rows in ALV report ?
Hi Exprots,
1: How to apply List box for multiple selection of rows in ALV report ?
Thanking you.
Subashhi,
check the below program.
REPORT zalv_dropdowns.
*Type pools declarations for ALV
TYPE-POOLS : slis.
*data declarations for ALV container,ALV grid, Fieldcatalogues & layout
DATA: g_grid TYPE REF TO cl_gui_alv_grid,
g_custom_container TYPE REF TO cl_gui_custom_container,
gt_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
wa_outtab TYPE t517a.
START-OF-SELECTION.*Call to ALV
CALL SCREEN 600.*On this statement double click it takes you to the screen painter SE51.
*Create a Custom container and name it CCONT and OK code as OK_CODE.
*Save check and Activate the screen painter.
*Now a normal screen with number 600 is created which holds the ALV grid.
PBO of the actual screen , Here we can give a title and customized menus
Here we also call the subroutine for ALV output.
MODULE PBO OUTPUT *
MODULE pbo OUTPUT.
PERFORM alv_output.
ENDMODULE. "pbo OUTPUT
MODULE PAI INPUT *
MODULE pai INPUT.
ENDMODULE. "pai INPUT
*& Form BUILD_FIELDCAT
FORM build_fieldcat.
DATA ls_fcat TYPE lvc_s_fcat.
*Build the field catalogue
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'T517A'
CHANGING
ct_fieldcat = gt_fieldcat.
To assign dropdown in the fieldcataogue
LOOP AT gt_fieldcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'SLART'.
*is the first list box
ls_fcat-drdn_hndl = '1'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
is the second list box
WHEN 'ABART'.
ls_fcat-drdn_hndl = '2'.
ls_fcat-outputlen = 15.
MODIFY gt_fieldcat FROM ls_fcat.
ENDCASE.
ENDLOOP.
ENDFORM. "build_fieldcat
*& Form ALV_OUTPUT
FORM alv_output .*Create object for container
CREATE OBJECT g_custom_container
EXPORTING container_name = 'CCONT'.
*create object for grid
CREATE OBJECT g_grid
EXPORTING i_parent = g_custom_container.
Build fieldcat and set column
*Assign a handle for the dropdown listbox.
PERFORM build_fieldcat.
*Build layout
PERFORM build_layout.
Define a drop down table.
PERFORM dropdown_table.
*fetch values from the T517A table
SELECT * FROM t517a INTO TABLE gt_outtab.
*Display ALV output
CALL METHOD g_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = gt_outtab.ENDFORM. "ALV_OUTPUT
*& Form dropdown_table
text
--> p1 text
<-- p2 text
FORM dropdown_table.*Declarations for drop down lists in ALV.
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
First SLART listbox (handle '1').
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 Primary school'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '02 Lower Secondary'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '1'.
ls_dropdown-value = '03 Upper Secondary'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '04 Professional School'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '05 College'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '06 University'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = '09 Other Establishment'.
APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2'). ls_dropdown-handle = '2'.
ls_dropdown-value = '10 Primary School certificate'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '20 Lower secondary/Junior high'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '30 High school diploma(B-levels)'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = '31 Vocational'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '32 Matriculation'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '40 Specialist vocational certificate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '50 College degree Level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '51 College degree Level2'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '52 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '60 Univ Degree level1'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '61 Bachelors degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '62 Masters degree'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '63 Licenciate'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '64 Doctors Degree Ph.D'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '89 None'.
APPEND ls_dropdown TO lt_dropdown. ls_dropdown-handle = '2'.
ls_dropdown-value = '90 Unknown'.
APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
CALL METHOD g_grid->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.ENDFORM. " dropdown_table
*& Form build_layout
text
*layout for ALV output
FORM build_layout . gs_layout-cwidth_opt = 'X'.
gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
gs_layout-no_toolbar = 'X'.ENDFORM. " build_layout
endform.
Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM -
How to display two lables in alv report
Is there any chance to display two lables in alv report
for example..
AMOUNT
Rs | Ps
|
like that this for an example.
thanks,
JBHai Babu
Go through the following Code
using Classes & Methods
try with the following Code( Just copy the code & try with in SE38 Tcode & Execute it that all)
REPORT ZALV_SALES_HEADER_DETAIL MESSAGE-ID Z50650(MSG) .
TABLES
TABLES: VBAK . "SALES DOCUMENT HEADER
DATA OBJECTS DECLARATION
DATA: IT_VBAK TYPE STANDARD TABLE OF ZVBAK_STRUC,
IT_VBAP TYPE STANDARD TABLE OF ZVBAP_STRUC,
GS_LAYOUT TYPE LVC_S_LAYO,
GS1_LAYOUT TYPE LVC_S_LAYO,
GRID TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
VBAK_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
VBAP_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
WA_VBAK LIKE LINE OF IT_VBAK,
WA_VBAP LIKE LINE OF IT_VBAP,
SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
GRID_VBAP TYPE REF TO CL_GUI_ALV_GRID,
TOP_PAGE TYPE REF TO CL_DD_DOCUMENT,
FLAG(1).
*"EVENT RECIEVER CLASS DEFINITION
CLASS LCL_EVENT_RECIEVER DEFINITION DEFERRED.
DATA: OBJ_EVENT TYPE REF TO LCL_EVENT_RECIEVER.
SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
CLASS DEFINITION AND DECLARATIONS
CLASS LCL_EVENT_RECIEVER DEFINITION.
PUBLIC SECTION.
EVENTS:DOUBLE_CLICK,
TOP_OF_PAGE.
METHODS:HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW .
METHODS: HANDLE_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID.
ENDCLASS. "LCL_EVENT_RECIEVER DEFINITION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION.
METHOD: HANDLE_DOUBLE_CLICK.
READ TABLE IT_VBAK INDEX E_ROW-INDEX INTO WA_VBAK.
PERFORM FETCH_ITEM_DETAILS USING WA_VBAK.
PERFORM ALV_GRID.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
METHOD: HANDLE_TOP_OF_PAGE.
CALL METHOD TOP_PAGE->ADD_TEXT
EXPORTING
TEXT = 'SALES HEADER & ITEM DETAILS'.
CALL METHOD TOP_PAGE->DISPLAY_DOCUMENT
EXPORTING
PARENT = TOP_OF_PAGE_CONTAINER.
ENDMETHOD. "HANDLER_TOP_OF_PAGE
ENDCLASS. "LCL_EVENT_RECIEVER IMPLEMENTATION
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF S_VBELN IS NOT INITIAL.
SELECT COUNT(*)
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-DBCNT = 0.
MESSAGE E000 WITH 'NO TABLE ENTRIES FOUND FOR LOW KEY SPECIFIED'.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM FETCH_SALES_HEADER_RECORD.
PERFORM CREATE_CALL. "CREATION OF OBJECTS & CALLING METHODS
END-OF-SELECTION.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form FETCH_SALES_HEADER_RECORD
text
--> p1 text
<-- p2 text
FORM FETCH_SALES_HEADER_RECORD .
SELECT
VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
WHERE VBELN IN S_VBELN
AND VBTYP = P_VBTYP.
ENDFORM. " FETCH_SALES_HEADER_RECORD
*& Form CREATE_CALL
text
--> p1 text
<-- p2 text
FORM CREATE_CALL .
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = 'CUSTOM_CONTAINER'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT SPLITTER
EXPORTING
TOP = 5
PARENT = CUSTOM_CONTAINER
ROWS = 3
COLUMNS = 1
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = TOP_OF_PAGE_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = VBAK_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 3
COLUMN = 1
RECEIVING
CONTAINER = VBAP_CONTAINER.
CREATE OBJECT GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAK_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GS_LAYOUT-GRID_TITLE = 'SALES HEADER DETAILS.'(100).
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAK_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAK
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
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.
CREATE OBJECT OBJ_EVENT .
SET HANDLER OBJ_EVENT->HANDLE_DOUBLE_CLICK FOR GRID.
SET HANDLER OBJ_EVENT->HANDLE_TOP_OF_PAGE FOR GRID.
CREATE OBJECT TOP_PAGE
EXPORTING
STYLE = 'ALV_GRID'
CALL METHOD TOP_PAGE->INITIALIZE_DOCUMENT.
CALL METHOD GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = TOP_PAGE.
CALL SCREEN 100.
ENDFORM. " CREATE_CALL
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FETCH_ITEM_DETAILS
text
--> p1 text
<-- p2 text
FORM FETCH_ITEM_DETAILS USING WA_VBAK TYPE ZVBAK_STRUC .
SELECT
VBELN
POSNR
MATNR
MATWA
PMATN
CHARG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN = WA_VBAK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO RECORDS FOUND FOR SPECIFIED KEY'.
ENDIF.
ENDFORM. " FETCH_ITEM_DETAILS
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form alv_grid
text
--> p1 text
<-- p2 text
FORM ALV_GRID .
IF FLAG = ''.
FLAG = 'X'.
CREATE OBJECT GRID_VBAP
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAP_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
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.
GS1_LAYOUT-GRID_TITLE = 'SALES ITEM DETAILS.'(100).
CALL METHOD GRID_VBAP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAP_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS1_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAP
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
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. " alv_grid
Thansk & regards
Sreenivasulu P -
How to select multiple row in ALV report
Hi friends,
1. How to select multiple row in ALV report
( How to set tab in ALV report and want to select multiple line.)
Thanking you.
SubashHi Sahoo,
If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
in layout structure you will find field SEL_MODE
pass :
LS_LAYOUT-SEL_MODE = 'A'.
In PAI.
CALL METHOD GRID->GET_SELECTED_ROWS
IMPORTING
ET_INDEX_ROWS = T_ROWS
ET_ROW_NO = T_ROWID.
Hope these will solve your problem.
Regards,
Kumar M. -
How do I select two-sided printing now that I have Adobe Reader? I didn't know it would change my print function at all and am curious why it does. My HP printer always did this and on the old screen there was a check off box for two-sided printing. Thank you!
Hello Mickeyps
What's the Adobe Reader version at your end? I am using Reader 11.0.06 and I do see this option. See below.
Regards,
Deepak
Maybe you are looking for
-
A better way to execute a series of external commands?
Hi, Consider the code snippet... Process proc1 = rt.exec("Some external command"); Vector vecOutput = outputGobbler.getOutput() ; String[] strAlterCmds = new String[vecOutput.size()]; for ( int k = 0 ; k < vecOutput.size() ; k++ ) strAlterCmds[k] = n
-
I need to upgrade from Safari 5.1.10. Went t the best buy site you indicated but that product is no longer available. Now what do I do?
-
Thread hangs java.io.BufferedInputStream.read
hi,everybody threads often hang in socket read stack dump like this Thread-178 "[STUCK] ExecuteThread: '101' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended, priority=1, DAEMON> { jrockit.net.SocketNativeIO.readBy
-
Adding iSight and Photo Booth...not built in...
I found some posts from about a year ago where people were asking for Photo Booth to be available for the portable iSight cameras. Has this happened? Any idea if it is going to happen? Any rumors particularly since you can't even get one of the porta
-
Why can't I save my tabs when I exit the Firefox browser?
That is to say, where is the option that was available in the previous version of firefox? I ''don't'' care for the option "open browsers from last time" since I may not want to save my tabs each and every time, not to mention the fact that it's godd