cancel
Showing results for 
Search instead for 
Did you mean: 

Maintaining ALV Variants without running the program

12-21-2005 11:26 PM
3764 views 12 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Is there a way to maintain ALV Layout Variants for a report without running the report first? Does a separate tcode exist for this?

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

HI,

It seems there is a way to save an ALV layout variant as "user-specific" and/or "global". But unfortunately, you either can only save "globals" (with the '/' as first character of the layout name) or "user-specific".

You have tried the I_SAVE parameter as 'U' and can only save "user-specific". You tried I_SAVE as 'X' and can only save "global". You tried I_SAVE as 'A', but only can only save as "user-specific". The odd thing is, on the Save Layout pop-up dialog the User-Specific checkbox is always "greyed-out", but has a check (for 'U' and 'A') or is checkless (for 'X').

Can "user" and "global" layout variants be saved together from same program with I_SAVE as 'A'?

Why is the User-Specific checkbox on the Save Layout pop-up always "greyed-out"?

You have the following EXPORTING parameters in my function module:

I_DEFAULT = 'X'

I_SAVE = 'A' "<=== this is to be global & user IS_VARIANT = VARIANT

VARIANT has the program's name in the REPORT field.

The "user-specific saving" needs a special authorization: 
Authority-check object 'S_ALV_LAYO' id 'ACTVT' field '23', you can 
avoid this authorization with IS_LAYOUT-NO_AUTHOR = 'X'.

Regards

Sudheer

Answers (6)

Answers (6)

Former Member
0 Likes

Here is what you can probably do. In your development system, just insert one or two records into your internal table of the ALV. Hardcode the internal table field values, but fill in all the fields. Put this in a temporary routine and call it just before your ALV call.

Once the output is shown, you can then create your variant and save it. Then modify your program to remove this temporary routine.

Srinivas

Former Member
0 Likes

Srinivas,

Great idea. That's probably what I'll do. It's not pretty but it gets the job done.

Former Member
0 Likes

I know it is not pretty, but that is what we can do if we don't have data. We can always create the data using the transactions that create data, but sometimes it is just too much to do that, particularly if you are accessing too many tables that span across several transactions. Also, you need to have the necessary config in place and the authorizations in place to do that. So this is our next best option.

Srinivas

Former Member
0 Likes

Yes, they are client-specific. Is it possible to have non client-specific ALV layouts?

Former Member
0 Likes

Thanks for all the feedback.

To answer the earlier question on why I would need to do this:

Per the functional requirement, the report reverts back to the selection screen if it selects no data. The development client has no data in it, but it's the only client in which I am authorized to create transports. I need to get to the variant maintenance screen to copy the variant from the other client and put it in a transport.

I might try do do something creative with LTDX or by calling the LVC_VARIANT_SAVE in single test from SE37. I wanted to make sure I wasn't missing something first.

Thanks for your help!

RichHeilman
Developer Advocate
Developer Advocate
0 Likes

In your development instance, do you have another client in which there is data? Here is what I mean, when we first went live we had 2 clients for our development instance. 100 and 150. In client 100, we were allowed to do development work and there was no data. In 150, there was data, but we were not allowed to develop there. So we did our development in 100, and since programs are not client specific, we log on to the 150 client to test. Are the layouts for ALV client specific?

Regards,

Rich Heilman

Former Member
0 Likes

Yes, they are client specific, and my landscape is exactly as you described.

It is possible to have non client-specific ALV layouts?

RichHeilman
Developer Advocate
Developer Advocate
0 Likes

If you go into "Manage Layouts" from the standard ALV, it does provide a way to import from another client. Its under the environment menu. You need to do this programmatically. I've looked into the code, and you may want to try picking it apart and contructing you own routine to do this programmatically. Have a look a the LSKBSF13 include program. Put some break points in there and step thru it. You may be able to use some of the code.

Regards,

Rich Heilman

Former Member
0 Likes

Hi I got a solution for this,

I don't it is useful or not...

There is a table <b>LTDX</b> this hold the variants of a programs. so if you can add an entry to this table

with your program name , variant name, and rest of the parameters.., your job will be done ...

in this table you can create entries directly..

check this...

Former Member
0 Likes

call this function module <b>LVC_VARIANT_SAVE</b> before alv display .So this way you can save the variant before display, but with out running the program i'm not sure..

This function module will be called when you save any variant in the output.

vijay

Former Member
0 Likes

William,

Assume I want to create two different variants for a report. Now, if I want to do this without running this on what basis the fields / layout will be changed and be associated to the variant?

I am not able to make sense out of this requirement. Could you please give more clarity?

However, technically it sounds possible although I have not tried it myself. Take a look at the function module

LVC_VARIANT_SAVE

*" IMPORTING

*" VALUE(IT_FIELDCAT) TYPE LVC_T_FCAT

*" VALUE(IT_SORT) TYPE LVC_T_SORT

*" VALUE(IT_FILTER) TYPE LVC_T_FILT

*" VALUE(IS_LAYOUT) TYPE LVC_S_LAYO OPTIONAL

*" VALUE(I_DIALOG) TYPE C DEFAULT 'X'

*" VALUE(I_OVERWRITE) DEFAULT ' '

*" VALUE(I_USER_SPECIFIC) DEFAULT ' '

*" VALUE(I_CUSTOMER_NAME_CHECK) TYPE C DEFAULT 'X'

*" VALUE(I_BUFFER_ACTIVE) TYPE CHAR01 OPTIONAL

*" VALUE(I_BYPASSING_BUFFER) TYPE CHAR01 OPTIONAL

*" EXPORTING

*" VALUE(E_EXIT) TYPE C

*" TABLES

*" IT_DATA OPTIONAL

*" CHANGING

*" VALUE(CS_VARIANT) LIKE DISVARIANT STRUCTURE DISVARIANT

So, given the right parameters you should be able to save the layout variants.

however, I am not sure where you are going to place the code, if you are not going to execute the code even once.

Regards,

Ravi

Note : Please reward the helpful posts.