ALV GRID - Get setting of the variants
Dear All,
I have a program which provides a list with ALV - the user can give his ALV variant on the selection-screen.
I have to know the setting of the variant chosen - Field - Sort - subtotal - This program could be ran in background, that why I have to know all these information by the variant name .
Goal : Let the user chose the layout he wants, and then, the program take over all information he wants and sends by mail the result in an excel file.
Does someone know how to do ?
Thanks a lot
Nat
Hi go through the fallowing code,
DATA: sp TYPE syldb_sp,
l_params LIKE vanz OCCURS 0 WITH HEADER LINE,
l_params_nonv LIKE vanz OCCURS 0 WITH HEADER LINE,
l_selop LIKE vanz OCCURS 0 WITH HEADER LINE,
l_selop_nonv LIKE vanz OCCURS 0 WITH HEADER LINE,
valutab LIKE rsparams OCCURS 0 WITH HEADER LINE,
objects LIKE vanz OCCURS 0 WITH HEADER LINE,
free_selections_desc TYPE rsdynbrepi OCCURS 0,
free_selections_value TYPE rsseldyn OCCURS 0,
g_subrc LIKE sy-subrc VALUE 0.
SELECT report variant FROM varid
INTO CORRESPONDING FIELDS OF
TABLE it_varid
WHERE report = sy-repid.
IF sy-subrc <> 0.
REFRESH it_varid.
ENDIF.
LOOP AT it_varid.
CLEAR p_run.
CALL FUNCTION 'RS_VARIANT_CONTENTS'
EXPORTING
report = it_varid-report
variant = it_varid-variant
execute_direct = 'X'
IMPORTING
sp = sp
TABLES
l_params = l_params
l_params_nonv = l_params_nonv
l_selop = l_selop
l_selop_nonv = l_selop_nonv
valutab = valutab
OBJECTS = OBJECTS
free_selections_desc = free_selections_desc
free_selections_value = free_selections_value
EXCEPTIONS
variant_non_existent = 1
variant_obsolete = 2
OTHERS = 3.
Regards,
Vijay
Similar Messages
-
ALV Grid with size of the whole screen
I need to create ALV Grid, that fits any screen. How can i do this?
I tried cl_gui_docing_container, but in the constructor it's possible to make it to occupy only 95% of the screen.If you are using a custom control on the screen and then a custom container you can easily do this.
Create a screen(Size 200 x 240), place a custom control on the screen and make it to the max size 200 x 240. Now in the attributes of the custom control, check the Resizing option for both horizontal and vertical, with some minimum numbers there.
Now, your ALV grid automatically occupies all the space available on the screen irrespective of the size if the screen and you will have only one scroll bar.
Regards,
Ravi
Note - Please mark all the helpful answers -
Check box in ALV grid gets unselected for new selection
Hi all,
This is my code :
TYPE-POOLS : slis.
Variable
DATA: g_repid LIKE sy-repid,
g_title TYPE lvc_title,
g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
g_layout TYPE slis_layout_alv,
g_print_alv TYPE slis_print_alv,
g_variant LIKE disvariant,
c_char_a(1) VALUE 'A',
c_char_x(1) VALUE 'X',
itab_alv_sort TYPE slis_t_sortinfo_alv,
itab_alv_fcat TYPE slis_t_fieldcat_alv,
fm_name type rs38l_fnam," Function Module Name
* l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
* l_sfoutopt LIKE ssfcompop,
pri_params LIKE pri_params,
c_x type c .
* Internal tables Begin with IT_ *
DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV, "---ALV
it_disp type table of ZLOI.
* Work Area for Internal tables Begin with WA_ *
data : wa_fcat TYPE slis_fieldcat_alv , "---ALV
wa_layout TYPE lvc_s_layo, "---ALV
wa_it_disp like line of it_disp.
* Objects *
DATA : cref TYPE REF TO cl_gui_custom_container, "---ALV
gref TYPE REF TO cl_gui_alv_grid. "---ALV
* Start-of-selection
Start-of-selection.
perform fetch_po_det.
perform build_fcat.
perform alv_display.
*& Form FETCH_PO_DET
* text
* --> p1 text
* <-- p2 text
FORM FETCH_PO_DET .
data : it_po type table of crmd_orderadm_h,
wa_po like line of it_po,
wa_header type BBP_PDS_PO_HEADER_D.
select guid
object_id
DESCRIPTION
POSTING_DATE
CREATED_BY
from crmd_orderadm_h
into corresponding fields of table it_po
where object_type = 'BUS2201'.
loop at it_po into wa_po.
move wa_po-object_id to wa_it_disp-ZZPONO.
move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
move wa_po-posting_date to wa_it_disp-ZZPODATE.
move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
I_OBJECT_ID = wa_it_disp-zzpono
IMPORTING
E_HEADER = wa_header.
move wa_header-total_value to wa_it_disp-ZZPOVAL.
move wa_header-currency to wa_it_disp-ZZPOCUR.
append wa_it_disp to it_disp.
endloop.
* write : wa_it_disp-zzpono.
ENDFORM. " FETCH_PO_DET
*& Form BUILD_FCAT
* text
* --> p1 text
* <-- p2 text
FORM BUILD_FCAT .
g_repid = sy-repid.
g_title = 'LOI details'.
g_print_alv-no_print_listinfos = 'X'.
g_variant-report = sy-repid.
g_variant-variant = sy-title.
CLEAR g_layout.
g_layout-f2code = ' '.
wa_layout-zebra = 'X'.
g_layout-flexible_key = 'X'.
g_layout-colwidth_optimize = 'X'.
g_layout-detail_initial_lines = 'X'.
g_layout-box_fieldname = 'ZZCHECK'.
*g_layout-box_tabname = 'ITAB_REPORT'.
*Check box
wa_fcat-fieldname = 'ZZCHECK'.
wa_fcat-checkbox = 'X'.
wa_fcat-outputlen = '1'.
wa_fcat-col_pos = '1'.
wa_fcat-edit = '1'.
wa_fcat-seltext_m = 'No'.
append wa_fcat to it_fcat.
*Po no
clear wa_fcat.
wa_fcat-fieldname = 'ZZPONO' .
wa_fcat-tabname = 'IT_DISP'.
* wa_fcat-seltext = 'Purchase Order'.
wa_fcat-seltext_m = 'Purchase Order'.
*wa_fcat-seltext_s = 'Purchase Order.
wa_fcat-icon = 'X'.
wa_fcat-col_pos = '2'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Desc
wa_fcat-fieldname = 'ZZPODESC' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Description'.
wa_fcat-seltext_m = 'Description'.
*wa_fcat-seltext_s = 'Description'.
wa_fcat-col_pos = '3'.
wa_fcat-outputlen = 10.
append wa_fcat to it_fcat.
*Postign date
wa_fcat-fieldname = 'ZZPODATE' .
wa_fcat-tabname = 'IT_DISP'.
wa_fcat-seltext_l = 'Posting Date'.
wa_fcat-seltext_m = 'Posting Date'.
*wa_fcat-seltext_s = 'Posting Date'.
wa_fcat-col_pos = '4'.
wa_fcat-outputlen = 8.
append wa_fcat to it_fcat.
*value
wa_fcat-fieldname = 'ZZPOVAL' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO value'.
wa_fcat-seltext_m = 'PO value'.
*wa_fcat-seltext_s = 'PO value'.
wa_fcat-col_pos = '5'.
wa_fcat-outputlen = 15.
append wa_fcat to it_fcat.
*Currency
wa_fcat-fieldname = 'ZZPOCUR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'PO Currency'.
wa_fcat-seltext_m = 'PO Currency'.
*wa_fcat-seltext_s = 'PO Currency'.
wa_fcat-col_pos = '6'.
wa_fcat-outputlen = 5.
append wa_fcat to it_fcat.
*Creator
wa_fcat-fieldname = 'ZZPOCREATOR' .
wa_fcat-tabname = 'IT_DISP'.
*wa_fcat-seltext_l = 'Buyer'.
wa_fcat-seltext_m = 'Buyer'.
*wa_fcat-seltext_s = 'Buyer'.
wa_fcat-col_pos = '7'.
wa_fcat-outputlen = 12.
append wa_fcat to it_fcat.
ENDFORM. " BUILD_FCAT
*& Form ALV_DISPLAY
* text
* --> p1 text
* <-- p2 text
FORM ALV_DISPLAY .
sort it_disp by ZZPONO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = g_set_pf_stat
I_CALLBACK_USER_COMMAND = g_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 = g_title
* I_GRID_SETTINGS =
IS_LAYOUT = g_layout
IT_FIELDCAT = it_fcat[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
IS_VARIANT = g_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
IS_PRINT = g_print_alv
* 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 = it_disp[]
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. " ALV_DISPLAY
*& Form user_command
* text
* -->R_UCOMM text
* -->RS_SELFIELD text
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield. "#EC CALLED
CASE R_UCOMM.
WHEN 'PRINT'.
READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
IF SY-SUBRC EQ 0.
loop at it_DISP INTO WA_IT_DISP.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TEXT_QUESTION = 'Print the LOI details?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'.
* IMPORTING
* ANSWER = w_answer.
IF SY-SUBRC 0.
ENDIF.
* PERFORM CALL_SF.
endloop.
ENDIF.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
rs_selfield-refresh = 'X'.
ENDFORM. "user_command
*& Form set_pf_status
* text
* -->RT_EXTAB text
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
SET TITLEBAR sy-tcode.
ENDFORM. "set_pf_status
Now in my ALV grid o/p i can see the check box but if i select one row and then try to slect another the first one gets deselected.
Can anybody tell me what is missing?Hi,
if you need just a check box for each line, try to get rid of this line from your layout.
g_layout-box_fieldname = 'ZZCHECK'.
SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
Cheers -
ALV Grid OO : Set Field editable for selected rows
Hello ABAPers,
I used object cl_gui_alv_grid to created ALV grid and i succed to set an editable
field for all rows. However my request is to set it for and only for selected rows
I could get the row index but i didn't know how to use it
Thanks in advance
AmineHi Amine,
I think the standard SAP sample program might help you, BCALV_EDIT_02.
I will tell the procedure to make the selected rows editable on ALV.
1. Add a additional field of type LVC_T_STYL in the internal table that you are displaying in the ALV. LVC_T_STYL is a actually a table type.
2. Place a button on the ALV toolbar for EDIT/DISPLAY.
3. Once you press the EDIT button after selecting the rows, loop through the records which you have selected (you have already said that you have the index of selected records).
4. The table type LVC_T_STYL has fields for FIELDNAME and STYLE.
If you have 10 fields in the internal table, then all these ten fields name should be appended to the newly added field in the internal table (LVC_T_STYL) and their style should be populated with value cl_gui_alv_grid=>mc_style_enabled.
Regards,
Rahul MB -
ALV Grid Layouts - Setting them user-specific
Hi everybody -
I am using the ALV grid layout for a report using function module REUSE_ALV_GRID_DISPLAY. There are a number of fields that are not immediately viewed on screen - they are in hide mode within the field catalog. We want to allow the users to add them / remove them from the report using an ALV variant.
I can allow the users to add/remove with a layout variant no problem - but I am having an issue allowing them to save the variant that they are using to view the data, as user-specific. For whatever reason, they are only allowed to save their layout variants as global - the "User-specific" box is grayed out.
Does anyone know how I can get the "User Specific" box to be NOT grayed out within an ALV grid?
Thanks!
AbbySet the I_SAVE parameter to 'U' in your function call.
Regards
Rich Heilman -
ALV grid can we remove the repetation values in field & display as one .
Dear Freinds,
i have developed a custom development relating to a salarly report based on the orgunit, the output is coming however i have one doubt in alv output.
right now my internal table data having data as follows : (iam giving only some fields)
orgunit orgdesc Empno Empname
70000905 Human Resources 7056 Richard
70000905 Human Resources 7057 Reymond Jain
70000905 Human Resources 7058 Maria Gulz
70000905 Human Resources 7061 Jacob
now in my output i dont want to have the orgunit value 70000905 and orgdesc (human resources) shouldnt not be repeated . is there any option in ALV where we I can use in
the field cat ( any parameter) where i can set that we can make the orgid as one and remove the repeation.(iam using alv grid function module).
Please help me in this regard
Regards
SyamlaHi,
Before displaying sort ur internal table.
refer this code.
*& Form sub_display_data
text
FORM sub_display_data .
*--To sort the output through material number
DATA : lwa_sort TYPE slis_sortinfo_alv.
DATA : lit_sort TYPE slis_t_sortinfo_alv.
*--Pass the values to the table
lwa_sort-fieldname = 'PERNR'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '1'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = 'X'. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WORKDATE'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '2'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
*--Pass the values to the table
lwa_sort-fieldname = 'WEKLY'. "Field name in o/p inttable
lwa_sort-tabname = 'it_final2'. "Output Internal table
lwa_sort-spos = '3'. "Sort sequence
lwa_sort-up = 'X'. "Sort in ascending order
lwa_sort-down = ' '. "Sort in descending order
lwa_sort-subtot = ' '. "Subtotal
APPEND lwa_sort TO lit_sort.
wa_layout-colwidth_optimize = 'X'.
IF NOT it_final2[] IS INITIAL.
*--Call the function module to display the ALV report
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = wa_layout
i_callback_program = v_repid
it_fieldcat = it_fieldcat1[]
i_default = c_chk
i_save = c_save
it_sort = lit_sort
TABLES
t_outtab = it_final2
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.
ELSE.
*--Message No data found
MESSAGE i888 WITH text-017.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " sub_display_data
Regards,
Prashant -
ALV-Grid - Get cursor position
Hi,
I replaced the table control in my dynpro with a custom container and placed an ALV-Grid in there.
So, my problem is now to get the cursor position when the user double clicks at the text in a cell.
It´s important for me to know at which position at the text he double clicked.
e.g.:
| Nr |Text |
|----|-------|
| 1|Hello |
| 2|Test |
The user clicks double between the 'e' and 's' at line 2 ('Test').
I need following information:
line 2
column 2
offset 3 (position, where the user clicked)
When I'm using the table control, it's no problem with
the ABAP-statement 'GET CURSOR' and property 'OFFSET',
but I didn't find a method with the same result for ALV-Grid.
Maybe you know a possibility?
Thank you.
Regards from Germanyhello,
go through these links.these links will surely solve your problem.just have a luk.
Get the cursor position row number in a table control.
upper is for table-ctrl
if you are working with alv.you can achieve it by.
call method cl_gui_control=>set_focus
exporting control = w_grid.
w_grid is ur gid name.
go through this link also
Get cursor position from grid
regards,
Shweta
Edited by: Shweta Joon on Aug 20, 2009 1:15 PM -
WEB DYNPRO ALV GRID GET SELECTED ROWS...
I'm reusing component ALV Grid ...
How can i get selected rows...Hi Stephan,
In order to get the multiple rows which were selected by the user you will just have to call the get_selected_elements method of if_wd_context_node. So as you can see its no different from how you would get the multiple rows selected by the user in a table ui element. First get the reference of the node which you have used to bind to the ALV & then call this method on it.
METHOD get_selected_rows .
DATA: temp TYPE string.
DATA: lr_node TYPE REF TO if_wd_context_node,
wa_temp TYPE REF TO if_wd_context_element,
ls_node1 TYPE wd_this->element_node_flighttab,
lt_node1 TYPE wd_this->elements_node_flighttab.
lr_node = wd_context->get_child_node( name = 'NODE_FLIGHTTAB' ).
" This would now contain the references of all the selected rows
lt_temp = lr_node->get_selected_elements( ).
LOOP AT lt_temp INTO wa_temp.
" Use the references to get the exact row data
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
ENDMETHOD.
Hope this helps resolve your problem.
Regards,
Uday -
F4 help in ALV grid, how to check the entries?
Hello,
I have created F4 help on the cells in a ALV using OO ABAP. The F4 Help works fine and the user can select the entries from it. BUt in F4 help, the user can manually enter values also.
I want to either disallow the user the enter values manually or validate his entries and ask him to choose from F4 only.
How to achieve this??Use this in Top Include
class local_event_handler definitin deferred.
data handler type ref to local_event_handler
After ALV Grid, register the edit event as shown below after the SET_TABLE_FOR_FIRST_DISPLAY and also set the handler as event handler
if handler is initial.
create object handler.
endif.
set handler handler->handle_data_changed
for main_grid. " Main Grid is your ALV Grid
call method main_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Class Definition / Implementation
class local_event_handler definition.
public section.
methods
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
methods
local_event_handler .
endclass. "local_event_handler DEFINITION
class local_event_handler implementation.
method local_event_handler.
" do nothing
endmethod. "llocal_event_handler
method handle_data_changed.
read table er_data_changed->mt_mod_cells into ls_mod_cell index 1.
perform handle_data_changed using er_data_changed.
" ls_mod_cell-row_id contains the row number that changed. More details in er_data_changed
endmethod. "handle_data_changed
endclass. "handle_btn_click -
Visibility of ALV grid toolbar functions of the Custom report in ITS screen
Hi all,
I am working on SRM 5.0 with INTERNAL ITS.I have created a custom report and a transaction code for the same.Now in the SRM Web menu,I have provided a link for this report.
The problem I am facing is that in the O/P screen of the report,I have an ALV grid being displayed with 1 custom icon at the end of the std ALV toolbar.Now in the SAPGUI,this icon is displayed correctly at the end of the ALV toolbar but in the Web screen,i can see only few of the functions(visible as buttons in the SRM web screen/IE) in the ALV toolbar and rest of them being displayed under an additional button "MORE".Is there any way i can show the custom icon as a button which is directly visible on the SRM web screen and not under the options MORE?
All inputs will be highly appreciated and rewarded.Hello!
There are several possibilities how to call transaction:
- You can call it as service (that is what you do when you test it from SICF)
- You can call it through service (or alias) WEBGUI (not using service for the specific transaction to call it)
If you are calling it through WEBGUI then parameter ~SINGLETRANSACTION should be added to service (or alias) of WEBGUI. And there should be added also Log Off URL (in SICF). At this case it should navigate back to the URL which is specified in SICF.
Hope this helps!
Best regards,
Rorijs -
Two ALV Grid Display format on the Single page
Hi guru's
I have two plant details. I want to be display these two plant details in the single page with ALV Grid display format.. like
plant no 1(Details):
xxxx xxxx xxxx xxxx with ALV Grid Display format
plant no 2 (Details):
xxx xxxx xxxx xxxx ALV Grid Display format
Can any body help on the .. if you have sample code pls paste.
Thanks in Advance
Surendrahi,
Grid display is not possible but u can display two list on same page by Block ALV....
TYPE-POOLS : slis.
TABLES : mara,
makt.
SELECT-OPTIONS : mat FOR mara-matnr.
DATA : BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
matkl LIKE mara-matkl,
mtart LIKE mara-mtart,
END OF itab.
DATA : BEGIN OF itab1 OCCURS 0,
mtart LIKE mara-mtart,
count TYPE i,
END OF itab1.
DATA : BEGIN OF itab1_col OCCURS 0,
mtart LIKE mara-mtart,
count TYPE i,
END OF itab1_col.
DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
t_fcat2 TYPE slis_t_fieldcat_alv,
wa_fcat TYPE slis_fieldcat_alv,
t_eve TYPE slis_t_event,
wa_eve TYPE slis_alv_event,
t_layout TYPE slis_layout_alv.
DATA : v_repid LIKE sy-repid,
t_mat LIKE mara-matnr.
DEFINE create_fcat.
clear wa_fcat.
wa_fcat-fieldname = &1.
wa_fcat-seltext_l = &2.
wa_fcat-outputlen = &3.
append wa_fcat to t_fcat1.
END-OF-DEFINITION.
START-OF-SELECTION.
PERFORM get_data.
PERFORM dis_data.
*& Form get_data
text
FORM get_data.
SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
FROM mara AS a INNER JOIN makt AS b ON
amatnr = bmatnr
WHERE a~matnr IN mat.
LOOP AT itab.
itab1-mtart = itab-mtart.
itab1-count = 1.
APPEND itab1.
ENDLOOP.
SORT itab1 BY mtart.
LOOP AT itab1.
MOVE-CORRESPONDING itab1 TO itab1_col.
COLLECT itab1_col.
ENDLOOP.
ENDFORM. "get_data
*& Form dis_data
text
FORM dis_data.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
EXPORTING
i_callback_program = v_repid.
REFRESH t_fcat1.
CLEAR t_fcat1.
REFRESH t_eve.
wa_eve-name = 'TOP_OF_PAGE'.
wa_eve-form = 'TOP_OF_PAGE1'.
APPEND wa_eve TO t_eve.
create_fcat:
'MATNR' 'Material' '10',
'MAKTX' 'Material Description' '40',
'MTART' 'Type' '10',
'MATKL' 'Group' '10'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = t_layout
it_fieldcat = t_fcat1
i_tabname = 'ITAB'
it_events = t_eve
TABLES
t_outtab = itab.
REFRESH t_fcat1.
CLEAR t_fcat1.
REFRESH t_eve.
wa_eve-name = 'TOP_OF_PAGE'.
wa_eve-form = 'TOP_OF_PAGE2'.
APPEND wa_eve TO t_eve.
create_fcat:
'MTART' 'Type' '10',
'COUNT' 'Total' '5'.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
EXPORTING
is_layout = t_layout
it_fieldcat = t_fcat1
i_tabname = 'ITAB1_COL'
it_events = t_eve
TABLES
t_outtab = itab1_col.
CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
ENDFORM. "dis_data
*& Form top_of_page1
text
FORM top_of_page1.
FORMAT COLOR COL_POSITIVE.
WRITE:/ 'First Block'.
FORMAT COLOR OFF.
ENDFORM. "top_of_page
*& Form top_of_page2
text
FORM top_of_page2.
FORMAT COLOR COL_NEGATIVE.
WRITE /5 'Second Block'.
FORMAT COLOR OFF.
ENDFORM. "top_of_page
reward if usefull.... -
Delete ALV WD settings (set in the Browser)
I have used the settings (Right mouse -> settings) of an ALVA WD to remove a column. This gave me a NULL reference exception. However, this is not my trouble.
My problem now is how to reset the ALV to all columns. Since I can not get back to the window ("the null reference issue") I am not able to reset my settings in the Browser.
Where are the settings stored so I can delete them?This can be done with wd_analyze_config_user
<xx>/sap/bc/webdynpro/sap/wd_analyze_config_user -
How to kill an alv-grid object and refresh the frontend
Hello experts,
i have created an alv-grid display!
now i want to hide the whole alv-table on the screen when user e.g. hits a button!
How can i kill this object and refresh the frontend?
Thanks a lot,
MarcelHello Marcel
For this requirement I would use the following approach:
(1) main screen '0100': here you display your ALV grid
(2) Define a dummy screen '0101' the user will never see
(3) Link the container for the ALV grid (e.g. go_docking) to the dummy screen when the user pushes the HIDE button (method LINK)
(4) Link the container back to your main screen when the user pushes the DISPLAY button
I never ever destroy a grid control and re-build it from scratch but always use either of its methods REFRESH_TABLE_DISPLAY or SET_TABLE_FOR_FIRST_DISPLAY.
Regards
Uwe -
How to add a column in alv grid report to show the serial no.
i need to add column to show the row no. of the report say as :
1
2
3
this has to be the first column
how to maintain a variable for this and how to use it??
please helpone simple way is in your final itab declare a slno type i field
data : begin of itab occurs 0,
slno type i,
<other fields>
end of itab.
after filling the data in itab.
loop at itab.
itab-slno = sy-tabix.
modify itab.
endloop.
in fieldcatalog also you have to define that slno field as the first column.
but it will change its order if you are sorting the output or filtering the output.
regards
shiba dutta -
ALV GRID - How to activate the option "Display graphic" ?
Hello,
I'm using
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container
Create Event Receiver
CREATE OBJECT cl_event_receiver.
Populate Field Catalog
PERFORM get_fieldcatalog.
r_grid->set_table_for_first_display(
CHANGING
it_outtab = it_table
it_fieldcatalog = it_fieldcat[] ).
and, as you can see I'm display it_table specifing the field of the table (I'm not usinf dictionnary reference ).
My problem is:
all run perfectly except the button "Display graphic" ( the graphic is showed but is empty).
How to solve it ?
tks.Hi,
It will help if u can elaborate on your actual problem.
Display graphic button?
Where do you want to display the graphic?
And what graphic?
Maybe you are looking for
-
Leading ? xml version="1.0"? tag when creating / invoking web services
Hello friends. I'm wondering if anyone has any insight as to why I cannot create a fully formed XML document when developing a web service which includes the standard <? xml version="1.0" ?> leading tag. If I include the leading tag in my XML mapping
-
Compatibility Matrix for Reader X and Acrobat?
I've scoured adobe.com and can't find a compatibility matrix for Reader X and different versions of Acrobat. Does someone have a link?
-
How to stop while loop from looping
Hi, need a little help in the respect to while loops. Basically i have a while loop within an while loop within another while. So what i want to do is run the program within the outer while loop. The problem is that when i start the program it runs o
-
Is there a known problem with NOT IN operator? The following statement returns "no rows selected" message SELECT col_a FROM tab_a WHERE col_a NOT IN ( SELECT col_b FROM tab_b); while the following two statements both return the expected result SELECT
-
Hi, Does Rapid clone need redo log files during cloning on target host on DB tier IN 11.5.10.2? Thanks