Reading the layout variant
Hello Every1,
Please let me know how to read the ALV layout variant contents . I need to find the list fields defined in the layout varint.
Thanks in advance.
Regards,
Siva.
Hi ,
try these Fm
PLM_DMS_46_LAYER
PORTAL_ALV_PLM_VARIANT_DB
PLM_DMS_GENERAL
PORTAL_ALV_PLM_VARIANT
RMLT0
RM_ALV_FILL_VARIANT
SALV ABAP List viewer
REUSE_ALV_VARIANT_ALL_MAINTAIN Maintain all disp
REUSE_ALV_VARIANT_DEFAULT_GET Read default layo
REUSE_ALV_VARIANT_EXISTENCE Checks whether a
REUSE_ALV_VARIANT_F4 Display variant s
REUSE_ALV_VARIANT_MAINTAIN Definition of a l
REUSE_ALV_VARIANT_SAVE
REUSE_ALV_VARIANT_SELECT Read a layout
Similar Messages
-
Unable to save the ALV layout variant and display of selection screen on F4
Hi All,
The end user wants to directly select the layout variant (SLIS_VARI). I have used the following code to display the layout variant on selection screen. But, I am unable to save the variant on ALV. Whenever I am trying to select the layout variants (by doing F4 on selection screen) its displaying "No Layout found".
Following is the code for displaying layout variant:
PARAMETERS: p_var TYPE slis_vari.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var.
PERFORM f4_variant CHANGING p_var.
FORM f4_variant CHANGING c_variant TYPE slis_vari.
DATA: ls_variant TYPE disvariant,
l_exit TYPE char1.
ls_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = ls_variant
i_save = 'A'
IMPORTING
e_exit = l_exit
es_variant = ls_variant
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.
ELSE.
IF l_exit EQ space.
c_variant = ls_variant-variant.
ENDIF.
ENDIF.
ENDFORM. " f4_variant
and following is the code for displaying the ALV:
FORM edition_alv.
ws_variant2 = ls_variant.
* Call ALV editor in list mode
IF p_list = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = ws_extract1-report
i_callback_user_command = ws_user_command
is_layout = ws_layout
it_fieldcat = wt_fieldcat
it_sort = wt_sort
i_save = 'A'
is_variant = ws_variant2
it_events = wt_events[]
TABLES
t_outtab = wt_edition.
* Call ALV editor in grid mode
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_extract1-report
i_callback_user_command = ws_user_command
it_fieldcat = wt_fieldcat
it_sort = wt_sort
i_save = 'A'
is_variant = ws_variant2
it_events = wt_events[]
TABLES
t_outtab = wt_edition.
ENDIF.
ENDFORM.
I am not sure whats going wrong, but I am unable to save variants.
Please help.
Thanks,
Vishal.The F4 will display you the existing layouts only. So you need to save the layout first & then execute the report again & check if you are getting F4 values for that field.
The Layout needs to get stored with variant.
Regards,
Mahesh -
Function to get the layout and variant info of a report
Hi ,
I have report zmm4. I have created a variant 'var1' .
The output format of the report is defined in the layout
'lay1'. Which is the function which gives the complete info about the displaying coulmns of those layout ? because I need replicate these functionality in EP .
Please don't say USE "SAP transaction Iviews'.
any hint is appreciated
thanks
pkiranHi Prashant,
Does your report should look like portal format? or is it ok if you show SAP report in portal then easiest would be having a layout variant in the report selection.
Assuming you are using ALV display. Specify the layout variant 'lay1' and save the variant 'var1'.
Create Iview using SAP Transaction Iview and pass the Tcode - 'Start_Report'
Application Parameters - D_SREPOVARI-REPORT=ZMM4 & D_SREPOVARI-VARIANT = VAR1.
Choose option process first screen.
Other suggestion would be to create a function module which is RFC enabled and pass the report values in the specified format to the FM output table and use SAP RFC IVIEW and report would look in portal format.
You can also use com.sap.pct.srv.portaldataviewer par file and choose PortalALVTemplate. PortalALVTemplate is FM in R3 and gives u an idea how you can present the ALV report in Portal.
Hope this helps,
Thanks,
Praveen
PS.Dont forget to reward points for useful/solved answers -
Running the ALV report in Background using layout variant
Hello Everyone,
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.
Can anybody give me a optimized solution for this issue.
Regards,
VasanthHi,
How are you downloading the file to the app server, using which internal table? How are you building that internal table?
What you need to do is to build a internal table dynamically with only those columns that are a part of the layout variant. Then move the data from the original internal table into this and then download the dynamica internal table to the app server.
Regards,
Ravi
Note : Please mark the helpful answers -
Layout variant is not working in background in ALV report
Hi,
I have one LAV report to send the report output through mail in foreground and backgroud.Final internal table is having 46 fileds to display the output.But here user is saving the layout variant and sending that layout variant output to mail id in excel format with zip file.Its working in foreground.But in background its not working.Even if we select the layout variant,its sending all the 46 fileds to mail.
here we have used the below FM to update the fieldcat itab.
CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
IMPORTING
et_fieldcat = it_fieldcat[]
es_variant = v_disvariant
EXCEPTIONS
no_infos = 1
program_error = 2
OTHERS = 3.
In for ground NO_OUT = 'x' for non selected fields and NO_OUT = ' ' for selected fields.
But in background NO_OUT = ' ' for all the fileds, even if we select the layout variant.
Please suggest me with the solution.
Regards,
Jayaramhi ,
Do according to this
SORT t_ekbe by belnr.
if t_ekbe[] is not initial .
SELECT MBLNR
BWART
SMBLN
ERFMG " This is the new added field
erfme " This is the new added field
INTO CORRESPONDING FIELDS OF TABLE t_mseg
for all entries in t_ekbe
from mseg
where mblnr = t_ekbe-belnr
AND bwart = '101'.
endif.
after this
loop at t_ekbe .
loop at t_mseg where mblnr = t_ekbe-belnr .
t_ekbe-ERFMG = t_mseg-ERFMG .
t_ekbe-erfme = t_mseg-erfme .
modify t_ekbe transporting ERFMG erfme .
clear t_mseg .
endloop.
clear t_ekbe .
endloop.
Regards
Deepak . -
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. -
Issues in Change layout Variant of ALV grid
Hi all,
I am using a ALV gird to display the data with some table column. I am able to save/ choose the Layout variant. I choose the existing layout varaint it works fine but when I change the column fields display from selected layout then it will immidiately looks fine, but if I perform some event, it goes to the initial stage of the choosed layout varaint.
I can solve this issue if I clear the Variant from the is_variant (of set_table_for_first_display method). So if I can find the fieldcatalog for layout Variant, then it will solved very easily.
Please suggest, if you have any idea on this.
Thanks,
Sanket SethiI got the solution. You can find the Variant field catalog by using Function module 'LVC_VARIANT_SELECT'. You can set the dialog box based on your requirements as well. So closing this thread. Thanks..
-
Reg. copying Layout Variants from 1 ALV pgm to another
Hi Friends,
I am currently copying an ALV program Ztest1 to ztest2 through ztest5. While doing so I want the LAYOUT variants that are available for ztest1 also to be copied to these other programs.
All I am aware is that the table LTDX stores all the layout variants for a particular program.
Could anybody provide me the right inputs on this.
Thanks in Advance.
Rgrds,
Gayathri N.I took this approach and it worked for me:
1) Change your program so that everytime an ALV function is called it is using the original program name in the variant declaration, ensure you keep the original code commented out, you will need to put it back later. Examples:
FORM variant_init USING varname TYPE slis_vari.
CLEAR g_variant.
g_variant-report = g_repid.
g_variant-report = 'ORIGINAL_PROGRAM_NAME'.
FORM f4_for_variant.
g_variant-report = sy-repid.
g_variant-report = ORIGINAL_PROGRAM_NAME.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
FORM check_variant.
IF NOT p_vari IS INITIAL.
g_variant-report = sy-repid.
g_variant-report = ORIGINAL_PROGRAM_NAME.
g_variant-variant = p_vari.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
2) Display function lt_variant_save via SE37, set a breakpoint at the first executable line:
perform variant_save tables it_fieldcat
4) Run your program with the layout variant you wish to copy.
5) Hit Save Variant. You are now in debug mode.
6) Enter variable CS_VARIANT-REPORT in the variables 1 panel.
7) Double-click on CS_VARIANT-REPORT.
8) Hit the Change Field Content button
9) Change the value to the name of your new program, then hit Enter.
10) Hit Execute (F8). You have now saved the variant under your new program name.
11) Exit and rerun your program as necessary for as many variants as you want to copy
12) Change your program back to using sy-repid (or whatever else it was referencing) wherever you changed it in step 1.
13) The variants have now been copied and you can run your program with the new variants. -
Hi Experts,
I am working on a POWL for Performance management. When I try to change the fields displayed in the layout variant in the transaction POWL_QUERYR, the changes made is reflecting only for me and not for other users.
Could you tell me what should be done for reflect it for other users.
Thanks & Regards,
Arun.Hi Arun,
To reflect this for all users you need to enter your application in administration mode (usually there is a flag on the url: sap-config-mode=X). Once in there you can make changes by holding down CTRL and right clicking on any element.
There are some authorisations needed to complete this - more detail on that can be found [here|http://help.sap.com/saphelp_nw04s/helpdata/en/46/98ce61f37d19ace10000000a11466f/content.htm]
When you are finished and click save it should then ask you to transport your changes.
Hope that helps,
Brenton. -
Hi All,
How to create a layout variant which will display the list of all variants created by user? also layout parameter will show the default layout? I am creating field catalogue manually, will this affect the layout variant ?How to get F4 functionality for Layout variant?
MinalHi Minal,
Refer to the code below
PARAMETERS: alv_def LIKE disvariant-variant.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR alv_def.
PERFORM layout.
FORM layout .
g_save = 'A'.
CLEAR g_variant.
g_variant-report = sy-repid.
gx_variant = g_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = g_save
CHANGING
cs_variant = gx_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
alv_def = gx_variant-variant.
ENDIF.
Get values from the selection screen to determine layout set
wal_dynpfields-fieldname = 'ALV_DEF'.
APPEND wal_dynpfields TO tl_dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = '1000'
TRANSLATE_TO_UPPER = ' '
REQUEST = ' '
PERFORM_CONVERSION_EXITS = ' '
PERFORM_INPUT_CONVERSION = ' '
DETERMINE_LOOP_INDEX = ' '
TABLES
dynpfields = tl_dynpfields
EXCEPTIONS
INVALID_ABAPWORKAREA = 1
INVALID_DYNPROFIELD = 2
INVALID_DYNPRONAME = 3
INVALID_DYNPRONUMMER = 4
INVALID_REQUEST = 5
NO_FIELDDESCRIPTION = 6
INVALID_PARAMETER = 7
UNDEFIND_ERROR = 8
DOUBLE_CONVERSION = 9
STEPL_NOT_FOUND = 10
OTHERS = 11
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 tl_dynpfields INTO wal_dynpfields INDEX 1.
IF sy-subrc EQ 0.
g_variant-variant = wal_dynpfields-fieldvalue.
ENDIF.
g_variant-report = sy-repid.
g_variant-username = sy-uname.
**-- Display all existing variants
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = g_variant
i_save = g_save
IMPORTING
e_exit = g_exit
es_variant = gx_variant
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.
ELSE.
IF g_exit = space.
alv_def = gx_variant-variant.
g_variant = gx_variant.
ELSE.
MESSAGE 'No layouts found' TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM. " layout
Reward points if helpful.
Regards,
Pankaj Sharma -
Manage layout variants with no data in system
Working on a new production system with no work orders created yet. Is there a way to create (or transport in from another system) the layout variants? Running the list edit transaction gives a 'No objects were selected' and never displays the results screen.
Hi,
Create the required layouts in either Quality or Development clients. Then execute the particular report. In the report view, Go to Menu Settings => Layouts => Administration.
It will open Layout Management. Select the layouts to be transported & go to Menu Layout => Transport.
It will ask for Request ID. Save that request & transport that to required client.
I have not tried this. Please check in other clients before doing in Production.
Regards,
Maheswaran. -
I have been asked to support a 4.5 system and they are using SIS which I have no experience. The consultant set up the structures and everything seems to be meeting the business needs.
One issue is that users would like to save layout variants. The selection variants are fine but the layout variant option is disabled in the menu bar.
Can anyone tell me how I can enable layout variants? Is it authorizations related or something else?
Thanks,
BrianHi Brian;
Yes, this is indeed an authorization issue. I had a similar issue and found out that this to be an auth issue.Pls check with Basis and get your auth.
Regards,
Mani. -
Hi ,
I have executed a report . I hide one column and saved the layout. The layout name comes on to the selection screen parameter which i have defined on the selection screen.
PARAMETERS: p_vari LIKE disvariant-variant. " ALV Variant
i have made the i_save = 'A' and is_default = 'x'. and also used other function modules reg. Variants.
but if i select the layout variant in the selection screen and execute it is not working . the hidden column also coming on the output.
But if the select the layout variant on the output of the report from the icon select layout it is working fine. the column which i have hidden is not coming. it is perfect. why it is not working when i select the variant in the selection screen.
Regards,
Rose.Hi,
Please try this code
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
w_variant-report = sy-repid.
* Function module to show the variant of a ALV report
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = w_variant
i_save = 'A'
IMPORTING
es_variant = w_kvariant
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.
ELSE.
p_vari = w_kvariant-variant.
ENDIF.
END-OF-SELECTION.
MOVE w_variant TO w_kvariant.
MOVE p_vari TO w_kvariant-variant.
MOVE sy-repid TO w_kvariant-report.
* Function module to check the variant existence
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = w_save
CHANGING
cs_variant = w_kvariant.
w_variant = w_kvariant.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_callback_html_top_of_page = 'HTML_HEADING'
i_grid_title = text-t06
i_grid_settings = wa_grid_set
is_layout = wa_layout
it_fieldcat = t_fieldcat
i_save = 'X'
is_variant = w_variant
is_print = wa_print
TABLES
t_outtab = t_header
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1. RAISE program_error.
WHEN 2. RAISE others.
ENDCASE.
ENDIF.
Regards
Krishna
Edited by: Krishna Gowrneni on Apr 17, 2009 5:27 PM -
How to Restrict the users from changing the Default variant of report.
Hello everybody,
The requirement is to restrict the users to save and overwrite the default layout variant (Layout for higher managenet)set for the report, but at the same time they should be able to change and save the other layouts for which they are having access.
I have written the logic in the program which is working fine for all the scenario when we execute the report. But the logic doesnt work if the user is selecting the layout on the output screen of the report.
for e.g if the user runs the report using the layout varaint for which he is having the authorization then he gets the all 4 options so he then he can select the layout for which he is not authorized and he can overwrite.
i have debugged and check as i have found that after the report output is shown all the layout paramater is controllled by the statndard SAP objects.
Can anyone help me out in this issue.
Thankyou in advance.
*to get the default layout variant.
w_save = 'A'.
if p_vari is initial.
clear disvariant.
disvariant-report = sy-repid.
w_variant = disvariant.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = w_save
changing
cs_variant = w_variant
exceptions
not_found = 2.
if sy-subrc = 0.
p_vari = w_variant-variant.
endif.
endif.
*logic to check user authorization to change the layout setting.
if p_vari = c_layout.
if not sy-uname is initial.
select single * from agr_users
where agr_name = c_role
and uname = sy-uname.
if sy-subrc = 0.
w_save = 'A'.
else.
w_save = ' '.
endif.
endif.
endif.
Regards,
Satish.Hi Maine,
Thanks for your reply.
As you mentioned for your own program, you can control the parameter "I_SAVE", when calling "REUSE_ALV_GRID_DISPLAY".
so already i have use the same logic and control the parameter through I_SAVE and here i am calling method ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY instead of "REUSE_ALV_GRID_DISPLAY".
and it works fine when we execute the report but the logic doesnt work when the user tries to change and save the layout variant on the output screen of the report.
Regards,
Satish -
Using Layout Variant in jobs that are scheduled to run in background
Hi Guys,
I have an issue in using the "layout variant" in running a report in the background. Here is what i do to run a report.
I select a "selection Variant" and at the bottom of the Report input screen, I choose an User- Specific "Layout Variant" which i have saved with few columns only to show in the report.
When i run this in foreground, i am able to get the report with my "Layout variant" with only my selected columns. I could also export this output and it looks fine in excel.
When i run the same report with the same "Layout Variant" in background and save it to my local desktop as an excel file, my "Layout Variant" doesn't seem to work and i am getting all the columns and fields of the reports as such.
Is this the way, the "Layout variants" will work? Whether this will not work in background jobs? Is this the way standard SAP work?
Please guide me...
Good rating points will be given for useful inputs..
Anand ViswanathanStandard SAP functionality
Maybe you are looking for
-
Displaying a radio group in SQL QUERY report region
Good morning everyone, I have a report in which a column - ORDER STATUS, will come in with a value of 1, 2 or 3...being order unfilled, order partially filled, or order filled, respectively. I would like to display the order status as a radio group o
-
Hi can i create sub screen in creation of sales order item in user exit mv45afzz my requirement is when user click on any line item than than i need to call subscreen with some information pls guide me on this
-
Will not print a new window opened from an https: site eg phone bill. will print in IE
When I try to print monthly statements, they open in a new window, click print and it starts the printer and then comment"an unexpected error occured" I can do this in IE8 with no problems. My printer is a Canon mf4380dn. I never had this problem wit
-
My ipad 2 pictures are all grainy, my wifes i pad 2 pis are great
when i hold the 2 ipads side by side and take a picture , mine is all grainy, hers is great , what is going on . as i look through the history of my photos , they seem to have gone downhill after i upgraded to i0s 6.whatever
-
?? Forwarded pictures in apple mail become pixelated,, WHY ??
Help! I'm using Leopard and apple mail 3.2. Yesterday I received a email with several great pictures. The photo were high res and I wanted to forwarded them to my family. So far so good ... they went out fine.... BUT everyone that received them said