How to sense which lines are selected in ALV grid with Reuse FM.
Hi!;
with the help of the forum I have developed a ALV grid whose first column is a editable checkbox.
The user click some of the lines on the ALV grid and I added an additional button on the tooolbar named "ACCEPT".
When the button ACCEPT is clicked I want to get the lines whose checkbox is checked.
How can I do that ?
Making the first column (Checkbox column ) hotspot of no help.
Would you please help me ?
Erkan
Moderator message: please search for available information/documentation.
Edited by: Thomas Zloch on Sep 14, 2011 3:05 PM
hi,
you can refer the below link:
/thread/492162 [original link is broken]
Similar Messages
-
How to set only one row selection in ALV GRID DISPLAY
How to set single row selection in grid display
not multiselection.Hi,
In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL = 'X'.
If more than single entry found, then raise an error message.
Best regards,
Prashant -
Identifying which line was selected from a WebDynpro table
Hi,
can any one give me some advice, I've created a view which displays a table of filenames, which in fact are "LinkToAction" columns. The idea was that when a filename(LinkToAction) was selected, I could retrieve the appropriate file from the Applicatio server and Open the file in Excel or Save as Excel. My problem is, when I select a filename I don't know how to identify what line was selected in the table. Any advice would be great.
Thanks,
CHi , Just identify its element which is lead selected and read attribut of that element .
Have the code for the same
DATA:
node_nd_worlflow TYPE REF TO if_wd_context_node,
elem_nd_worlflow TYPE REF TO if_wd_context_element,
stru_nd_worlflow TYPE wd_this->element_nd_worlflow ,
lead_selection_index TYPE i,
relation_no TYPE guid_32.
navigate from <CONTEXT> to <ND_WORLFLOW> via lead selection
node_nd_worlflow = wd_context->get_child_node( name = wd_this->wdctx_nd_worlflow ).
@TODO handle not set lead selection
IF ( node_nd_worlflow IS INITIAL ).
ENDIF.
get element via lead selection
lead_selection_index = node_nd_worlflow->get_lead_selection_index( ).
elem_nd_worlflow = node_nd_worlflow->get_element( index = lead_selection_index ).
elem_nd_worlflow->get_static_attributes( IMPORTING static_attributes = stru_nd_worlflow ).
Cheers
Parry -
HR how to find which personal area belongs to which country
HR
how to find which personal area belongs to which country
thank you,
Regards,
Jagrut Bharatkumar shuklaHi,
You can use the table T001P for finding that for eg.,
<b>Select molga from t001p where werks = 'Your Personnel area code'.</b>
Thanks
Yogesh -
How to determine which elements are queryable via Web Services QueryPage
I am trying to query opportunities by associated opportunity product revenue records, but I continue to receive errors like "Unexpected text: = '9598015'".
From reviewing the forums, it looks like this is when I am querying a field that is not defined to be queryable.
Could someone please tell me how to determine which fields are queryable on a particular record type like this? I have tried using basic short text fields and indexed short text fields - but continue to receive the error message above.
Thanks in advance.I found at least partial answers to my questions.
MessageContext.getPropertyNames() can be used to see the properties on a given flow.
MessageContext.getProperty(prop) can be used to get information for paroperties such as:
prop=javax.xml.rpc.service.endpoint.address
prop=wsdl.portName
-- Frank -
How to know which interfaces are going to which switch?
How to know which interfaces are going to which switch ?
I know that cdp will show this information. But CDP will not show info about the devices connected to my device and whose link between is administratively down.
Regards,
ChanduI don't want to the end devices location.
For example, i have a switch that connect to multiple switches few using etherchannels and few using stand-along ports.
So assume that one of the link whether it may be entire port-channel or a stand alone link that connects to another switch has been shut down manually by some x person...
Then how can i know that which interfaces are connecting to that switch. In this case i think CDP will not help because it will hold the information of ports that are up.
Regards,
Chandu -
How to identify Which ports are using in RAC setup?
Hi,
how to identify Which ports are using in RAC setup?
Thnaks,[Viewing Port Numbers and Access URLS|http://download.oracle.com/docs/cd/B19306_01/install.102/b14205/ports.htm#sthref1208]
-
How to find which datasource are using tables AFRU ,CAUFV and AUFM
*how to find which datasource are using tables AFRU ,CAUFV and AUFM*
Hi,
You can enter your table names in SE11 transaction and click "Display" and again click "Where -Used-List". Then it will show all the places where these tables are used(Datasources)
Hope this helps.....
Regards,
SUman -
How to display 2 lines of fieldcat in alv
hi,all.
I wonder how to display 2 lines of fieldcat in alv,no matter grid,list ,oo. whatever.
thanks in anvance.Hi,
it's only possible in alv-list (3 lines).
A. -
How to display multi line headings in procedural alv report
Hi experts,
How to display multi line heading in alv( procedural alv report) report.
some columns single line and some columns multi line in the same report.
ex:
solvent consumed solvent recovered
fresh | recovery recovery | spent batch no storage
I am using procedural alv .pls give me idea.Hi Ram,
Check the sample report [how to display multi line headings in procedural alv report|http://sample-code-abap.blogspot.com/2008/01/printing-multiple-line-header-and.html]
Thanks,
Duy -
OO ALV grid with a header line is this possible?
Howdy!
I have a requirement where I need to produce an ALV grid with the following format:
<b>Text 1 Text 2 Text 3 Text 4
Text 6
Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9
Cell conents -
Cell conents -
Cell conents -
Cell conents -
Cell conents -
</b>
Anyone got any idea on how to get the 'TEXT' fields into the ALV grid? These are dynamic texts that would basically display details of data entered in the selection screen.
The ALV title line is limited to 70 characters and I can't think of another way of doing this.
The texts need to appear on the ALV grid becasue the user would like to download them to Excel in addition to the ALV cell contents using the standard ALV functionality.
Any ideas would be appreciated!
Message was edited by: RobertI'm thinking that this may not work because it is not a full screen grid and the grid container does not care about the container on top of it so, it most likely would not print it. Implement this example program, you can see how this would work for you if you were using the FM.
report zrich_0001
no standard page heading.
* Global ALV Data Declarations
type-pools slis.
data: begin of i_alv occurs 0,
matnr type mara-matnr,
end of i_alv.
* Miscellanous Data Declarations
data: fieldcat type slis_t_fieldcat_alv,
events type slis_t_event,
list_top_of_page type slis_t_listheader,
top_of_page type slis_formname value 'TOP_OF_PAGE'.
start-of-selection.
perform initialization.
perform get_data.
perform call_alv.
end-of-selection.
* Form Initialization
form initialization.
clear i_alv. refresh i_alv.
perform eventtab_build using events[].
endform.
* Form Get_Data
form get_data.
select matnr into table i_alv
from mara up to 100 rows.
endform.
* CALL_ALV
form call_alv.
data: variant type disvariant.
data: repid type sy-repid.
repid = sy-repid.
variant-report = sy-repid.
variant-username = sy-uname.
perform build_field_catalog.
perform comment_build using list_top_of_page[].
* Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
i_callback_program = repid
is_variant = variant
it_events = events[]
i_save = 'U'
tables
t_outtab = i_alv.
endform.
* EVENTTAB_BUILD
form eventtab_build using events type slis_t_event.
* Registration of events to happen during list display
data: tmp_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = events.
read table events with key name = slis_ev_top_of_page
into tmp_event.
if sy-subrc = 0.
move top_of_page to tmp_event-form.
append tmp_event to events.
endif.
endform.
* BUILD_FIELD_CATALOG
form build_field_catalog.
clear: fieldcat. refresh: fieldcat.
data: tmp_fc type slis_fieldcat_alv.
tmp_fc-reptext_ddic = 'Material'.
tmp_fc-fieldname = 'MATNR'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
endform.
* COMMENT_BUILD
form comment_build using list_top_of_page type
slis_t_listheader.
data: tmp_line type slis_listheader.
clear tmp_line.
tmp_line-typ = 'H'.
tmp_line-info = 'Here is a line of text'.
append tmp_line to list_top_of_page.
clear tmp_line.
tmp_line-typ = 'S'.
tmp_line-key = 'Key1'.
tmp_line-info = 'Here is a value'.
append tmp_line to list_top_of_page.
clear tmp_line.
tmp_line-typ = 'S'.
tmp_line-key = 'Key2'.
tmp_line-info = 'Here is another value'.
append tmp_line to list_top_of_page.
endform.
* TOP_OF_PAGE
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = list_top_of_page.
endform.
Regards,
Rich Heilman -
How we can get an interactive report in alv grid display?
Hi experts
Plz tell me how we can get an interactive report in alv grid disply pls send me one sample code to understand this
thanks in advancehi,
check this one
*& Report ZALV_FIELD_GRID1
REPORT ZALV_FIELD_GRID1
NO STANDARD PAGE HEADING.
TABLES MARA.
type-pools :slis.
TYPES : BEGIN OF TMARA ,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
ERSDA LIKE MARA-ERSDA,
color(4) type c,
SEL type c,
LIGHT TYPE C,
END OF TMARA.
TYPES: BEGIN OF TMAKT,
MATNR LIKE MAKT-MATNR,
MAKTX LIKE MAKT-MAKTX,
MAKTG LIKE MAKT-MAKTG,
SEL TYPE C,
COLOR(4),
END OF TMAKT.
DATA: ITAB TYPE TMARA OCCURS 0 WITH HEADER LINE,
ITAB1 TYPE TMAKT OCCURS 0 WITH HEADER LINE,
wa_fieldcat type slis_fieldcat_alv,
fieldcat type slis_fieldcat_alv occurs 0,
i_layout type slis_layout_alv,
WA_LISTHEADER TYPE SLIS_LISTHEADER,
i_LISTHEADER TYPE SLIS_LISTHEADER OCCURS 0,
V_EVENTS TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT,
I_TITLE_MARA TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED',
I_TITLE_MAKT TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED',
SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE,
PRINT_CONT type slis_print_alv.
SELECTION SCREE
selection-screen begin of block screen1 with frame title TEXT-001.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN COMMENT /32(35) COMM1.
SELECTION-SCREEN ULINE /27(35).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS MATNR FOR MARA-MATNR.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN COMMENT /30(50) COMM2.
SELECTION-SCREEN ULINE /27(40).
SELECTION-SCREEN SKIP.
SELECT-OPTIONS ERSDA FOR MARA-ERSDA.
SELECTION-SCREEN SKIP.
selection-screen end of block screen1.
INITIALIZATION
INITIALIZATION.
MATNR-low = '23'.
MATNR-high = '1000'.
MATNR-option = 'BT'.
MATNR-sign = 'I'.
APPEND MATNR.
ERSDA-low = '20030124'.
ERSDA-high = '20050302' .
APPEND ERSDA.
PERFORM FILLFIELD.
PERFORM FILLLAYOUT.
PERFORM build_print_params.
PERFORM FILL_SORT.
PERFORM EVENT_CALL.
PERFORM POPULATE_EVENT.
SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
comm1 ='SELECT MATERIAL NUMBER RANGE'.
comm2 ='SELECT MATERIAL CREATION DATE'.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM READDATA.
PERFORM POPDATA.
*& Form READDATA
text
FORM READDATA .
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-LOW
IMPORTING
OUTPUT = MATNR-LOW.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = MATNR-HIGH
IMPORTING
OUTPUT = MATNR-HIGH.
SELECT MATNR
ERSDA
MEINS
FROM MARA
INTO CORRESPONDING FIELDS OF
TABLE ITAB
WHERE MATNR IN MATNR AND ERSDA IN ERSDA.
LOOP AT ITAB.
data id_color type i VALUE 1.
data id_colors(2) type c.
IF ITAB-MATNR < '000000000000000100'.
ITAB-LIGHT = '1'.
ELSEIF ITAB-MATNR < '000000000000000150' AND ITAB-MATNR >
'000000000000000100' .
ITAB-LIGHT = '2'.
ELSE.
ITAB-LIGHT = '3'.
ENDIF.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab-color.
modify itab.
CLEAR ITAB.
endloop.
ENDFORM. " READDATA
Form FILLFIELD
FORM FILLFIELD .
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-outputlen = 20.
WA_FIELDCAT-HOTSPOT = 'X'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
*WA_FIELDCAT-EMPHASIZE = 'C210'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-COL_POS = '2'.
*WA_FIELDCAT-EMPHASIZE = 'C510'.
WA_FIELDCAT-outputlen = 10.
wa_fieldcat-seltext_m = 'UNIT'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'ERSDA'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-outputlen = 15.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
*WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'CREAT DATE'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. "FILLFIELD
Setup print parameters
form build_print_params.
PRINT_CONT-reserve_lines = '3'. "Lines reserved for footer
PRINT_CONT-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
Form POPDATA
FORM POPDATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'USER-COMMAND'
I_CALLBACK_TOP_OF_PAGE = 'TOPPAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_TITLE_MARA
I_GRID_SETTINGS =
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = V_EVENTS
IT_EVENT_EXIT =
IS_PRINT = PRINT_CONT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
ENDFORM. " POPDATA
Form TOPPAGE
FORM TOPPAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DETAIL'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
ENDFORM. "TOPPAGE
Form FILLLAYOUT
FORM FILLLAYOUT .
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-lights_fieldname = 'LIGHT'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
I_LAYOUT-no_totalline = 'X'.
ENDFORM. "FILLLAYOUT
Form FILL_SORT
FORM FILL_SORT .
SORT-DOWN = 'X'.
SORT-SPOS = 1.
SORT-FIELDNAME = 'MATNR'.
SORT-tabname = 'MARA'.
APPEND SORT.
ENDFORM. " FILL_SORT
Form EVENT_CALL
FORM EVENT_CALL .
DATA: I_EVENT LIKE V_EVENTS.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = V_EVENTS.
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. " EVENT_CALL
Form POPULATE_EVENT
FORM POPULATE_EVENT .
READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
IF SY-SUBRC EQ 0.
WA_EVENT-FORM = 'USER_COMMAND'.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
READ TABLE V_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO WA_EVENT.
IF SY-SUBRC = 0.
move 'END_OF_PAGE' to WA_EVENT-FORM.
MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
WA_EVENT-NAME.
endif.
ENDIF.
ENDFORM. "POPULATE_EVENT
FORM END_OF_PAGE.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
ENDFORM.
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CASE RS_SELFIELD-FIELDNAME.
when 'MATNR'.
read table itab with key matnr = RS_SELFIELD-VALUE.
if sy-subrc = 0.
PERFORM DATA_RETRIEVAL_MAKT USING RS_SELFIELD-VALUE.
PERFORM BUILD_FIELDCATLOG_MAKT.
PERFORM FILLLAYOUT_MAKT.
PERFORM DISPLAY_ALV_MAKT.
CLEAR RS_SELFIELD.
ENDIF.
ENDCASE.
ENDCASE.
ENDFORM. "user_command
Form DATA_RETRIEVAL_MAKT
FORM DATA_RETRIEVAL_MAKT USING TMATNR .
SELECT MATNR
MAKTX
MAKTG
UP TO 100 ROWS
FROM MAKT
INTO TABLE ITAB1
WHERE SPRAS = 'EN' AND MATNR = TMATNR.
LOOP AT ITAB1.
data id_color type i VALUE 1.
data id_colors(2) type c.
id_color = id_color + 1.
if id_color > 7.
id_color = 1.
endif.
id_colors = id_color.
concatenate 'C' id_colors '10' into itab1-color.
modify itab1.
CLEAR ITAB1.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL_MAKT
Form FILLLAYOUT_MAKT
FORM FILLLAYOUT_MAKT .
CLEAR I_LAYOUT.
i_layout-zebra = 'X'.
i_layout-info_fieldname = 'COLOR'.
i_layout-box_fieldname = 'SEL'.
I_LAYOUT-EDIT ='X'.
I_LAYOUT-colwidth_optimize = 'X'.
I_LAYOUT-window_titlebar = 'EXAMPLE FOR ALV GRID'.
ENDFORM. " LAYOUT_MAKT
Form BUILD_FIELDCATLOG_MAKT
FORM BUILD_FIELDCATLOG_MAKT .
REFRESH FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-KEY = 'X'.
WA_FIELDCAT-COL_POS = '1'.
*WA_FIELDCAT-EDIT_MASK = 'DD.MM.YYYY'.
WA_FIELDCAT-EMPHASIZE = 'C510'.
wa_fieldcat-seltext_m = 'MATERIAL NUMBER'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTX'.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-EMPHASIZE = 'C710'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
WA_FIELDCAT-FIELDNAME = 'MAKTG'.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-EMPHASIZE = 'C210'.
wa_fieldcat-seltext_m = 'MATERIAL DESCRIPTION'.
APPEND WA_FIELDCAT TO FIELDCAT.
clear wa_fieldcat.
ENDFORM. " BUILD_FIELDCATLOG_MAKT
Form DISPLAY_ALV_MAKT
FORM TOP-OF-PAGE.
REFRESH I_LISTHEADER.
DATA: ld_lines type i,
ld_linesc(10) type c,
I_DATE(10) TYPE C,
I_INFO LIKE WA_LISTHEADER-INFO.
WA_LISTHEADER-TYP = 'H'.
WA_LISTHEADER-INFO = 'MATERIAL DESCRIPTION FOR SELECTED NUMBER'.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE :'.
CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) INTO I_DATE.
WA_LISTHEADER-INFO = I_datE.
APPEND WA_LISTHEADER TO I_LISTHEADER.
CLEAR WA_LISTHEADER.
describe table ITAB1 lines ld_lines.
ld_linesc = ld_lines.
concatenate 'TOTAL NUMBER OF RECORD SELECTED: ' ld_linesc
into I_INFO separated by space.
WA_LISTHEADER-TYP = 'A'.
WA_LISTHEADER-INFO = I_INFO.
append WA_LISTHEADER to I_LISTHEADER.
clear: WA_LISTHEADER , I_INFO.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = I_LISTHEADER
I_LOGO = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "TOP-OF-PAGE
*& Form DISPLAY_ALV_MAKT
text
FORM DISPLAY_ALV_MAKT .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = I_TITLE_MAKT
IS_LAYOUT = I_LAYOUT
IT_FIELDCAT = fieldcat
TABLES
T_OUTTAB = ITAB1
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_MAKT
Rewards points -
How to handle user command method in module ALV Grid
HI Experts,
I have 3 containers grid.
GR_GRID TYPE REF TO CL_GUI_ALV_GRID,
GR_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GR_GRID2 TYPE REF TO CL_GUI_ALV_GRID.
Please advise me how can I insert, save, delete 3 Module ALV Grid in method user command. How can i get which grid button (save, insert, delete) is clicked and how can i control those grid.
Thks in advance.
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS :
HANDLE_TOOLBAR
FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
IMPORTING E_OBJECT E_INTERACTIVE SENDER,
HANDLE_USER_COMMAND
FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
IMPORTING E_UCOMM,
HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED
E_ONF4
E_ONF4_BEFORE
E_ONF4_AFTER,
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW
E_COLUMN,
HANDLE_HOTSPOT_CLICK
FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID
E_COLUMN_ID
ES_ROW_NO.
ENDCLASS. "(LCL_EVENT_RECEIVER DEFINITION)
METHOD HANDLE_USER_COMMAND.
CLEAR G_CODE.
G_CODE = E_UCOMM.
CASE G_CODE.
WHEN 'INSERT'.
MESSAGE 'insert' TYPE 'I'.
APPEND INITIAL LINE TO GT_MAIN.
WHEN 'SAVE'.
MODIFY ZTNBOOK FROM GT_MAIN.
MESSAGE 'save' TYPE 'I'.
WHEN 'DELETE'.
DELETE FROM ZTNBOOK WHERE B_ID EQ GT_ZTBOOK-B_ID.
MESSAGE 'delete' TYPE 'I'.
ENDCASE.
IF NOT G_CODE IS INITIAL.
PBO, PAI
CALL METHOD CL_GUI_CFW=>SET_NEW_OK_CODE
EXPORTING
NEW_CODE = G_CODE.
CLEAR G_CODE.
ENDIF.
ENDMETHOD.Hi,
Before posting, Search in SDN.
See the below tread it will help you.
Re: Get table for cl_gui_alv_grid -
How Alternate rows to be colored in an ALV Grid report?
How Alternate rows to be colored in an ALV Grid report?
hi,
try this
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,
line_color(4) TYPE c, "Used to store row color attributes
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.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
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-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-info_fieldname = 'LINE_COLOR'.
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
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
i_save = 'X'
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.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL -
Multiple Lines in a Single ALV Grid Cell
Is there any way to Display Multiple Lines in a Single ALV Grid Cell.
This can be accomplished by Sorting the First 3 fields and Make it Looks like below displayed format.
But My problem is while downloading also it should be Displayed in the same format.
All inputs are highly appreciated.there was a post similar to this some days back... search it..
any ways...
what u can do is...
arrange ur final internal table so that it will look like same line...
like...lets say ur internal table is :
A1 B1 C1 D1 123
A1 B1 C2 D2 123
A1 B2 C1 D1 123
A1 B2 C2 D2 123
and u can rearrange ur table to be like
A1 B1 C1 D1 123
C2 D2 123
A1 B2 C1 D1 123
C2 D2 123
what i mean to say is dont pass the fields if they are same in the previous line... try it out..
and then pass it two ur ALV.
it will look like they are in one line
Edited by: soumya prakash mishra on Jun 17, 2009 1:31 PM
Maybe you are looking for
-
My Iphone 3 is broken where the SIM is inserted. How can I use it as an ipod?
Iphone 3 has sim slot that does not reconize the sim. still says no sim.
-
Create PO return for subcontracting item
Dear Expert, I want to create PO Return for subcontracting item category.But when I tried to create it,the system prompted an error message:"Returns not possible for subcontracting items Message no. ME 548". Then I used SPRO to check the system messa
-
Third-party font-suitcase migration from iMac G3 to iMac G4 Classic Environment
Hello, I thought I was all set ... successfully installed Appleworks 6.0.3 in the Classic Environment on my "new" Sunflower iMac G4 so I can still use my 3 macros and 2 custom buttons ... and imported my user dictionary as well. That was last week. (
-
Can't upgrade from 10.5.8 to 10.6
I currently am running 10.5.8 on my MacBook, and purchased a 10.6 disc, however when I insert the disc it prompts me to restart my computer to begin the installation process. When the computer is done restarting a message comes up saying "Mac OS X Se
-
Correspondance for customer statements F.27
Dear all I am trying to select a standard form to print customer statements but it is not working. I think it is something not correct in customising. Can anyone send me the steps to do this please. Also when using F.27 I cannot print all the selecte