Focus to a webdynpro alv grid column after report_element_t100_message
Hi All,
I have an alv grid on my view. When I click a button, I'm making some checks for editable cells and if necessary giving a message to the user by using report_element_t100_message method. After the message, I'm setting focus to the alv grid cell . If I don't give a message, my set_focus code works fine, but I must give a message , so how can I achive this? Isn't it possible setting to a cell after a message?
Followings are some parts from my source code .
Thanks in advance,
MERAL
THESE CODES ARE IN MY VIEW -
*-- GIVE MESSAGE
CALL METHOD wd_assist->mesaj_ver
EXPORTING
in_api_controller = lo_api_controller
in_el_context = lo_el_context
in_msgty = 'E'
in_msgno = wd_assist->msg_boskalamaz
in_msgv1 = cmsg
in_msgv2 = 'Geçerlilik Başlama Tarihi'.
strFocusColumn = 'GECERLIBASTARIH'.
*-- SET FOCUS
lr_salv_wd_table = wd_this->wd_cpifc_alv_molekul_selected( ).
lr_salv_wd_table->set_focus(
index = itabix
column = strFocusColumn ).
THIS METHOD IS IN MY ASSISTANCE CLASS -
method MESAJ_VER.
data lo_message_manager type ref to if_wd_message_manager.
data message type SYMSG.
*-- Get message manager
CALL METHOD in_api_controller->GET_MESSAGE_MANAGER
RECEIVING
MESSAGE_MANAGER = lo_message_manager.
message-MSGTY = IN_MSGTY.
message-MSGID = 'Z_BYY_CLS_AYYA_MSG'.
message-MSGNO = IN_MSGNO.
message-MSGV1 = IN_MSGV1.
message-MSGV2 = IN_MSGV2.
message-MSGV3 = IN_MSGV3.
message-MSGV4 = IN_MSGV4.
report message
CALL METHOD lo_message_manager->report_element_t100_message
EXPORTING
msg = message
element = in_el_context
cancel_navigation = in_cancel_navigation.
endmethod.
Thank you for your reply Vishal, but I already read context before I give message. Please have a look at my code below.
Do you say something different from this?
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA:
lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
DATA:
lo_nd_tab_molekul_selected TYPE REF TO if_wd_context_node,
lt_tab_molekul_selected TYPE wd_this->elements_tab_molekul_selected,
lo_el_tab_molekul_selected TYPE REF TO if_wd_context_element,
wa_selected TYPE zbyys020,
strfocuscolumn TYPE string,
cmsg TYPE symsgv,
nsure(6) TYPE n ,
itabix TYPE sy-tabix .
DATA: itmp TYPE i,
isure TYPE i..
CLEAR ret_ready .
lo_nd_tab_molekul_selected = wd_context->get_child_node(
name = wd_this->wdctx_tab_molekul_selected ).
lo_nd_tab_molekul_selected->get_static_attributes_table(
IMPORTING table = lt_tab_molekul_selected ).
lo_el_context = wd_context->get_element( ).
lo_api_controller ?= wd_this->wd_get_api( ).
CLEAR: strfocuscolumn, itabix.
LOOP AT lt_tab_molekul_selected INTO wa_selected
WHERE changed IS NOT INITIAL.
itabix = sy-tabix.
IF wa_selected-gecerlibastarih IS INITIAL.
CALL METHOD wd_assist->mesaj_ver
EXPORTING
in_api_controller = lo_api_controller
in_el_context = lo_el_context
in_msgty = 'E'
in_msgno = wd_assist->msg_boskalamaz
in_msgv1 = 'Geçerlilik Başlama Tarihi'.
strfocuscolumn = 'GECERLIBASTARIH'.
EXIT.
ENDIF.
lo_el_tab_molekul_selected =
lo_nd_tab_molekul_selected->get_element( index = sy-tabix ).
lo_el_tab_molekul_selected->set_attribute(
EXPORTING
value = ' '
name = 'CHANGED' ).
ENDLOOP.
IF strfocuscolumn IS NOT INITIAL.
lr_salv_wd_table = wd_this->wd_cpifc_alv_molekul_selected( ).
lr_salv_wd_table->set_focus(
index = itabix
column = strfocuscolumn ).
ELSE.
ret_ready = 'X'.
ENDIF.
Similar Messages
-
How to give a page break in alv grid display after 65 lines are displayed?
hi all,
I need to give a page break in alv grid display after 65 lines are displayed on each page...Please help me with this...hai
give this command beging of the report name... u have to diclar the beging of the report ......
<b>report</b> ( name of the report) <b>standard page heading line-size 200 line-count 65.</b>
ex1.:- report name is rtpm_trl_show_flows
report <b>rtpm_trl_show_flows </b> no standard page heading line-size 200
line-count 65.
ex:2
report <b>zlpur01</b> no standard page heading line-size 200
line-count 65.
type-pools: slis.
tables: bkpf.
selection-screen begin of block sel with frame title text-001.
select-options: s_comp for bkpf-bukrs, " Company
s_valut for bkpf-budat. " Invoice Date
S_MTART FOR MARA-MTART. " Material Type
selection-screen end of block sel.
parameters: p_vari like disvariant-variant. " ALV Variant
constants: formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data: i_bseg type bseg occurs 0 with header line.
data: vatval type p decimals 2 value '0.15'.
data: xhkont type string value '154000'.
data COM type c.
data: begin of invt occurs 100,
budat like bkpf-budat, " Inv Dat
bukrs like bkpf-bukrs, " Material
STCEG like bsak-STCEG, "name of the companycode
belnr like bkpf-belnr,
xblnr like bkpf-xblnr, " Inv Reference
ebeln like rseg-ebeln, " PO number
lifnr like bseg-lifnr, " Vendor No
name1 like lfa1-name1, " Supplier Name
matnr like bseg-matnr,
maktx like makt-maktx,
stcd1 like lfa1-stcd1, " Supplier VAT REG NO
xamt like bseg-dmbtr, " TAX amt
yamt like bseg-wrbtr,
wrbtr like bseg-wrbtr, " Base amount
mwskz like bseg-mwskz,
dmbtr like bseg-dmbtr, " TAX amt
gjahr like bkpf-gjahr,
hkont like bseg-hkont,
zamt like bseg-dmbtr, " TAX amt
wamt like bseg-dmbtr,
shkzg like bseg-shkzg,
shkzg1 like bseg-shkzg,
end of invt.
regard
nawa -
Export TO XXL from ALV Grid - Column order mismatch
Hi All,
The user is trying to download data from Option -> Export -> Spreadsheet which will create XXL.
But while downloading there is mismatch in the order of columns displayed on the alv grid & columns downloaded.
All character fields are displayed on left, then date fields then quantity fields are downloaded to XXL. but in ALV Grid user has chosen a layout in which date fields come first.
Please help me to find solutionGrid display using 'REUSE_ALV_GRID_DISPLAY'. From the alv grid output, user is trying to download data using export -> Excel . so for download there is no custom code.
We have copied standard report and added few more fields to the custom report. strangely Standard report also has this issue.
I searched for SAP notes also..no clue -
alv grid column name could not be displayed fully.we manually want to drag the column,to see the column name fully. for ex. if column name is 'COMPANYNAME'.it shows 'COMPA' alone.
how could i solve this problem....?hI,
Check the below code...
*& Report ZALV_PROGRAAM
REPORT ZALV_PROGRAAM.
TYPE-POOLS SLIS.
DATA : BEGIN OF WA_KNA1,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
END OF WA_KNA1,
IT_KNA1 LIKE TABLE OF WA_KNA1.
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FCAT LIKE LINE OF IT_FCAT.
SELECT KUNNR NAME1 INTO TABLE IT_KNA1 FROM KNA1 UP TO 5 ROWS.
PERFORM FCAT USING '1' 'KUNNR' 'CUSTOMERNUMBER' '40'.
PERFORM FCAT USING '2' 'NAME1' 'CUSTOMERNAME' '40'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
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 =
IT_FIELDCAT = IT_FCAT
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
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_KNA1
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.
*& Form FCAT
text
-->P_0052 text
-->P_0053 text
-->P_0054 text
-->P_0055 text
form FCAT using FP_COL_POS
FP_FIELDNAME
FP_SELTEXT_M
FP_OUTPUTLEN.
WA_FCAT-COL_POS = FP_COL_POS.
WA_FCAT-FIELDNAME = FP_FIELDNAME.
WA_FCAT-SELTEXT_M = FP_SELTEXT_M.
WA_FCAT-OUTPUTLEN = FP_OUTPUTLEN.
APPEND WA_FCAT TO IT_FCAT.
CLEAR WA_FCAT.
endform. " FCAT
thanks,
Thiru. R -
Display 80 characters of PO text in ALV grid column?
Hi Guys,
I just want to display only 80 characters of PO Header text in the ALV grid column and the rest should appear when we move the Mouse on to the each ALV grid'd POtext column. So how is it possible 1st tell me how to display 80 characters of PO text.?
in ME23n u can see the PO header text.
Thanks ,
Gopi.Hi Gopi,
Are you displaying ALV in your custom report and you want to show just 80 char in output?
If this is yes:
You can set ALV column width as 80 CHAR while building field catalog.
Column cell will have complete text but when ALV appears it will first show first 80 char.
thnx,
ags. -
The Visible attribute on alv grid column is not changed after Change Layout
Setup:
I have a program that displays output in an ALV grid (using cl_salv_table).
The ALV grid is displayed within a custom control on a subscreen.
I have 4 subscreens being used on a tabstrip control. So I have 4 ALV grids total (one on each subscreen).
On each ALV grid, I have set the set_layout_change function to true so that the user can hide and unhide columns etc. on each grid via the button on the alv grid toolbar.
I also allow the user to dowload the contents of all 4 grids to excel. To do this I have a custom button that when clicked goes to each ALV grid - gets the column metadata (via cl_salv_columns_table-get() ) and checks the visibility to determine if the column should be downloaded or not (via cl_salv_column-is_visible() ) to excel.
The Problem:
As I said I have 4 grids being displayed via a tab control. Let's say the user is on tab 1 and unhides some columns on the alv grid 1 via the Change Layout... button. And then the user navigates to tab 2. If they click the download button at that point - when the download code is run and it checks the visibility of the columns on alv grid 1 - the changes that were made via the Change Layout... button have not synchronized yet. When I call is_visible() for a column that was unhid it still comes back as false.
The only way I have found to remedy this is to make the user click on a button on the alv grid's toolbar before navigating to a different tab to force the synchronization between the changes made and the backend column metadata. However, this is not the best option and requires training for the user that they have to do this for the download to work correctly.
The Question:
1) why is the Change Layout... button not automatically synchronizing the changes it made to the back end? Is there a way to make it do this?
2) OR, is there a way that I can force the synchronization within the code and not force the user to click a button on the alv grid? If there is a way to force the synchronization - where do I put that code? As far as I can tell, when I switch between tabs - I am unable to catch that action in my PAI events.
Thanks in advance for any help.I was able to resolve this issue with a satisfactory solution.
In my program I had a local class definition to handle the grids' events. When the synchronization wasn't working I only had two events defined: for link_click and added_functions.
I created another definition for event after_salv_function:
on_after_salv_function for event after_salv_function of cl_salv_events importing e_salv_function
There is no code in the method implementation - but adding this event handler now causes a synchronization to occur after the Change Layout is done. -
Editable ALV Grid column behavior under ITS standalone
Hello experts,
I have a straight forward implementation of an ALV Grid with 3 columns. Two columns are display only and the third is editable. My question only involves the editable column and its behavior in a web browser served by a standalone ITS server. The underlying data type is CURR. The enterable amounts are restricted to a format of 9.99. Even so, a web user can accidentally enter a non-numeric value such as 1.x0 . We have coded a data changed event handler to check the input value for expected amounts. The event handler logic readily identifies the non-numeric value and handles the exception. Although we have full control of the internal table value, there are two problems encountered within the web browser interface:
1) We cannot return the cursor to the problem cell to prevent the user from continuing before correcting the problem.
2) We cannot reset/change to displayed value to the original internal table value (it will only refresh after a save or refresh action). So the user has no visual cue that they've entered a bad value unless they pay close attention.
Running the transaction in SAPGUI, we can force the cursor back to the erroneously cell using "CALL METHOD alv_grid->set_scroll_info_via_id" . This technique does not appear to affect the cursor within the web browser.
After searching SDN forums and SAP documentation it appears that there is no way to programmatically control the ALV Grid active cell within the web browser interface. I'm wondering if the experts can confirm this issue? If that is the way it works within the browser interface could members please suggest "user friendly" approaches to notifying the user of a data entry problem? For example, is POPUP_TO_INFORM to only option? Perhaps there is a JavaScript routine that can enforce the edit format? Please keep in mind that the standard ALV Grid techniques that work in SAPGUI don't necessarily behave the same way in the web browser. I'm most interested in advice regarding the web browser using standalone ITS as it will be another year before we can leverage WebDynPro in this scenario.
Thanks and best regards,
GaryHi Gary,
can you please create a short report which recreates the issue and post the ABAP here. The goal is that webgui and SAPGUI behaves the same way. If they don't we will try to fix it.
Best regards,
Klaus -
How to focus a cell on ALV grid display
hi,
I need to set the focus to the first cell on the first row in the ALV grid.I am using object oriented ALV grid control.Can anyone help me out in this regard.
Regards,
Anil.Re: simple Grid display
Have a look at below links. It contains sample code for alv grid.
http://www.erpgenie.com/abap/controls/alvgrid.htm#Complete%20code%20for%20the%20ALV%20grid%20example
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
http://sap.niraj.tripod.com/id64.html
Also have a look at below for OO alv grid:
http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/frameset.htm
-->
ABAP List Viewer
The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
This helps us to implement all the features mentioned very effectively.
Using ALV, We can have three types of reports:
1. Simple Report
2. Block Report
3. Hierarchical Sequential Report
There are some function modules which will enable to produce the above reports without much effort.
All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
1. SIMPLE REPORT.
The important function modules are
a. Reuse_alv_list_display
b. Reuse_alv_fieldcatalog_merge
c. Reuse_alv_events_get
d. Reuse_alv_commentary_write
e. Reuse_alv_grid_display
A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
The important parameters are :
I. Export :
i. I_callback_program : report id
ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status iii. I_callback_user_command : routine where the function codes are handled iv. I_structure name : name of the dictionary table v. Is_layout : structure to set the layout of the report vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
II. Tables :
i. t_outtab : internal table with the data to be output
B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
The Important Parameters are :
I. Export :
i. I_program_name : report id
ii. I_internal_tabname : the internal output table iii. I_inclname : include or the report name where all the dynamic forms are handled.
II Changing
ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is declared in the type pool SLIS.
C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
Parameters :
I. Import :
Et_Events : The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
II. Export :
I_List_type :
0 = simple list REUSE_ALV_LIST_DISPLAY
1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
3 = hierarchical-sequential block list
REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
Parameters :
I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
This internal table has three fields :
Typ : H header, S selection , A - action Key : only when typ is S.
Info : the text to be printed
E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
Parameters : same as reuse_alv_list_display
This is an example for simple list.
2. BLOCK REPORT
This is used to have multiple lists continuously.
The important functions used in this report are:
A. REUSE_ALV_BLOCK_LIST_INIT
B. REUSE_ALV_BLOCK_LIST_APPEND
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
D. REUSE_ALV_BLOCK_LIST_DISPLAY
A. REUSE_ALV_BLOCK_LIST_INIT
Parameters:
I. I_CALLBACK_PROGRAM
II. I_CALLBACK_PF_STATUS_SET
III. I_CALLBACK_USER_COMMAND
This function module is used to set the default gui status etc.
B. REUSE_ALV_BLOCK_LIST_APPEND
Parameters :
Export :
I. is_layout : layout settings for block II. it_fieldcat : field catalog III. i_tabname : internal table name with output data IV. it_events : internal table with all possible events
Tables :
i. t_outtab : internal table with output data.
This function module adds the data to the block.
Repeat this function for all the different blocks to be displayed one after the other.
C. REUSE_ALV_BLOCK_LIST_HS_APPEND
This function module is used for hierarchical sequential blocks.
D. REUSE_ALV_BLOCK_LIST_DISPLAY
Parameters : All the parameters are optional.
This function module display the list with data appended by the above function.
Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
3. Hierarchical reports :
Hierarchical sequential list output.
The function module is
A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
Parameters:
I. Export:
i. I_CALLBACK_PROGRAM
ii. I_CALLBACK_PF_STATUS_SET
iii. I_CALLBACK_USER_COMMAND
iv. IS_LAYOUT
v. IT_FIELDCAT
vi. IT_EVENTS
vii. i_tabname_header : Name of the internal table in the program containing the output data of the highest hierarchy level.
viii. i_tabname_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
ix. is_keyinfo : This structure contains the header and item table field names which link the two tables (shared key).
II. Tables
i. t_outtab_header : Header table with data to be output ii. t_outtab_item : Name of the internal table in the program containing the output data of the lowest hierarchy level.
slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using REUSE_ALV_FIELDCATALOG_MERGE.
Important Attributes :
A. col_pos : position of the column
B. fieldname : internal fieldname
C. tabname : internal table name
D. ref_fieldname : fieldname (dictionary) E. ref_tabname : table (dictionary) F. key(1) : column with key-color G. icon(1) : icon H. symbol(1) : symbol I. checkbox(1) : checkbox J. just(1) : (R)ight (L)eft (C)ent.
K. do_sum(1) : sum up
L. no_out(1) : (O)blig.(X)no out
M. outputlen : output length
N. seltext_l : long key word
O. seltext_m : middle key word
P. seltext_s : short key word
Q. reptext_ddic : heading (ddic)
R. ddictxt(1) : (S)hort (M)iddle (L)ong
S. datatype : datatype
T. hotspot(1) : hotspot
Simple ALV report
http://www.sapgenie.com/abap/controls/alvgrid.htm
http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Go thru these programs they may help u to try on some hands on
ALV Demo program
BCALV_DEMO_HTML
BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode BCALV_GRID_DEMO Simple ALV Control Call Demo Program BCALV_TREE_DEMO Demo for ALV tree control BCALV_TREE_SIMPLE_DEMO BC_ALV_DEMO_HTML_D0100
Reward If useful -
ALV grid - column width doesn't get optimized
Dear SAP friends,
My program displays ALV grid in PBO:
gs_layout-cwidth_opt = 'X'. " optimize column width
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'IT_REPORT_X'
is_layout = gs_layout
is_print = gs_print
it_toolbar_excluding = it_exclude
CHANGING
it_outtab = it_report_x
it_fieldcatalog = gt_fcat.
I have a custom button in the standard toolbar which I use to repopulate the grid if a certain criteria is met. To repopulate the grid I am using method:
CALL METHOD grid1->refresh_table_display.
So on initial display the grid has column width optimized.
But when I do refresh - the columns don't get optimized.
What is wrong?
Thank you,
TatyanaHello Tatyana
It seems that you have to call method go_grid->set_frontend_layout a second time but please do not ask me when and where (PBO vs. PAI, before/after REFRESH_TABLE_DISPLAY).
However, you are definitely on the safe side if you simply call the entire
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'IT_REPORT_X'
is_layout = gs_layout
is_print = gs_print
it_toolbar_excluding = it_exclude
CHANGING
it_outtab = it_report_x
it_fieldcatalog = gt_fcat.
again at PBO. Disadvantage: scroll positions get lost.
Regards
Uwe -
Row seperator in the ALV grid display after the various highest level prod.
Hi,
I have a requirement like user wants a row seperator against the various high level products (Each parent material)in ALV Grid display.We made this change but quantity and pricey fields showing the zero's in the blank line.i know that if we use NO-ZERO
in the ALV field catalog , we can remove the zero's from blank line. But other zerou2019s will remove from rest of the line items. User want's the zero's in other line items, but not in the blank line.
We can convert packed fileds into character format, but this will effect to the summing the quantity, price coumns.
If any body have idea on above mentioned.
Regards,
SK.Hi Suresh,
There is no short cut for this requirement. You have to do following steps.
1. Change the data type of column to char.
2. Programatically find the totals.
Reagards,
Anversha -
ALV Grid - Columns Displays?
Any way to display an ALV grid in different sections?
Meaning, The top half of the report lines up columns differently then the bottom half of the report.
For instance, The first two columns are always the same for all fields, but becuse the rest of the fields are not related to one another in any way the report breaks and displays te columns differently at a certain point in the output of the display?
Thank -YouIn the field catalog give the <b>emphasize</b>.
For first 2 columns:
ls_fcat-emphasize = 'C310'.
For all other columns:
ls_fcat-emphasize = 'C400'.
These make the ALV columns in different colors.
In case if u want to color a particular row or particular cell, do the below things:
Assign a variable celltab TYPE lvc_t_styl, in the internal table which u dispaly the data.
In the layout give, wa_layout-stylefname = 'CELLTAB'.
Modify the final internal table like this sample code:
DATA : lt_celltab TYPE lvc_t_styl,
ls_celltab TYPE lvc_s_styl.
READ TABLE i_final_data INTO wa_final_data INDEX 1.
ls_celltab-fieldname = 'LNG_TYPES'.
ls_celltab-style = '00000060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'LNG_QUANTITY'.
ls_celltab-style = '00003060'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_TYPES'.
ls_celltab-style = '00000666'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
ls_celltab-fieldname = 'NG_QUANTITY'.
ls_celltab-style = '00000066'.
INSERT ls_celltab INTO TABLE lt_celltab.
CLEAR ls_celltab.
wa_final_data-celltab[] = lt_celltab[].
MODIFY i_final_data FROM wa_final_data INDEX 1.
CLEAR: ls_celltab, lt_celltab, wa_final_data.
Here ls_celltab-style = '00003060' will make that particular cell in different color.
Regards,
Prakash.
Message was edited by: Prakash Ramu -
Web Dynpro ALV grid column width
Hi,
I have a web dynpro alv grid that has columns titles that are long. What is the best way of displaying the data without taking up too much space with the titles?
For example is it possible to wrap the title into 2 or 3 rows
Thanks,
SamirHi,
DATA: lr_column type ref to cl_salv_wd_column,
lr_colheader type ref to cl_salv_wd_column_header.
CALL METHOD lrcolumn->get_header
RECEIVING
value = lr_COLHEADER.
lr_COLHEADER->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_short ).
Refer this if_salv_wd_c_ddic_binding in se24 for more.
Regards,
Lekha. -
ALV Grid Column name in multiple rows
Hi,
When ALV Grid is display columns are displayed horizontally in a single line.
Is there ne way to display the column names in 2 rows
e.g : Functional Location column should be shown as
Functional
LocationHi,
Actually it is not possible to disaply in multiple lines.
ALV grid Multiple Header ... ?
Re: Multiple lines in alv column headings
This problem was discussed many times in this forum, u can search for more results.
Message was edited by: Judith Jessie Selvi -
Hello All,
I have to give an F4 help on a column in ALV grid.
I have used fieldcatlog-REF_TABNAME = 'MARA' and fieldcatlog-rollname = 'PSTAT_D' for F1 help in ALV report.
This somehow is not working.Please guide me to resolve the issue so that the f1 help from MARA-PSTAT is available in Report.
Thank you.
Edited by: sanjay_123 on Nov 2, 2009 8:49 AMTry this sample:
DATA: BEGIN OF itab OCCURS 0,
matnr LIKE mara-matnr,
pstat LIKE mara-pstat,
END OF itab,
fcat TYPE lvc_t_fcat,
hcat TYPE lvc_s_fcat.
START-OF-SELECTION.
" Get data
SELECT matnr pstat FROM mara INTO TABLE itab UP TO 20 ROWS.
IF sy-subrc NE 0.
EXIT.
ENDIF.
END-OF-SELECTION.
" Create fieldcatalog
CLEAR hcat.
hcat-col_pos = 1.
hcat-fieldname = 'MATNR'.
hcat-scrtext_m = 'Material'.
hcat-ref_table = 'MARA'.
hcat-ref_field = 'MATNR'.
APPEND hcat TO fcat.
CLEAR hcat.
hcat-col_pos = 2.
hcat-fieldname = 'PSTAT'.
hcat-scrtext_m = 'Status'.
hcat-ref_table = 'MARA'.
hcat-ref_field = 'PSTAT'.
APPEND hcat TO fcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
it_fieldcat_lvc = fcat
TABLES
t_outtab = itab. -
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.
Maybe you are looking for
-
Flv player works locally but not when uploaded
Another day, another issue... I have a flash movie that includes an flv player with previews and buttons. It reads the content from an xml file. It works without problem when I test it locally. Trouble is when I upload it, everything displays correct
-
All of a sudden, itunes 10.5.0.142 keeps restarting itself on Windows 7. I did not change any configuration settings on Windows. How can I disable this? Thanks
-
Can't minimize metadata exporting from Lightroom 1.4.1
I want to strip out EXIF camera metadata when I prepare TIFF images for clients. I've tried setting the "Minimize Embedded Metadata" toggle in the Export dialogue of Lightroom 1.4.1, but this only works when I am exporting JPGS, not with TIFF or PSD
-
PDF to Web Screen Issue?
We are in a test system and in the SAP logic I successfully see the PDF data going into output. However, when I go to display the PDF from the Web transaction, the screen just seems to lockup, then when I tyry to go to another screen within our order
-
Why is my iPhone not responding even after restoring
some one please help me !