05-19-2009 8:04 PM
Hi Experts,
I have saved a layout for an ALV report, Can i save this layout in a variant ( by providing a screen field to give the name of the layout ) and can be passed on to the ALV, so that i will get the output with the given layout. If you have any code, or procedure do it.
Please help me.
Thanks&Regards,
Poorna
05-19-2009 8:49 PM
Pooma,
You can have a display variant on ALV report selection screen which will be passed to report.
In selection screen output set the default variant using
REUSE_ALV_VARIANT_DEFAULT_GET
Provide value request help using REUSE_ALV_VARIANT_F4
Set the display variant before calling ALV display using
REUSE_ALV_VARIANT_SELECT
Hope this helps.
Bipin
05-19-2009 9:41 PM
Hi Bipin,
In the same way, can we pass the layout which was saved for the ALV report. Support i have 10 fields to display in the ALV report, i saved different layouts with different fields, can we pass them to the ALV FM, from the selection screen or in any other way, Thanks for your response.
Thanks & Regards,
Poorna
05-19-2009 9:46 PM
Hi
Try this
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
Help for ALV output display variant
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.
IF NOT p_vari IS INITIAL.
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.
w_variant = w_kvariant-variant.
ELSE.
CLEAR w_variant.
ENDIF.
Function module to prints the output in ALV format
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_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 = c_mark
is_variant = w_variant
is_print = wa_print
TABLES
t_outtab = t_header
EXCEPTIONS
program_error = 1
OTHERS = 2.
Regards
Krishna
05-19-2009 10:32 PM
Hi Krishna,
Can we print an ALV with, a particular ALV output layout. My requirement is not to display all the fields of the table. I have save a layout for the report, alv is executed, can i pass this when the report is executed for the next time, it should come with this layout. suppose in layout1 i saved the report with 5 fields. But when i execute the report next time, it should come with this layout1(5 fields display). Not all the fileds. I hope you got my requirement.
Thanks & Regards,
Poorna.
05-19-2009 10:57 PM
I deleted a bunch of extra postings that you made. The forum is acting up a bit today and that sort of thing seems to be happening a lot. You'll get some e-mails saying your posts were rejected. You can ignore them.
Rob
05-19-2009 9:51 PM
Total Posts: 104
Total Questions: 50 (22 unresolved)
If you assign poi nts and close your old posts, that will encourage people to respond to your new questions.
Rob
05-20-2009 6:09 AM
Hi Porna,
Please try this coding ,
<< Unformatable code removed >>
Let me know if it helps you,
Regards,
Nikhil
Edited by: Nikhil Kanegaonkar on May 20, 2009 7:10 AM
Edited by: Rob Burbank on May 20, 2009 8:53 AM
05-20-2009 1:37 PM
Hi Nikil,
Can you send this in Code format. Its all mixed up.
Thanks & Regards,
Poorna.
05-20-2009 1:49 PM
Hi Porna,
Can you tell me how to send me in proper code format.
I tried but its still not coming in proper format.
Regards,
Nikhil.
05-20-2009 1:55 PM
Just post the relevant portion - there is a limit of 2,500 characters that can be formatted properly.
Rob
05-20-2009 2:57 PM