Unhide a column in ALV grid - sap

I have two SAP systems with the same program.
The column Nome 2 is displayed in the ALV grid of the system1 but in the ALV grid of the system2 is hidden and when select the details you could see the Nome 2 value in both sistems.
The program uses field catalog to pass a list of fields to display in ALV, and also uses the function 'REUSE_ALV_GRID_DISPLAY'.
I would be very pleased if someone have any suggestions that could solve it.
Regards,
Nataly

Check the no-out property of fieldcatalog in system 1. It seems to be enabled there:
You suppose to search lines like this:
IF T_FIELDCAT-FIELDNAME = 'NOME1'.
T_FIELDCAT-NO_OUT = 'X'.
MODIFY T_FIELDCAT INDEX sy-tabix.
ENDLOOP.
Remove NO-OUT line and voilá!

Related

Problem with Enable/Disable a button on SALV Full Screen

Dear all I need your help on the below desperately.
I have created an ALV from SALV and I have copied a GUI Status SALV_STANDARD from a standard program. Firstly I added 2 buttons the POSTNEW & POSTDIFF and after a day I added the SELECT button.
Depending on the selection of the user I want to enable or disable the buttons according to the business requirements.
I have this code in a procedure:
r_alv type reference CL_SALV_TABLE.
if status_name is not initial and report_name is not initial.
set pf-status status_name.
r_alv->set_screen_status(
pfstatus = status_name
report = report_name
set_functions = r_alv->c_functions_all ).
endif.
data: lit_functions_list type salv_t_ui_func,
lwa_functions_list like line of lit_functions_list.
r_functions = r_alv->get_functions( ). "Get Toolbar functions
lit_functions_list = r_functions->get_functions( ).
if i_button_name is not initial.
** Now hide the BUTTON
loop at lit_functions_list into lwa_functions_list.
if lwa_functions_list-r_function->get_name( ) = i_button_name.
lwa_functions_list-r_function->set_visible( i_button_visable ).
endif.
endloop.
endif.
The variables status_name, report_name, i_button_name and i_button_visable are parameters of the procedure and I think that their names show what they are carrying.
The internal table lit_functions_list has 60 records and the last 2 have data for the first 2 buttons and this is the reason that I can enable/disable them.
But there is no record with my 3rd button SELECT. Instead there is a record with the button MYFUNCTION which I have already deleted.
Can someone tell me what to do in order to have the 3rd button available in the lit_functions_list?
Can someone tell me why this itab has so many garbages?
Thanks in advance
Elias
Even I had the same problem. After I ran the report BALVBUFDEL it solved the issue.
Newly created buttons now coming inside the function list ..
lit_functions_list = r_functions->get_functions( ).
For Adding 3rd button in the lit_functions_list, You can use below code.
r_functions->set_function( NAME = 'BUT3' BOOLEAN = 'X' ).
you can also use add_function to add new button.
try.
r_functions->add_function(
name = 'BUT3'
icon = l_icon
text = l_text
tooltip = l_text
position = if_salv_c_function_position=>right_of_salv_functions ).
catch cx_salv_existing cx_salv_wrong_call.
endtry.
itab does not have garbage. It contains all the data related to status like menu bar, application tool bar and function keys.
Finally I found the answer at least to my problem. Let me describe again what I did:
I copy the GUI Status from the standard program SALV_DEMO_TABLE_FUNCTIONS to my program through Tcode SE41. I added 2 buttons POSTNEW & POSTDIF. Until now all working perfect and I can Enable/Disable these 2 buttons.
Next day the business asked me to add a button SELECT with which the user can make editable the corresponding SELECT column of the itab in order to choose which record to be posted. And here started my problem where the itab with the functions didn't contain the last created button SELECT. What I did was, I created a button through the design process of the GUI Status but I could not get it through the below code:
lit_functions_list = r_functions->get_functions( ).
With your answers I found other problems in my code but still I could not get the new button in the above itab.
Finally, yesterday evening I remembered, what someone told me in the past. In old systems (like oursSAP ECC 6.0 R701 SP007) sometimes the ALV buffer stuck and we have to reset it. So I run the program BALVBUFDEL and vuala the button SELECT appeared in the itab and I can now Enable or Disable.
So keep in mind that sometimes the ALV buffer needs a reset.
Thanks all for your help.
Elias

