Layout in ALV reports
Hi everyone, I have created an ALV report, and now I've been ask to upgrade this report putting a parameter in the selection screen where the user can select a layout, and then execute the report so when the data is display appear as the layout already chosen by the user.
Can anyone tell me how to add this functionality to my alv report.
Thanks in advanced,
Fidel
HI Fidel,
Here is example program for List and Grid
whichever u choose that report format will be displayed
check this once.
*& Report ZLAXMI_ALVEXER2 *
*& NAME : VENKATA LAXMI *
*& DATE : 24-02-2006 *
*& PROGRAM TO PRINT THE REPORT IN ALV LIST FORMAT AND GRID FORMAT *
*& WITH TRAFFIC LIGHTS *
REPORT ZLAXMI_ALVEXER2 MESSAGE-ID ZZ .
*& TABLES DECLARATION *
TABLES: VBAK.
*& TYPE POOLS DECLARATION *
TYPE-POOLS: SLIS.
*& INTERNAL TABLE DECLARATION *
DATA: BEGIN OF ITAB OCCURS 0,
ICON TYPE ICON-ID,
VBELN LIKE VBAK-VBELN,
AUDAT LIKE VBAK-AUDAT,
VBTYP LIKE VBAK-VBTYP,
AUART LIKE VBAK-AUART,
AUGRU LIKE VBAK-AUGRU,
NETWR LIKE VBAK-NETWR,
WAERK LIKE VBAK-WAERK,
END OF ITAB.
*INTERNAL TABLE FOR FIELD CATALOG
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
WITH HEADER LINE,
*INTERNAL TABLE FOR EVENTS
DATA: IT_EVENT TYPE SLIS_T_EVENT,
WA_EVENT TYPE SLIS_ALV_EVENT,
*INTERNAL TABLE FOR SORTING
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
*INTERNAL TABLE FOR LAYOUT
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
*& VARIABLE DECLARATION *
DATA : V_REPID TYPE SY-REPID,
V_PAGNO(4) TYPE N,
V_DATE(8) TYPE C.
*& CONSTANTS *
CONSTANTS: C_X TYPE C VALUE 'X'.
*& SELECTION SCREEN *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN,
S_VBTYP FOR VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
*SELECTION-SCREEN : BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 1(20) TEXT-003.
PARAMETERS: P_LIST RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
*SELECTION-SCREEN : END OF LINE.
*SELECTION-SCREEN : BEGIN OF LINE.
*SELECTION-SCREEN COMMENT 1(20) TEXT-004.
PARAMETERS: P_GRID RADIOBUTTON GROUP RAD1.
*SELECTION-SCREEN : END OF LINE.
SELECTION-SCREEN: END OF BLOCK B2.
AT SELECTION-SCREEN.
PERFORM VALIDATE_SCREEN.
*& START OF SELECTION *
START-OF-SELECTION.
CLEAR: ITAB, ITAB[].
V_REPID = SY-REPID.
PERFORM GET_DATA.
PERFORM DISPLAY_DATA.
*& END OF SELECTION *
END-OF-SELECTION.
*--DO ALV Process
V_REPID = SY-REPID.
*--Sort the Output Fields
PERFORM SORT_FIELDS.
*--Build Field catalog for the Output fields
PERFORM BUILD_FIELDCAT.
*--Set the Layout for ALV
PERFORM SET_LAYOUT.
*& Form GET_DATA
text
TO GET THE DATA FROM TABLES INTO ITAB
FORM GET_DATA .
SELECT VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM VBAK
WHERE VBELN IN S_VBELN AND
AUDAT > '04.04.2005'
AND NETWR > 0.
LOOP AT ITAB.
IF ITAB-NETWR < 10000.
ITAB-ICON = '@08@'.
ELSEIF ITAB-NETWR > 10000 AND ITAB-NETWR < 100000.
ITAB-ICON = '@09@'.
ELSEIF ITAB-NETWR > 100000.
ITAB-ICON = '@0A@'.
ENDIF.
MODIFY ITAB INDEX SY-TABIX.
ENDLOOP.
ENDFORM. " GET_DATA
*& Form sort_fields
FORM SORT_FIELDS .
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'VBTYP'.
WA_SORT-SPOS = '1'.
WA_SORT-UP = 'X'.
APPEND WA_SORT TO IT_SORT.
CLEAR WA_SORT.
WA_SORT-FIELDNAME = 'NETWR'.
WA_SORT-SPOS = '2'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
ENDFORM. " sort_fields
*& Form build_fieldcat
*FORM BUILD_FIELDCAT .
IT_FIELDCAT-COL_POS = '1'.
IT_FIELDCAT-FIELDNAME = 'ICON'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '10'.
IT_FIELDCAT-SELTEXT_L = 'LIGHT'.
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '2'.
IT_FIELDCAT-FIELDNAME = 'VBELN'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '10'.
IT_FIELDCAT-SELTEXT_L = 'SALES DOC NUMBER'(009).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '3'.
IT_FIELDCAT-FIELDNAME = 'AUDAT'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'DOCUMENT DATE'(010).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '4'.
IT_FIELDCAT-FIELDNAME = 'VBTYP'.
IT_FIELDCAT-KEY = 'X'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'CATEGORY'(011).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '5'.
IT_FIELDCAT-FIELDNAME = 'AUART'.
IT_FIELDCAT-OUTPUTLEN = '4'.
IT_FIELDCAT-SELTEXT_L = 'DOCUMENT TYPE'(012).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '6'.
IT_FIELDCAT-FIELDNAME = 'AUGRU'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'Order reason'(013).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '7'.
IT_FIELDCAT-FIELDNAME = 'NETWR'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'NET VALUE'(014).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
IT_FIELDCAT-COL_POS = '8'.
IT_FIELDCAT-FIELDNAME = 'WAERK'.
IT_FIELDCAT-OUTPUTLEN = '12'.
IT_FIELDCAT-SELTEXT_L = 'SD DOC CURR'(015).
APPEND IT_FIELDCAT.
CLEAR IT_FIELDCAT.
*ENDFORM. " build_fieldcat
*& Form set_layout
FORM SET_LAYOUT .
IF P_LIST = C_X .
WA_LAYOUT-WINDOW_TITLEBAR = 'LIST DISPLAY'(016).
WA_LAYOUT-ZEBRA = 'X'.
*-- ALV LIST DISPLAY
PERFORM LIST_DISPLAY TABLES ITAB.
*-- ALV GRID DISPLAY
ELSEIF P_GRID = C_X.
WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'(017).
WA_LAYOUT-ZEBRA = 'X'.
PERFORM GRID_DISPLAY TABLES ITAB.
ENDIF.
ENDFORM. " set_layout
*& Form list_display
FORM LIST_DISPLAY TABLES P_ITAB .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_SORT = IT_SORT[]
I_SAVE = 'U'
TABLES
T_OUTTAB = ITAB
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. " list_display
*& Form GRID_DISPLAY
FORM GRID_DISPLAY TABLES P_ITAB .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT[]
IT_SORT = IT_SORT[]
IT_EVENTS = IT_EVENT
TABLES
T_OUTTAB = ITAB
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. " GRID_DISPLAY
*& Form VALIDATE_SCREEN
text
--> p1 text
<-- p2 text
FORM VALIDATE_SCREEN .
DATA: LV_VBELN LIKE VBAK-VBELN.
IF NOT S_VBELN IS INITIAL.
SELECT VBELN
INTO LV_VBELN
UP TO 1 ROWS
FROM VBAK
WHERE VBELN IN S_VBELN.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'INVALID SALES DOC'.
ENDIF.
ENDIF.
ENDFORM. " VALIDATE_SCREEN
*& Form display_data
text
--> p1 text
<-- p2 text
FORM DISPLAY_DATA .
DEFINE M_FIELDCAT.
ADD 1 TO WA_FIELDCAT-COL_POS.
WA_FIELDCAT-FIELDNAME = &1.
WA_FIELDCAT-REF_TABNAME = 'VBAK'.
WA_FIELDCAT-DO_SUM = &2.
WA_FIELDCAT-CFIELDNAME = &3.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
END-OF-DEFINITION.
DATA:
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
m_fieldcat 'ICON' '' ''.
m_fieldcat 'VBELN' '' ''.
m_fieldcat 'AUDAT' '' ''.
m_fieldcat 'VBTYP' '' ''.
m_fieldcat 'AUART' '' ''.
m_fieldcat 'AUGRU' '' ''.
m_fieldcat 'NETWR' 'C' 'WAERK'.
m_fieldcat 'WAERK' '' ''.
ENDFORM. " display_data
Regards,
Laxmi
Similar Messages
-
Creating layouts in ALV report
Hi all,
I have created a report when a user creates a layout in the report it should save the variant(layout) and display in the selection-screen with alv_variant and search help.Its working properly.
But I have to create different layouts like the following:
Layout with sort and subtotals,
layout with sort and filter conditions like that.
Can anybody help me regarding this matter.
with regards
chanduSai,
Here is a little sample program which shows you how to recall saved ALV Layouts. It requires the user to run the report, create their own variants, and this program allwos them to recall it from the selection screen.
You can create gobal layouts (for your sorts, and totals) which canbe accessed by any user.
Hope this helps.
Cheers,
Pat.
*& Report ZPATS_ALV *
REPORT zpats_alv .
TABLES: kna1.
TYPE-POOLS: kkblo.
* structures *
DATA: st_fieldcat TYPE slis_fieldcat_alv.
DATA: st_variant1 LIKE disvariant.
DATA: st_variant2 LIKE disvariant.
* internal tables *
DATA: BEGIN OF tbl_kna1 OCCURS 0,
kunnr LIKE kna1-kunnr,
name1 LIKE kna1-name1,
stras LIKE kna1-stras,
telf1 LIKE kna1-telf1,
ort01 LIKE kna1-ort01,
pstlz LIKE kna1-pstlz,
sortl LIKE kna1-sortl,
ernam LIKE kna1-ernam,
spras LIKE kna1-spras,
END OF tbl_kna1.
DATA: tbl_fieldcat TYPE slis_t_fieldcat_alv.
* global variables *
DATA: fieldname(30) TYPE c.
DATA: variant_exit(1) TYPE c,
variant_save(1) TYPE c,
variant_def(1) TYPE c.
* Seelction Screen
PARAMETERS: p_vari LIKE disvariant-variant.
* Initialization Event
INITIALIZATION.
PERFORM variant_init USING st_variant1.
st_variant2 = st_variant1.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = st_variant2
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
p_vari = st_variant2-variant.
ENDIF.
* At Selection Screen On Value Request
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM f4_for_variant.
* Start of Selection Event
START-OF-SELECTION.
SELECT kunnr name1 stras telf1 ort01 pstlz sortl ernam spras
INTO CORRESPONDING FIELDS OF TABLE tbl_kna1
FROM kna1.
* End of Selection Event
END-OF-SELECTION.
PERFORM get_fieldcat.
PERFORM create_report.
*& Form get_fieldcat
* text
* --> p1 text
* <-- p2 text
FORM get_fieldcat.
PERFORM write_fieldcat USING 'KUNNR' 'X' 1.
PERFORM write_fieldcat USING 'NAME1' 'X' 2.
PERFORM write_fieldcat USING 'STRAS' ' ' 3.
PERFORM write_fieldcat USING 'TELF1' ' ' 4.
PERFORM write_fieldcat USING 'ORT01' ' ' 5.
PERFORM write_fieldcat USING 'PSTLZ' ' ' 6.
PERFORM write_fieldcat USING 'SORTL' ' ' 7.
PERFORM write_fieldcat USING 'ERNAM' ' ' 8.
PERFORM write_fieldcat USING 'SPRAS' ' ' 9.
ENDFORM. " get_fieldcat
*& Form write_fieldcat
* text
* -->P_0060 text
* -->P_0061 text
* -->P_0062 text
* -->P_0063 text
* -->P_1 text
FORM write_fieldcat USING name
key
pos.
st_fieldcat-fieldname = name.
st_fieldcat-tabname = 'TBL_KNA1'.
st_fieldcat-ref_tabname = 'KNA1'.
st_fieldcat-key = key.
st_fieldcat-col_pos = pos.
IF name = 'PSTLZ'.
st_fieldcat-row_pos = '2'.
ENDIF.
APPEND st_fieldcat TO tbl_fieldcat.
CLEAR st_fieldcat.
ENDFORM. " write_fieldcat
*& Form create_report
* text
* --> p1 text
* <-- p2 text
FORM create_report.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_interface_check = ' '
i_callback_program = 'ZPATS_ALV'
i_callback_user_command = 'USER_COMMANDS'
it_fieldcat = tbl_fieldcat
i_default = 'X'
i_save = 'A'
is_variant = st_variant2
TABLES
t_outtab = tbl_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.
ENDFORM. " create_report
*& Form USER_COMMANDS
* text
* --> p1 text
* <-- p2 text
FORM user_commands USING syst-ucomm LIKE syst-ucomm
selfield TYPE slis_selfield.
CASE syst-ucomm.
WHEN '&IC1'.
READ TABLE tbl_kna1 INDEX selfield-tabindex.
SET PARAMETER ID 'KUN' FIELD tbl_kna1-kunnr.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN OTHERS.
ENDCASE.
ENDFORM. " USER_COMMANDS
*& Form VARIANT_INIT
FORM variant_init USING g_variant LIKE disvariant.
* Initialise the Variant Structure
CLEAR g_variant.
g_variant-report = sy-repid.
ENDFORM. " VARIANT_INIT
*& Form f4_for_variant
FORM f4_for_variant.
CLEAR st_variant1.
st_variant1-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = st_variant1
i_save = 'A'
IMPORTING
e_exit = variant_exit
es_variant = st_variant2.
IF variant_exit = space.
p_vari = st_variant2-variant.
ENDIF.
ENDFORM. " f4_for_variant -
Display Layouts for ALV reports
Client is on 4.7 and it appears that the list of display layouts is out of wack for program RPTBAL00. When choosing a particular layout an error messages returns with "template not found in BDS" then the program crashes. Other layouts work as expected. Any ideas on what could be causing the problem?
There is an OSS Note associated with this. If I am not mistaken it is <b>696069</b> and two excel files(one of them is sap_mm.xls) have to be imported in client 00.
Also check note <b>414920</b>.
Please check service.sap.com and let us know if you did find any solution for this.
Regards,
Subramanian V.
Message was edited by: Subramanian Venkateswaran -
Download alv report using layout variant in background
Hi All,
I want to download an Alv report using layout varaint in background job.
can any one please help me.
i.e...
I am facing a problem in downloading a text file to the Application server.
My requirement is, when the user downloads a file with the layout variant, the file should have only the columns which was selected in the variant.
Will rewards to helpfull ans
regards
Chetanhey seshu,
I am facing a problem in downloading a text file to the Application server.
My requirement is, when the user downloads a file with the layout variant, the file should have only the columns which was selected in the variant. -
Hi,
I have created an ALV report using the class CL_GUI_ALV_GRID. The report has a toolbar which allows the layout of the report to be changed. But, it doesn't have any provision to save layouts. How do I enable this functionality?
Any help would be appreciated.
Thanks,
DivyamanHi,
while calling method grid1->set_table_for_first_display
pass parameter i_save = 'A'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'ZCA0FCSTFTOP'
is_layout = grid_layout
is_variant = s_variant
i_save = 'A'
CHANGING
it_outtab = t_zca0fcstftop
it_fieldcatalog = fieldcat.
regards,
vikas.
plz reward if helpful... -
ALV report - copy layout to another user
Hello,
I have a question about ALV reports.
In ALV we have option to select layout and save it by user-specific.
How to copy this layout to another user?
Is there some function/Bapi?
Thanks in advance,
MichalHi Michael,
Here are the steps I documented for managing this procedure:
First Step is to READ the Layout into the Program
The parameters for the layout can be found in table LTDX
Goto SE37 and enter: LT_DBDATA_READ_FROM_LTDX
When (READ) you will input information for the following parameters:
Report Name
Handle
Log Group
User
Variant
Type
An example is shown below:
<screen shots didn't load in my response> email if you'd like the document with screen shots>
Execute.
Now our next step is to WRITE the information from the program into table: LTDX
While at the Function Builder Screen enter the new function module: LT_DBDATA_WRITE_TO_LTDX
When you (WRITE) you will input information for the following parameters:
Report Name
Handle
Log Group
User
Variant
Type
When completed, your input screen for (WRITE) should look like the screen below:
<screen shots didn't load in my response> email if you'd like the document with screen shots>
IMPORTANT When entering information for IS_VARKEY, remember to use the u201Cnew useru201D ID
When entering information for IS_VARIANT, remember to enter information exactly as found in table LTDX and remember that the parameter: DEPENDVARS may be needed to complete your entry
Now Execute the Function Module. When completed go to table: LTDX and confirm that your new entry has been added.
Pre Checklist:
1.) Capture entries (users) you want to copy from table: LTDX
2.) Make sure you have access to execute function modules/eCATT scripts
3.) Make sure you have table display access (needed to find and validate updates)
If you'd like the documentation with screen shots please reply with your email address.
Cheers,
Robert -
ALV Report Changed Layout Cannot be saved .
IN an ALV report if i changed the layout with selected fields .i cannot save it
the save button on standard toll bar is disiabled
as well as menu items to save the laout ...
i can only chane the layout..
..please guide me in how to allow the end user to save the layout .....hi Vijay,
when you call the ALV FM, beware of importing paramter i_save:
CALL FUNCTION 'REUSE_ALV_...
i_save = 'A'
hope this helps
ec -
'Save layout' button missing in the ALV report layout screen
Hi Friends,
In one of our ALV report the 'save layout' button is missing in the report output screen.i have used the OO concept for creating the ALV output and not the function module.I have attached the code below used for creating the ALV grid.
CREATE OBJECT alv_grid
EXPORTING i_parent = g_container_2.
CALL METHOD alv_grid->set_table_for_first_display
exporting
i_structure_name = 'PA0002'
is_layout =
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = wa_fieldcat.
But i'm not able to trace why the 'save layout' button is missing in the output.Can anyone of you help me in sorting out this problem.
Thanks and Regards,
Vadivel.Pass <u><i><b>A to I_SAVE</b></i></u> parameter. That will give the options to the user to save the layout outs.
I_SAVE = SPACE
Layouts cannot be saved.
I_SAVE = 'U'
Only user-defined layouts can be saved.
I_SAVE = 'X'
Only global layouts can be saved.
I_SAVE = 'A'
Both user-defined and global layouts can be saved.
Regards,
Ravi
Note : Please mark all the helpful answers
Message was edited by: Ravikumar Allampallam -
How can I add a custom title to multiple ALV reports selected by layout?
Greetings and good day, everyone!
Within the past week or so, I posted a question asking the best way to create a program that would generate multiple ALV reports. I got some great ideas, and I've actually coded up a few simple demos based on your feedback -- thank you!
Here's the issue I'm running into: Many of you suggested that I put all report records into one table, and create a field that I could use to filter on later to determine which fields I want to display for the report. For example, if I have 3 different reports, I put all the fields for all 3 reports into a table. I then add a "report key" field. As I put records into the report table for report 1, I code "01" into the "report key" field. I do the same for reports 2 and 3, assigning each a "report key" of "02" and "03", respectively.
I then set up layouts in the ALV for each of the three reports, using the filter option to only pull records with the "report key" value for that particular report. This all works wonderfully! However, I seem to have lost the ability to show a custom title for each layout. I can create a generic TITLEBAR (like "Reporting Center") but I don't know how to reset the grid's title when a layout is selected. I was hoping that SAP might use the layout description as the title on each page, but it doesn't -- it uses the TITLEBAR text.
Any ideas? I think this might be the best way to program multiple ALV reports, but if I can't display the right report title for a particular layout, I'll probably have to go back to my other alternative of putting each report in its own container/screen, and having a button to access each report from the application toolbar.
Thanks,Srikanth,
I don't have any Selection Screen radio buttons for the user to select a particular report; in my case, they specify some needed criteria by the program in the Selection Screen, the program goes off and does a fair bit of processing/updating, and then displays the ALV reports when finished. They don't want to choose one particular report to view ahead of time; they want to have all 3 (in my case) there to see what processed correctly, what was eligible to process but kicked out with errors, and what failed some matching checks done up front (this layout includes additional fields from the input file so they can see what didn't match up against R/3).
So, while I do like the code example you presented, I don't think it's going to help me in my case. -
How to restrict the user to change ALV layout for Standard Report Output
Dear All,
How can i restict the Users to change Output layout of Standard ALV reports,
kindly suggest to solve the issue.
Regards,
Niranjan.GHi NIranjan,
In the ALV function module , the i_save can have the below paramater values.
You can add based on your requirement.
I_SAVE = SPACE Layouts cannot be saved.
I_SAVE = 'U' Only user-defined layouts can be saved.
I_SAVE = 'X' Only global layouts can be saved.
I_SAVE = 'A' Both user-defined and global layouts can be saved.
Check the Authorization Object - S_ALV_LAYO in SUIM (Objects by Complex Search)
Activity -23.
Edited by: Raj on Jul 13, 2010 3:05 PM -
Download ALV report with layout to application server
Hi Gurus,
I have a problem as follows:
I have one ALV Grid report. This report is very time consuming.
That is why, user wants this to be run in background every night and in the morning when user comes to the office that ALV report should be on user's drive in excel format.
However, it should run with one specific variant and that variant should be dynamically populated. (I have handled this part)
It should also apply specific layout that has many filtering conditions.
As I can not download ALV to excel in background, I decided to download it to the Application server.
My problem is that when run in background, in spool ALV report shows o/p with proper filter conditions that is 5 out of 20 records.
But, when I write this report o/p to Application server, it writes all the records in there, i.e., all 20 records. It does not take into account all the filters. [:(]
I also tried downloading spool to excel, but o/p is not neatly formatted. All columns are fying here and there.
Any suggestion, how can I write ALV o/p to Application server with layout into consideration?
P.S. I have searched forum for this type of query, but no apt responses.
Thanksdid u downloaded the report with standard option provided in the alv and checked the data? that is populating all 20 records?. if so then use coding for achieving the standard one
at the end of selection do like this ..
SET USER-COMMAND ' %PC' .
and in the user-command use like this..
case sy-ucomm.
when ' %PC'.
give the file name ..
do processing ..
endcase. -
Hi Expert,
Please help me.
I have develop a new alv report for my client. I have faceing problem in report layout.
The below is the layout, please advice me how can i design the layout using alv.
total no of hotel | Room available | Occupied room|
Hotel 1 |
Day |
Month |
Year |
Hotel 2 |
Day |
Month |
Year |
Hotel 3 |
Thanks in Advance.
Thanks & Regards,Hi
Check out the following links:
ALV display coloumns as rows
ALV display coloumns as rows
Hope this helps
Regards,
Jayanthi.K -
Displaying an ALV report using a saved layout.
Dear friends
In ALV report there are 2 standard buttons.
One says "select Layout CTRLF9" and another one says "Save Layout CTRLF10".
Using this I can select the layout and save it using some variable.
Now I want to create a field in the main screen so that when
I enter this saved name and run the ALV report, it should show
report using the layout I entered selected (which was saved earlier).
Where will this variable get saved and how can i access this and make it
display using this layout.
Any feed back will be greatly appreciated.
Thanks
RamHi Ram,
Try this code..
BR
Rakesh
**// INITIALIZATION.
initialization.
perform initialize_variables.
**// AT SELECTION-SCREEN.
at selection-screen.
if p_vari is initial.
variant_init.
endif.
perform check_email.
at selection-screen on value-request for p_vari.
alv_f4_for_variant. "#EC
at selection-screen on p_vari.
alv_pai_of_selection_screen.
M A C R O S *
define variant_init.
clear: disvariant,
vartext.
if v_pgm is initial.
disvariant-report = sy-cprog.
else.
disvariant-report = v_pgm.
endif.
end-of-definition.
define alv_f4_for_variant.
variant_init.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = disvariant
i_save = xsave
importing
e_exit = i_exit
es_variant = disvariant
exceptions
not_found = 2.
if sy-subrc = 2.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
elseif i_exit = space.
p_vari = disvariant-variant.
vartext = disvariant-text.
refresh i_dynpread.
i_dynpread-fieldname = 'VARTEXT'.
i_dynpread-fieldvalue = disvariant-text.
append i_dynpread.
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = v_pgm
dynumb = '1000'
tables
dynpfields = i_dynpread.
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.
variant_init.
endif.
end-of-definition.
define alv_pai_of_selection_screen.
if not p_vari is initial.
move p_vari to disvariant-variant.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = xsave
changing
cs_variant = disvariant.
vartext = disvariant-text.
else.
variant_init.
endif.
end-of-definition. -
"Select Layout" Option for ALV Report
Hi All,
I have developed a ALV report.
In the output, on clicking the "Select Layout" button, a small window opens with some layout option/variant say "ZSLEB".
When i choose this layout, the output changes and takes the form of the chosen layout i.e. ZSLEB.
Now, on refresh, the alv output doesnt display this new layout, but goes back to the default layout/variant.
Actually, i am not passing anythin to the IS_Variant parameter in the ALV_GRID_Display FM.
I suppose i need to somehow manage to fetch the "ZSLEB" layout value during refresh and pass it to Is_Variant. Please help me in doing this.
Thanks & Regards,
Tejas SavlaHi
On refresh ,
Call ths below code.
s_variant-report = sy-repid.( Your report name ).
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = s_variant
I_TABNAME_HEADER =
I_TABNAME_ITEM =
IT_DEFAULT_FIELDCAT =
I_SAVE = ' '
I_DISPLAY_VIA_GRID = ' '
IMPORTING
E_EXIT =
es_variant = s_variant
EXCEPTIONS
not_found = 1
program_error = 2
OTHERS = 3
Can pass this to IS_VARIANT while calling for REUSE_ALV_ DISPLAY
Please reward if useful. -
Layout change , save symbol for ALV report
Dear all,
I have created ALV report in which I get only change layout symbol. I want to select/deselect columns in ALV report and want to save that layout. How to get that save layout symbol in ALV report std. headingsHi,
You need to pass 'A' to I_SAVE export parameters of ALV.
I_SAVE = 'A'.
Thanks,
Sriram Ponna.
Maybe you are looking for
-
ECATT abends during recording when lead selection is set to 0 on web dynpro
We have a web dynpro application that works ok when running by itself. When we tried to record ECATT testing on it, it abended after we click on a selection from a list of values. The error on the browser indicated an error on the "lead select".
-
How do you put text into a photo book?
I am new to Photoshop Elements, using Elements 11, and my first project is to make a photo book for a recent trip. I have figured out importing the pictures and titles. I want to include a 3000 word story on 3 or 4 pages. I have spent hours trying
-
How can I create a model node in SAP Records Management
Product: SAP Records Management Hi, I would like to create a model node in a record tree. I found in the function modul BAPI_RECORD_ADDELEMENT no entry for the creation of a model node. Only the instance and the structure node can create by this func
-
Can't rename a single file to autorun.inf even all ntfs permissions are correct
I have this odd problem: Logged in as Domin Administrator I couldn't rename or open for editing an existing file "autorun.inf" even though all the ntfs permissions were correct. Every other files in the same directory (mainly .swf, .docx, .js and .h
-
Web content works on ACViewer not on iPad
Hi, I'm working on an iPad testing the posibilities of the DPS. Now trying my luck on the web content (using local HTML files) I got everything fine on ID CS6 built in Content viewer but after pushing everything on my iPad I get just a white backgrou