Hiding a field in ALV Display
Hi Experts,
How can we hide a field in the ALV Dipslay.
hi check this ....
here i had 3 fields and i am displaying 2 only..
REPORT ZPR_02 no standard page heading.
TYPE-POOLS: SLIS.
TABLES: MARA.
DATA: BEGIN OF IT_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
MTART LIKE MARA-MTART,
MATKL LIKE MARA-MATKL,
check type c,
END OF IT_MARA.
DATA: IT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELD_CAT TYPE SLIS_FIELDCAT_ALV,
IT_EVENTS TYPE SLIS_T_EVENT,
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
wa_layout type SLIS_LAYOUT_ALV.
data : is_variant like disvariant.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM BUILD_FIELD_CAT.
PERFORM GET_EVENTS.
PERFORM DISPLAY_DATA.
*& Form get_data
text
FORM GET_DATA .
SELECT MATNR
MTART
MATKL FROM MARA
INTO TABLE IT_MARA
WHERE MATNR IN S_MATNR.
ENDFORM. " get_data
*& Form build_field_cat
text
FORM BUILD_FIELD_CAT .
CLEAR WA_FIELD_CAT.
WA_FIELD_CAT-COL_POS = 4.
WA_FIELD_CAT-FIELDNAME = 'MATNR'.
WA_FIELD_CAT-SELTEXT_L = 'Material Number'.
WA_FIELD_cat-no_zero = 'X'.
WA_FIELD_CAT-emphasize = 'C100'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
clear WA_FIELD_CAT.
WA_FIELD_CAT-COL_POS = 2.
WA_FIELD_CAT-FIELDNAME = 'MTART'.
WA_FIELD_CAT-SELTEXT_L = 'Material Type'.
WA_FIELD_CAT-no_out = 'X'.
WA_FIELD_CAT-emphasize = 'C110'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
clear WA_FIELD_CAT.
WA_FIELD_CAT-COL_POS = 3.
WA_FIELD_CAT-FIELDNAME = 'MATKL'.
WA_FIELD_CAT-SELTEXT_L = 'Material Group'.
WA_FIELD_CAT-JUST = 'R'.
WA_FIELD_CAT-emphasize = 'C410'.
APPEND WA_FIELD_CAT TO IT_FIELD_CAT.
clear WA_FIELD_CAT.
ENDFORM. " build_field_cat
*& Form display_data
text
FORM DISPLAY_DATA .
wa_layout-box_fieldname = 'CHECK'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'GUI_SET'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELD_CAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_MARA.
ENDFORM. " display_data
*& Form GUI_SET
FORM GUI_SET USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'A000'.
ENDFORM. "GUI_SET
*& Form USER_COMMAND
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
R_SELFIELD TYPE SLIS_SELFIELD.
*refresh itab.
CASE R_UCOMM.
WHEN 'TEST'.
when 'LIST'.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form get_events
text
FORM GET_EVENTS .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENTS .
READ TABLE IT_EVENTS INTO WA_EVENTS
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE.
IF SY-SUBRC = 0.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
ENDIF.
ENDFORM. " get_events
*& Form top_of_page
text
FORM TOP_OF_PAGE.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Material Data'.
APPEND WA_HEADER TO IT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER
I_LOGO = I_LOGO
I_END_OF_LIST_GRID = I_END_OF_LIST_GRID
I_ALV_FORM = I_ALV_FORM
ENDFORM. "top_of_page
regards,
venkat.
Similar Messages
-
Hide a field in ALV "Display Details" list
Hi Experts,
I have a requirment where I have to hide a field in ALV output, as well as in "Details display". I already put NO_OUT = 'X' for that field in fieldcatalog itself. It is hidden in the ALV output anyway, but the problem is when user selects a row and clicks on "Details" button in toolbar of ALV, it still displays the hidden fields of that ALV list with/out headings there.
Hope you understood my problem, pls respond soon if you hav any solution for this?
Thanks
SaravUse TECH = 'X' in field catalog.
Regards,
Raymond -
F4 for Editable field in ALV, display Name but capture ID
Hi Friends,
I have a ALV for which i have defined a Structure, which is passed to Fieldcatlog.
I have defined a Search help - ZUSER_NAME which has following fields to display.
USERID - USR02-BNAME
FNAME
LNAME
FULLNAME
So my structure for fieldcatalog has User-id which is linked to this search help with Domain XUBNAME.
So in my report i made this User-Id as editable and F4 available, everything is working fine.
when user does a F4, its displaying Userid,Fname,Lname and complete name.upon selection and save i am capturing the id and storing in the ztable.
But now i have a requirement that when user selects a value from this search help on F4, i need to display Fullname but capture the User Id. How can i do that?
This is something similar to the one we have in BSP- key-value pair.
how to do this in ALV.
Appreciate if someone can guide me thru.
Thanks,
Simha
Edited by: Simha on Sep 6, 2008 2:24 PMhai , this is example code for editing the F4 display .. check out this
REPORT zalv_editf4display.
*Type pools for alv
TYPE-POOLS : slis.
*structure for t582a tbale
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_table.
*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
zrmkz TYPE dzrmkz,
zeitb TYPE dzeitb,
dname TYPE dianm,
davo TYPE davo,
davoe TYPE davoe,
END OF ty_output.
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_pbo TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
*Data declarations for dropdown lists for f4
DATA: it_dropdown TYPE lvc_t_drop,
ty_dropdown TYPE lvc_s_drop,
*data declaration for refreshing of alv
stable TYPE lvc_s_stbl.
*Global variable declaration
DATA: gstring TYPE c.
*Data declarations for ALV
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout
*ok code declaration
DATA:
ok_code TYPE ui_func.
*initialization event
INITIALIZATION.
*start of selection event
START-OF-SELECTION.
*select the infotypes maintained
SELECT infty
pnnnn
zrmkz
zeitb
dname
davo
davoe
FROM t582a UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE it_table.
*Select the infotype texts
IF it_table[] IS NOT INITIAL.
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
ENDIF.
*Apppending the data to the internal table of ALV output
LOOP AT it_table INTO wa_table.
wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
wa_output-zrmkz = wa_table-zrmkz.
wa_output-zeitb = wa_table-zeitb.
wa_output-dname = wa_table-dname.
wa_output-davo = wa_table-davo.
wa_output-davoe = wa_table-davoe.
For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
APPEND wa_output TO it_output.
CLEAR wa_output.
ENDLOOP.
Calling the ALV screen with custom container
CALL SCREEN 0600.
*On this statement double click it takes you to the screen painter SE51.
*Enter the attributes
*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
*create 2 buttons with function code 'SAVE' and 'EXIT'.
GIVE A SUITABLE TITLE
*& Module STATUS_0600 OUTPUT
text
MODULE status_0600 OUTPUT.
SET PF-STATUS 'DISP'.
SET TITLEBAR 'ALVF4'.
ENDMODULE. " STATUS_0600 OUTPUT
calling the PBO module ALV_GRID.
*& Module PBO OUTPUT
text
MODULE pbo OUTPUT.
*Creating objects of the container
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CCONT'.
create object for alv grid
create object c_alvgd
exporting
i_parent = c_ccont.
SET field for ALV
PERFORM alv_build_fieldcat.
Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
CHECK NOT c_alvgd IS INITIAL.
Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
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.
ENDMODULE. " PBO OUTPUT
*& Form alv_build_fieldcat
text
<--P_IT_FCAT text
*subroutine to build fieldcat
FORM alv_build_fieldcat.
DATA lv_fldcat TYPE lvc_s_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '5'.
lv_fldcat-fieldname = 'ZRMKZ'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 1.
lv_fldcat-scrtext_m = 'PERIOD'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '6'.
lv_fldcat-fieldname = 'ZEITB'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 5.
lv_fldcat-scrtext_m = 'Time constraint'.
lv_fldcat-edit = 'X'.
*To avail the existing F4 help these are to
*be given in the field catalogue
lv_fldcat-f4availabl = 'X'.
lv_fldcat-ref_table = 'T582A'.
lv_fldcat-ref_field = 'ZEITB'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '7'.
lv_fldcat-fieldname = 'DNAME'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Dialogmodule'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '8'.
lv_fldcat-fieldname = 'DAVO'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Start'.
lv_fldcat-edit = 'X'.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '9'.
lv_fldcat-fieldname = 'DAVOE'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'End'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
CLEAR lv_fldcat.
*To create drop down for the field 'DAVO'
with our own f4 help
ty_dropdown-handle = '1'.
ty_dropdown-value = ' '.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '1'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '2'.
APPEND ty_dropdown TO it_dropdown.
ty_dropdown-handle = '1'.
ty_dropdown-value = '3'.
APPEND ty_dropdown TO it_dropdown.
CALL METHOD c_alvgd->set_drop_down_table
EXPORTING
it_drop_down = it_dropdown.
LOOP AT it_fcat INTO lv_fldcat.
CASE lv_fldcat-fieldname.
To assign dropdown in the fieldcataogue
WHEN 'DAVO'.
lv_fldcat-drdn_hndl = '1'.
lv_fldcat-outputlen = 15.
MODIFY it_fcat FROM lv_fldcat.
ENDCASE.
ENDLOOP.
ENDFORM. " alv_build_fieldcat
*& Form alv_report_layout
text
<--P_IT_LAYOUT text
*Subroutine for setting alv layout
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-col_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes
*and based on the user command we can do the coding.
*& Module PAI INPUT
text
MODULE pai INPUT.
*To change the existing values and refresh the grid
*And only values in the dropdown or in the default
*F4 can be given , else no action takes place for the dropdown
*and error is thrown for the default F4 help and font changes to red
*and on still saving, value is not changed
c_alvgd->check_changed_data( ).
*Based on the user input
*When user clicks 'SAVE;
CASE ok_code.
WHEN 'SAVE'.
*A pop up is called to confirm the saving of changed data
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'SAVING DATA'
text_question = 'Continue?'
icon_button_1 = 'icon_booking_ok'
IMPORTING
answer = gstring
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*When the User clicks 'YES'
IF ( gstring = '1' ).
MESSAGE 'Saved' TYPE 'S'.
*Now the changed data is stored in the it_pbo internal table
it_pbo = it_output.
*Subroutine to display the ALV with changed data.
PERFORM redisplay.
ELSE.
*When user clicks NO or Cancel
MESSAGE 'Not Saved' TYPE 'S'.
ENDIF.
**When the user clicks the 'EXIT; he is out
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
CLEAR: ok_code.
ENDMODULE. " PAI INPUT
*& Form REDISPLAY
text
--> p1 text
<-- p2 text
FORM redisplay .
*Cells of the alv are made non editable after entering OK to save
CALL METHOD c_alvgd->set_ready_for_input
EXPORTING
i_ready_for_input = 0.
*Row and column of the alv are refreshed after changing values
stable-row = 'X'.
stable-col = 'X'.
*REfreshed ALV display with the changed values
*This ALV is non editable and contains new values
CALL METHOD c_alvgd->refresh_table_display
EXPORTING
is_stable = stable
EXCEPTIONS
finished = 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. " REDISPLAY -
Hi all.
we are phasing a problem.
I am using alv to display in output.
I am using a Quantiti field (BDMNG),.
in this field if nodata is there then it is showing 0.000(that is the default value).
I don't want those zeros.I want only space(blank only).
Can any body help me to solve this issue.
Thanks in advance
Eswar.Hai,
While building field catalog For quantity field Set the NO-ZERO attribute to 'X'.
Or you can change the quantity filed to character in the alv display.
Mark points if helpful.
Regards,
Umasankar -
Hiding some fields from ALV report
Hi All,
I want to know if there is way to hide certain fields in ALV for some users only and not for others?
If I use the option NO_OUT = 'X' it will not be displayed in the list but the user can see the in the Layout option fields but if use NO_OUT = 'X' and TECH = 'X' the field will not be in the list and in the layout also but other users will miss that field.
If I create user specific variant, but once the user is in the report he can change the layout so certain fields cannot be hidden.
So, is there any way to hide some fields for certain users and not for others without hard coding user ids in program and restricting the fields from display??
Thanks in Advance.
Sonali.Thank You Vijay for the reply.
I knew that Authorization object was the final solution but before using it I wanted to find out if there was a way in the ALV report to restrict certain fields.
Sonali. -
Leading zero for a character datatype field in ALV display
I have field access sequence value(VAKEY) which is concatenated by sales org, distibution chnl and division
(0100/01/01). the field is populating proprerly in internal tables, but in ALV display it is displaying as 100/01/01. How to consider leading zero in ALV for a CHAR datatype field.
Thanks in Advance.Hi Srnii,
You can use the below sample statement
Shift mara-matnr right deleting trailing ' '.
overlay mara-matnr with '0000000'.
Thanks,
Chidanand -
Reading fields from ALV display
Hi All,
I have a check box in front of each data record in the ALV display. This check box is editable. The user will check some records after seeing the details and click on a puch button provided. On the click of this button I need to read all the records whose check box has been checked.
However, this edited value of check box is not getting reflected in the program. Is there any FM or any other method through which I can read the changed values in the ALV display ??
Request your urgent help.
Thanks and Regards,
Archana.Hi ,
Please see this example program - BCALV_EDIT_05
I am sure this will help you.
If u have used standard ALV function module(REUSE_ALV_GRID_DISPLAY) instead of class cl_gui_alv_grid , then you can set layout and fieldcatalog accordinglly.
dont forget to add filed
checkbox type c.
in your display table (itab).
fieldcatalog setting :
for field : 'CHECKBOX'.
<b> ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.</b>
In user command subroutine :
check displayed internal table (itab here)
u will find the checkbox-checked record has itab-checkbox = 'X' .
Regards,
Mihir. -
Hi
i have created an ALV with series group 20(domestic) and 21(export).my question is that i need a field NETWRIC when i select the series group 21 in the input field and i dnt need it when i use 20 in series group.i like to know is there any way to hide the fieldHi,
You can do as below :
Once your fieldcatalog is build.
loop at gt_fieldcat into gs_fieldcat.
if group = 'X'.
if gs_fieldcat-fieldname = 'NETWRIC'.
gs_fieldcat-no_out = 'X'.
gs_fieldcat-tech = 'X'. "Using this column will not be displayed in change layout also.
modify gt_fieldcat from gs_fieldcat.
clear : gt_fieldcat, gs_fieldcat.
endif.
endif.
endloop.
Thanks,
Sriram Ponna. -
Hello Guys,
I'm using 'REUSE_ALV_GRID_DISPLAY' in my prog.
There is a field in output table which is of type P(8) Decimals 3.
When I'm trying to get the sum of this field in ALV Display it gives the message " Desired operation cannot be performed for column 'Converted Quantity' ".
I have also tried do_sum = 'X'.
But it is not working. Please help guys.
Regards,
AbhinavThanks a lot guys for your inputs.
The program is working now.
Now I'm using :
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'QUAN'.
* wa_fieldcat-ref_tabname = 'I_OUT2'.
* wa_fieldcat-tabname = 'I_OUT2'.
wa_fieldcat-qfieldname = 'MEAS'.
wa_fieldcat-qtabname = 'I_OUT2'.
wa_fieldcat-outputlen = '15'.
wa_fieldcat-seltext_l = text-052.
APPEND wa_fieldcat TO i_fieldcat.
The program is working fine now.
I have commented tabname and -ref_tabname , and the program is working fine now.
Thanks a lot. -
Hiding Fields in ALV-Grid Display
Hi Experts,
Can anybody help me on the below logic?
I have 16 different transactions in GLPCT Table. Based on given Period(1 to 16 in Select Options), these transactions(HSL01, HSL02...HSL16) should get display. Other than entered Period, Fields should be Hidden inthe output.
Currently, I am populating all the Sixteen Fields.
I am finding difficulty in doing this.
Thanks
PraveenHello,
Based on the periods selected, you need to mark the redundant fields as "technical". Based on the ALV display technique this is what you've to do:
1. REUSE* FMs & GUI ALV Grid Class :
it_fieldcat-tech = 'X'.
2. SALV Class:
CL_SALV_COLUMN->SET_TECHNICAL(IF_SALV_C_BOOL_SAP=>TRUE).
Check the forums for further details.
BR,
Suhas -
New ALV field is not displaying
Hi
I have added the currency field in the existing ALV report.
The final internal table having the currency field and it has value. Curreny field is not displaying in output. Pls help
Below is my ALV code for currency.
PERFORM FILL_FIELDCAT USING
'WAERS' SPACE SPACE 'CURRENCY' 'CURRENCY' 'CURRENCY'.
READ TABLE GIT_FIELDCAT INTO LX_FIELDCAT
WITH KEY FIELDNAME = 'WAERS' .
LX_FIELDCAT-OUTPUTLEN = 5.
LX_FIELDCAT-JUST = 'L'.
MODIFY GIT_FIELDCAT FROM LX_FIELDCAT INDEX SY-TABIX.
FORM FILL_FIELDCAT USING P_FIELDNAME
P_NO_OUT
P_DO_SUM
P_SELTEXT_S
P_SELTEXT_M
P_SELTEXT_L. "#EC *
DATA: LX_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR LX_FIELDCAT.
LX_FIELDCAT-TABNAME = 'GIT_LIST'.
LX_FIELDCAT-FIELDNAME = P_FIELDNAME.
LX_FIELDCAT-NO_OUT = P_NO_OUT.
LX_FIELDCAT-DO_SUM = P_DO_SUM.
LX_FIELDCAT-SELTEXT_S = P_SELTEXT_S.
LX_FIELDCAT-SELTEXT_M = P_SELTEXT_M.
LX_FIELDCAT-SELTEXT_L = P_SELTEXT_L.
APPEND LX_FIELDCAT TO GIT_FIELDCAT.
ENDFORM. " FILL_FIELDCATYou have to [maintain maintenance dialog|http://help.sap.com/SAPHELP_NWPI71/helpdata/EN/a7/513484407a11d1893b0000e8323c4f/frameset.htm] as described in the link.
Regards,
Raymond -
How to display date field in ALV in format 'YYYY-MM-DD'?
Hi experts,
I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
Tried with the edit mask
LVC_S_FCAT-EDIT_MASK = '____-__-__' but it does not work.
I could not find the conversion routine for this. Is it possible to write customer conversion routine?
I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
PLEASE ANY HELP!
Kind regards,
DanijelaHi,
Use FM FORMAT_DATE_4_OUTPUT.
TYPE-POOLS : slis, KKBLO.
TYPES: BEGIN OF t_data,
sel TYPE char1,
matnr TYPE matnr,
bldat type char10,
END OF t_data.
DATA: it_tab TYPE STANDARD TABLE OF t_data,
it_fcat TYPE slis_t_fieldcat_alv.
DATA: wa_tab TYPE t_data,
wa_fcat TYPE slis_fieldcat_alv,
wa_layout type SLIS_LAYOUT_ALV.
data: lv_repid TYPE syrepid.
data : lv_date type NLEI-IBGDT,
lv_outdate type RN1DATUM-DATEX,
lv_format type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
lv_repid = sy-repid.
lv_date = sy-datum.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000001'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 1.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000002'.
APPEND wa_tab TO it_tab.
lv_date = sy-datum + 2.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = lv_date
format = lv_format
IMPORTING
DATEX = lv_outdate.
move lv_outdate to wa_tab-bldat.
wa_tab-matnr = '0000003'.
APPEND wa_tab TO it_tab.
wa_fcat-fieldname = 'SEL'.
wa_fcat-ref_fieldname = 'XCHPF'.
wa_fcat-ref_tabname = 'MARA'.
wa_fcat-edit = 'X'.
wa_fcat-checkbox = 'X'.
APPEND wa_fcat TO it_fcat.
CLEAR : wa_fcat.
wa_fcat-fieldname = 'MATNR'.
wa_fcat-ref_fieldname = 'MATNR'.
wa_fcat-ref_tabname = 'MARA'.
APPEND wa_fcat TO it_fcat.
CLEAR : wa_fcat.
wa_fcat-fieldname = 'BLDAT'.
wa_fcat-ref_fieldname = 'BLDAT'.
wa_fcat-ref_tabname = 'BKPF'.
APPEND wa_fcat TO it_fcat.
call 'REUSE_ALV_GRID_DISPLAY'' after this
Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
Edited by: Ankur Parab on Oct 1, 2009 2:51 PM -
Total for a Numeric field in ALV Grid display
Hi all,
I am not getting the Total for a Numeric field in ALV Grid output. What might be the problem.
Regards,
Balavardhan.KCheck this code for subtotals and totals..
REPORT ZYFI_REPT007
NO STANDARD PAGE HEADING
LINE-SIZE 300
LINE-COUNT 50
MESSAGE-ID ZYFI.
TABLES : COOI, " Commitments Management: Line Items
LFA1, " Vendor master (general section)
VBEP,
RKPLN.
TABLE TYPES AND INTERNAL TABLES *
DATA : BEGIN OF TYP_COOI ,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
END OF TYP_COOI.
DATA : BEGIN OF TYP_LFA1 ,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF TYP_LFA1.
DATA : BEGIN OF IT_OUTTAB OCCURS 0,
OBJNR LIKE COOI-OBJNR,
SAKTO LIKE COOI-SAKTO,
MEGBTR LIKE COOI-MEGBTR,
MEINH LIKE COOI-MEINH,
WKGBTR LIKE COOI-WKGBTR,
REFBN LIKE COOI-REFBN,
RFPOS LIKE COOI-RFPOS,
SGTXT LIKE COOI-SGTXT,
BUDAT LIKE COOI-BUDAT,
LIFNR LIKE COOI-LIFNR,
NAME1 LIKE LFA1-NAME1,
END OF IT_OUTTAB.
DATA : IT_COOI LIKE TYP_COOI OCCURS 0 WITH HEADER LINE,
IT_LFA1 LIKE TYP_LFA1 OCCURS 0 WITH HEADER LINE.
*-- ALV Declarations
TYPE-POOLS SLIS.
DATA: IT_EVENTS TYPE SLIS_T_EVENT,
GS_EVENT TYPE SLIS_ALV_EVENT,
wa_fldcat type slis_fieldcat_alv.
DATA: S_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_PRINT TYPE SLIS_PRINT_ALV.
DATA: IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: IT_SORT TYPE SLIS_T_SORTINFO_ALV.
DATA: V_REPID LIKE SY-REPID.
SELECTION SCREEN *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_KOKRS FOR COOI-KOKRS NO-EXTENSION NO INTERVALS,
" Controlling Area
S_BUKRS FOR COOI-BUKRS NO-EXTENSION NO INTERVALS,
" Company code
S_GJAHR FOR COOI-GJAHR NO-EXTENSION NO INTERVALS,
" Fiscal Year
S_OBJNR FOR RKPLN-AUFNR MATCHCODE OBJECT ORDE,
" Internal order
S_SAKTO FOR COOI-SAKTO MATCHCODE OBJECT KART,
" Cost Element
S_BUDAT FOR COOI-BUDAT, " Debit Date
S_LIFNR FOR COOI-LIFNR. " Vendor
SELECTION-SCREEN END OF BLOCK B1.
S T A R T O F S E L E C T I O N *
START-OF-SELECTION.
*-- Read data
PERFORM GET_DATA.
E N D O F S E L E C T I O N *
END-OF-SELECTION.
*-- Process the data and prepare the output data
PERFORM CALCULATE_FINAL_INFO.
*--Display Report output
PERFORM DISPLAY_REPORT.
FORM CALCULATE_FINAL_INFO *
Process the data and prepare final internal table *
FORM CALCULATE_FINAL_INFO.
DATA : L_OBJNR LIKE COOI-OBJNR.
SORT IT_LFA1 BY LIFNR.
DELETE ADJACENT DUPLICATES FROM IT_LFA1 COMPARING LIFNR.
LOOP AT IT_COOI.
L_OBJNR = IT_COOI-OBJNR+2(20).
SHIFT L_OBJNR LEFT DELETING LEADING '0'.
IF L_OBJNR IN S_OBJNR.
READ TABLE IT_LFA1 WITH KEY LIFNR = IT_COOI-LIFNR.
IF SY-SUBRC EQ 0.
IT_OUTTAB-NAME1 = IT_LFA1-NAME1.
ENDIF.
MOVE-CORRESPONDING IT_COOI TO IT_OUTTAB.
CLEAR IT_OUTTAB-OBJNR.
IT_OUTTAB-OBJNR = L_OBJNR.
APPEND IT_OUTTAB.
CLEAR IT_OUTTAB.
CLEAR IT_LFA1.
CLEAR L_OBJNR.
ENDIF.
ENDLOOP.
ENDFORM.
*& Form GET_DATA
Fetch the Data from the table COOI and LFA1
FORM GET_DATA.
SELECT OBJNR
SAKTO
MEGBTR
MEINH
WKGBTR
REFBN
RFPOS
SGTXT
BUDAT
LIFNR
FROM COOI
INTO TABLE IT_COOI
WHERE BUDAT IN S_BUDAT
AND LIFNR IN S_LIFNR
AND KOKRS IN S_KOKRS
AND BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR
AND SAKTO IN S_SAKTO.
IF SY-SUBRC EQ 0 .
Get the Vendor name from LFA1
SELECT LIFNR
NAME1
FROM LFA1
INTO TABLE IT_LFA1
FOR ALL ENTRIES IN IT_COOI
WHERE LIFNR EQ IT_COOI-LIFNR.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " GET_DATA
*& Form DISPLAY_REPORT
Display the output
FORM DISPLAY_REPORT.
PERFORM BUILD_CATALOG.
PERFORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS.
IF NOT IT_OUTTAB[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FLDCAT
IT_SORT = IT_SORT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ELSE.
MESSAGE I999 WITH TEXT-013.
ENDIF.
ENDFORM. " DISPLAY_REPORT
*& Form BUILD_CATALOG
Build the Field catalog for the ALV Report
FORM BUILD_CATALOG.
DATA: V_INDEX LIKE SY-TABIX.
V_REPID = SY-REPID.
DATA: LS_SORT TYPE SLIS_SORTINFO_ALV.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = V_REPID
I_INTERNAL_TABNAME = 'IT_OUTTAB'
I_INCLNAME = V_REPID
CHANGING
CT_FIELDCAT = IT_FLDCAT
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_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.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'WKGBTR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-DO_SUM = 'X'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
READ TABLE IT_FLDCAT WITH KEY FIELDNAME = 'OBJNR'
TABNAME = 'IT_OUTTAB' INTO WA_FLDCAT.
IF SY-SUBRC EQ 0.
WA_FLDCAT-SELTEXT_L = 'Order'.
WA_FLDCAT-COL_POS = 1.
WA_FLDCAT-DDICTXT = 'L'.
MODIFY IT_FLDCAT FROM WA_FLDCAT INDEX SY-TABIX.
ENDIF.
LS_SORT-FIELDNAME = 'OBJNR'.
LS_SORT-SPOS = 1.
LS_SORT-UP = 'X'.
LS_SORT-SUBTOT = 'X'.
APPEND LS_SORT TO IT_SORT.
ENDFORM. " BUILD_CATALOG
*& Form FRM_PREPARE_EVENT_LIST
Build the Events
FORM FRM_PREPARE_EVENT_LIST TABLES IT_EVENTS TYPE SLIS_T_EVENT.
CLEAR GS_EVENT.
GS_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
GS_EVENT-FORM = 'TOP_OF_PAGE_REPORT'.
APPEND GS_EVENT TO IT_EVENTS.
ENDFORM. " FRM_PREPARE_EVENT_LIST
TOP OF PAGE
FORM TOP_OF_PAGE_REPORT.
CALL FUNCTION 'Z_YREPORT_HEADER'
EXPORTING
DL_TITLE = SY-TITLE
DL_REPID = SY-CPROG
DL_LINSZ = SY-LINSZ
EXCEPTIONS
OTHERS = 1.
ENDFORM. " FRM_TOP_OF_PAGE_REPORT
*& Form USER_COMMAND
Drill Down Functionality to Call the Transaction ME23
FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM
P_SELFIELD TYPE SLIS_SELFIELD.
DATA : L_INDEX LIKE SY-INDEX,
L_REFBN LIKE COOI-REFBN.
L_INDEX = P_SELFIELD-TABINDEX. " holds the selected table index
CLEAR L_REFBN.
CASE P_UCOMM.
*-- On Double Click
WHEN '&IC1'.
CLEAR L_REFBN.
*-- Read the Current Line
READ TABLE IT_OUTTAB INDEX L_INDEX.
IF SY-SUBRC EQ 0.
L_REFBN = IT_OUTTAB-REFBN.
IF NOT L_REFBN IS INITIAL.
*-- Set the BES Paramater Id to the Current line Purchase Order Number
SET PARAMETER ID 'BES' FIELD L_REFBN.
*-- Call the Transaction Purchase Order Display with the above PO Number
CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
ENDIF.
ELSE.
MESSAGE E999 WITH TEXT-014.
ENDIF.
ENDCASE.
ENDFORM. " USER_COMMAND -
hi,
in report program using alv grid display. i want to hide some fields. i used no_out = 'x'. for that field.
but it displays the data in grid display.
i want to select from hidden fields then display the values in grid display.
please reply me.Hai Suresh,
You declare all the field catalog in your program.
Run the report, in ALV display what r the field u want to hide those field you can choose and right click and hide it. And this layout u save as a default layout.
OR
In display click layout button and what r the field u want to hide those field move to Hidden Columns. And save the layout as default layout.
Thanks,
Durai.V -
Editable field in alv list display
i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........
HI,
Please refer the link below:
http://www.****************/Tutorials/ALV/Edit/demo.htm
http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
Thanks,
Sriram Ponna.
Maybe you are looking for
-
How to use different pageFormats while printing in the same book object.
Hi All, I m able to print Multiple pages, but the problem is when i want print multple pages with different pageformates I mean One pages having 4X2" size and another one is 5X5", while print second page objects not appears properly Pls see the below
-
i upload iPhone pics to Shutterfly, which gives me a "low resolution" warning and blurry prints. Does anyone know how to enhance resolution/printing quality of iPhone pictures? iPhone 5
-
XP doesn't work - ME does!!
have the following problem when connecting my 20G 4th Generation iPod. It was 1 week out of warranty (typical!!) when I noticed I couldn't connect to my HP laptop with XP home edition and iTunes 7. I get the message "iTunes has detected an iPod that
-
Apex 4.2 Integration with EBS R12.1.1
Hi Guys, We followed the document "Oracle Applications Express The Fast Way to Extend the Oracle E-Business Suite By Rod West, Cabot Consulting [http://www.oracle.com/technetwork/developer-tools/apex/apex-ebs-wp-cabot-consulting-169064.pdf] After doi
-
Hi all., Here i am using TAXINN tax procedure ,in standard sap tell do not maintained the any condition type in tax default information in basic setting at tax goods on movement in logistics general for CIN details. That's why i have not maintained t