Get row ID when user double clicks the row in ALV report

I have a scenario which displays a list of purchase documents as ALV (function module REUSE_ALV_LIST_DISPLAY). By clicking on a purchase doc no, its specific details (e.g. NETPR) should show in a pop up. How should I do it?
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE r_ucomm.
WHEN '&IC1'.
READ TABLE ITAB INTO WA WITH KEY EBELN = WA-EBELN.
PERFORM popup_display.
ENDCASE.
ENDFORM. "user_command
Inside the subroutine in structure RS_SELFIELD is what you need:
field TABINDEX contains the line, which was double clicked (you can READ TABLE the internal table which holds the data with INDEX rs_selfield-tabindex) and field FIELDNAME contains the field, which was clicked (if that is relevant in your case).
Also check the documentation of the function module SE37 => Function Module Documentation, lots of useful information there see I_CALLBACK_USER_PROGRAM

ALV Grid lock specific rows

I am using the CL_GUI_ALV_GRID class to display a table. I would like to be able to edit the table (adding new rows and removing all lines), but I don't want existing rows to be editable. That means:
I've got 5 records to display, and I would like to be able to remove and add new records but I don't want the user to edit the 5 existing records (I'd like him to be able to remove them).
Is that possible?
By default when you call the 'LVC_FIELDCATALOG_MERGE' function module to generate a field catalog for the CL_GUI_ALV_GRID, the cells are not editable.
You must set which column is going to be edited setting the 'edit' attribute like this:
...
data: it_fieldcat type lvc_t_fcat,
wa_fieldcat like line of it_fieldcat.
call function 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZSTRUCT'
CHANGING
ct_fieldcat = it_fieldcat.
loop at it_fieldcat into wa_fieldcat.
wa_fieldcat-edit = 'X'. " ---->Here is set the editable column
modify it_fieldcat from wa_fieldcat.
endloop.
If you don't want cells to be edited do not set this attribute.
But for better reference check programs 'BCALV_EDIT_03' and 'BCALV_EDIT_04' for complete examples.
Hope it helps.

Show / Hide Fields in Pentaho Report Based on User Input

I'm trying to show / hide fields in a Pentaho report based upon user input.
For example, I would like to offer a checkbox to the user saying "Show Product Count" -- if the box is unchecked, it will not include that column in the report.
Is there a way to do this in Pentaho Report Designer, perhaps using Parameters?
Thanks for the help -Monica
Yes, you have half the answer. Have a Yes/No Parameter "ShowProductCount"
Then on the conditional fields, go to the visible property, click the + formula icon and enter:
=IF([ShowProductCount]="Yes"; TRUE(); FALSE())
Simple! :)
There is more to this that the above answer. For example, if you don't want a field to show on the report, you pass the value mentioned above by Codek but the field will not show but the space for it will. The field has to be in a BAND and the band layout has to be set to ROW. Also, on the field you want to not display or display based on user selection, you have to set that field's style properties under size & position - invisible-consumes-space = false.

Double clicking a row and column in ALV Grids

Currently I have an ALV grid and I can double click to call transaction IE03 and pass the information in the first column (which is eqkt-equnr). However, this transaction is called regardless of what column you click on. This wouldn't be so bad, but I need to be able to call IW33 if you click on the 3rd column and pass along the equz-J_3GEIGNER value there.
My current double click code is as follows. t_report is my struct and matnr is the equnr part of it. maktx is the J_3GEIGNER part of it.
FORM user_command USING r_ucomm
wa_selrow TYPE slis_selfield.
IF r_ucomm = '&IC1'.
READ TABLE t_report INDEX wa_selrow-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'EQN' FIELD t_report-matnr.
CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM.
Use the field wa_selrow-fieldname to determine which column was clicked. Be aware that you may have to switch the grid from row selection mode to cell selection mode - since you didn't show us how you created the grid in the first place, I can't tell you how to do this in your case. Take a look at the SEL_MODE property, it might help.