ALV + layout varient on selection screen
hiii
with ALV list i want to know with how to allow to put the layout on the selection screen and when user press F4 he will be able to use the list of layout he has save on the ALV output
Note for the layout button to appear i had to activate shown below:
i_save = c_x
please give me sample code where user can choose layout on selection screen and this layout will be used to display on ALV
Hi,
Please refer the code below for layout variants :
DATA: gt_rsparams TYPE TABLE OF rsparams.
* Data for ALV variant
DATA gv_repname LIKE sy-repid.
DATA gv_x_variant LIKE disvariant.
DATA gv_exit(1) TYPE c.
DATA gv_save(1) TYPE c.
DATA gv_variant LIKE disvariant.
PARAMETERS: sp_vari LIKE disvariant-variant. "Dispaly Variant
INITIALIZATION.
gv_repname = sy-repid.
REFRESH : gt_glacct,
gr_rcomp,
gt_output,
gt_fieldcat,
gt_sort.
* Initialize ALV Layout variant
PERFORM f_initialize_variant.
FORM f_initialize_variant .
CLEAR gv_variant.
gv_save = 'X'.
gv_variant-report = gv_repname.
gv_x_variant = gv_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = gv_save
CHANGING
cs_variant = gv_x_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
sp_vari = gv_x_variant-variant.
ENDIF.
ENDFORM. " f_initialize_variant
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sp_vari.
PERFORM f_f4_for_variant.
FORM f_f4_for_variant .
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gv_variant
i_save = gv_save
IMPORTING
e_exit = gv_exit
es_variant = gv_x_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 gv_exit = space.
sp_vari = gv_x_variant-variant.
ENDIF.
ENDIF.
ENDFORM. " f_f4_for_variant
AT SELECTION-SCREEN.
* Validating selection screen fields
PERFORM f_at_selection_screen.
FORM f_at_selection_screen .
* ALV Layout variant
IF NOT sp_vari IS INITIAL.
MOVE gv_variant TO gv_x_variant.
MOVE sp_vari TO gv_x_variant-variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
i_save = gv_save
CHANGING
cs_variant = gv_x_variant.
gv_variant = gv_x_variant.
ELSE.
PERFORM f_initialize_variant.
ENDIF.
FORM f_initialize_variant .
CLEAR gv_variant.
gv_save = 'X'.
gv_variant-report = gv_repname.
gv_x_variant = gv_variant.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = gv_save
CHANGING
cs_variant = gv_x_variant
EXCEPTIONS
not_found = 2.
IF sy-subrc = 0.
sp_vari = gv_x_variant-variant.
ENDIF.
ENDFORM. " f_initialize_variant
Thanks,
Sriram POnna.
Similar Messages
-
Allowing a User to choose the ALV layout format on selection-screen
Hi all,
I would like to know how i can add a parameter to my selection-screen which would allow the User to choose a saved ALV layout format before pressing F8 rather than after. As used in CO15 or MB51.
Thanks femi.yes , You can check the program BCALV_TEST_FULLSCREEN_LAYOUT to check how F4 help is to be used .
to check existene of variant is pretty simple.
Pass the variant name in the ALV display FM . -
To Load ALV Layout in report selection screen
Hi...
I want the selection screen option for user so that he can select any of the saved layouts.
I have done some coding after refering to some threads in here.But I can't proceed further...plz help
<b>selection screen</b>
SELECTION-SCREEN BEGIN OF BLOCK 006 WITH FRAME TITLE text-006.
PARAMETERS: p_layout LIKE disvariant-variant. " layout
SELECTION-SCREEN END OF BLOCK 006.
<b>data declarations</b>
DATA: wa_variant TYPE disvariant.
DATA: w_variant_save TYPE c VALUE 'A'.
DATA: gs_variant TYPE disvariant.
DATA: gs_layout TYPE lvc_s_layo.
DATA: g_repid LIKE sy-repid.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM variant_input_help.
FORM variant_input_help .
DATA: tl_dynpfields TYPE TABLE OF dynpread.
DATA: wl_exit TYPE c.
DATA: wal_variant LIKE wa_variant.
DATA: wal_dynpfields TYPE dynpread.
Get values from the selection screen to determine layout set
wal_dynpfields-fieldname = p_layout.
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.
LOOP AT tl_dynpfields INTO wal_dynpfields.
CASE wal_dynpfields-fieldname.
WHEN 'p_layout'.
wa_variant-variant = wal_dynpfields-fieldvalue.
ENDCASE.
ENDLOOP.
wa_variant-report = sy-repid.
wa_variant-variant = p_layout.
wa_variant-username = sy-uname.
**Invoke function to provide drop down entries
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = wa_variant
I_TABNAME_HEADER =
I_TABNAME_ITEM =
IT_DEFAULT_FIELDCAT =
I_SAVE = w_variant_save
I_DISPLAY_VIA_GRID = ' '
IMPORTING
E_EXIT = wl_exit
ES_VARIANT = wal_variant
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3
IF SY-SUBRC IS INITIAL.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
IF wl_exit IS INITIAL.
p_layout = wal_variant-variant.
ENDIF.
ELSE.
message I033 WITH TEXT-034.
ENDIF.
*gs_variant-variant = p_layout.
*gs_variant-report = sy-repid.
FREE: tl_dynpfields.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = g_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
<b>IS_LAYOUT </b> = <b>??</b>
<b> IT_FIELDCAT = ??</b>
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = wal_variant
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
<b>T_OUTTAB = </b><b>??</b>
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. " variant_input_help
wat steps shud i takeHi ,
I have used the below FM for layout help,
data: gs_variant like disvariant,
gs_variant-report = sy-repid.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = gs_variant
i_save = 'A'
i_display_via_grid = 'X'
importing
es_variant = gs_variant
exceptions
not_found = 1
program_error = 2
others = 3
if sy-subrc = 0.
pa_var = gs_variant-variant.
endif.
Note pa_var is your select options field in the SELECTION SCREEN,
call function 'REUSE_ALV_GRID_DISPLAY' "
exporting
i_bypassing_buffer = 'X'
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gs_layout
it_fieldcat = gt_fieldcat
i_save = 'A'
is_variant = gs_variant
it_events = gt_events
tables
t_outtab = gt_output
exceptions
program_error = 1
others = 2
hope this helps you.
Regards,
Raghavendra -
ALV - selecting the data based on layout set in selection screen
Hi,
I have an ALV report (Custom). I want to give layout selection at selection screen, so the user can create/select/manage layout at the time of selection screen and only these columns will be displayed in the final output. Instead user execute the report for all column and at the end user select the layout. I want this layout at the selection screen level like the standard reports.
Thanks,You can do the following
When the user clicks on download
1.Use FM REUSE_ALV_LIST_LAYOUT_INFO_GET / REUSE_ALV_GRID_LAYOUT_INFO_GET to get the Fieldcat (since due to selection of layout on sel screen some columns are disabled. For the columns which have been disabled the resultant Fieldcat from the above FMs would have NO_OUT = 'X'. Delete columns from Fieldcat itab where no_out = 'X'
2.create a dynamic itab using cl_alv_table_create=>create_dynamic_table( ) passing the above Fieldcat itab, get a handle of new itab
3.loop over the original itab and fill the new dynamic itab
hope this helps... -
Layout Option on Selection Screen For Zreport
Hi All,
Plz explain how to do coding for using Layout option on selection screen of
report. Also i should be able to save and create new layout on selection screen.
Thnaks in advance.
Aniket Dayamahi,
creation of sub-screens.
selection-screen begin of tabbed block <name of the tab> for < height of the tab in no's> lines.
eg;
selection-screen tab(20) l1 <data element> user-comand <name of the funcion code>
selection-screen end of block <name of the tab strip>.
eg;
selection-screen begin of tabbed block mytab for 10 lines.
selection-screen tab(20) l1 user-command tab1.
selection-screen tab (20) l2 user-command tab2..
selection-screen end of block mytab.
Under initialization.
data element = text-01.
data element = text=02.
How to initialize the tab with default screen.
<name of the tab> - prog = sy-repid.
<name of the tab>- dynnr = '<subscreen no>'.
<nane of the tab>-activetab = '<user-command for the strip>
if this has solved ur problem then dont forget to reward with points.
with regards,
madhuri. -
How to Display Varient on selection screen?
Hi All,
the requirement is i need to display the varient on selection screen as Paramente.
Display Varient /STANDARD as a paramente on selection screen.
Please let me know how to do it.
Regards,
Kumar
Moderator message: very basic, please search for available information before asking.
locked by: Thomas Zloch on Aug 12, 2010 12:27 PMHi All,
the requirement is i need to display the varient on selection screen as Paramente.
Display Varient /STANDARD as a paramente on selection screen.
Please let me know how to do it.
Regards,
Kumar
Moderator message: very basic, please search for available information before asking.
locked by: Thomas Zloch on Aug 12, 2010 12:27 PM -
From ALV output list to selection screen
Hi,
I created one ALV report.
After executing the program, it displays an ALV list.
When I click on the back/exit/cancel buttons on the screen, it should take me to the selection screen.
But that is not happening. it is taking to one screen which shows the report heading. IF i click back/cancel/exit buttons in this screen, it is taking me to the selection screen.
I checked the program for any write statement, but therre are no write statements.
Even i tried to remove the end-of-selection event in the program. but not working.
Can any one help me on this how to overcome this issue.
Thank you.
Kumarhi check this example...
REPORT zalv_sel_screen .TABLES: mara.DATA: BEGIN OF i_alv OCCURS 0,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
groes TYPE mara-groes,
maktx TYPE makt-maktx,
END OF i_alv.DATA: alv_container TYPE REF TO cl_gui_docking_container.
DATA: alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: layout TYPE lvc_s_layo.
DATA: fieldcat TYPE lvc_t_fcat.PARAMETERS: p_check.INITIALIZATION. PERFORM get_data.AT SELECTION-SCREEN OUTPUT. DATA: variant TYPE disvariant.
DATA: repid TYPE sy-repid. repid = sy-repid. variant-report = sy-repid.
variant-username = sy-uname. layout-zebra = 'X'.
layout-edit_mode = 'X'. CHECK alv_container IS INITIAL. CREATE OBJECT alv_container
EXPORTING repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_left
extension = 1500. CREATE OBJECT alv_grid
EXPORTING
i_parent = alv_container.* ALV Specific. Data selection.
Populate Field Catalog
PERFORM get_fieldcatalog. CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = layout
is_variant = variant
i_save = 'U'
i_structure_name = 'I_ALV'
CHANGING
it_outtab = i_alv[]
it_fieldcatalog = fieldcat[].
START-OF-SELECTION.
FORM GET_DATA
FORM get_data. SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
FROM mara
INNER JOIN makt
ON maramatnr = maktmatnr
UP TO 100 ROWS
WHERE makt~spras = sy-langu. SORT i_alv ASCENDING BY matnr.ENDFORM. "get_data***************************************************************
Form Get_Fieldcatalog - Set Up Columns/Headers
FORM get_fieldcatalog. DATA: ls_fcat TYPE lvc_s_fcat.
REFRESH: fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Number'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '18'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-col_pos = '1'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Type'.
ls_fcat-fieldname = 'MTART'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '10'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-col_pos = '2'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Group'.
ls_fcat-fieldname = 'MATKL'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '12'.
ls_fcat-col_pos = '3'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'Size'.
ls_fcat-fieldname = 'GROES'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '30'. ls_fcat-col_pos = '4'.
APPEND ls_fcat TO fieldcat. CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Description'.
ls_fcat-fieldname = 'MAKTX'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '40'. ls_fcat-col_pos = '5'.
APPEND ls_fcat TO fieldcat.ENDFORM. "get_fieldcatalog
regards,
venkat -
Adding layout variant to selection screen
Hi all,
Currently I am working on report program, where I have to allow user to select his own output pattern. i.e layout variant is to be added to selection screen. The report uses object oriented ALV for display purpose. [set_table_for_first_display]
I made following steps,
1. Declared one parameter of type disvariant.
2. At selection-screen on value-request I called function REUSE_ALV_VARIANT_F4.
3. Passed internal table to method set_table_for_first_display.
Now I am able to create save new variant, on selection screen I can select the variant that I have created, but output shows the all the fields though
Only few are selected. Please tell me any modification so as to reflect the changes in output.
I am searching for a function which maintains fieldcat according to user defined variant.
Regards,
Nilesh kulkarni.U have to use REUSE_ALV_VARIANT_EXISTENCE inorder to use the layout u have selected
After ur code of REUSE_ALV_VARIANT_F4.
try this way
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
G_REPID = SY-REPID.
G_SAVE = 'A'.
FORM PAI_OF_SELECTION_SCREEN .
IF NOT P_LAYOUT IS INITIAL.
MOVE G_VARIANT TO GX_VARIANT.
MOVE P_LAYOUT TO GX_VARIANT-VARIANT.
CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
EXPORTING
I_SAVE = G_SAVE
CHANGING
CS_VARIANT = GX_VARIANT.
G_VARIANT = GX_VARIANT.
ELSE.
PERFORM VARIANT_INIT.
ENDIF.
ENDFORM. " PAI_OF_SELECTION_SCREEN
FORM variant_init .
CLEAR G_VARIANT.
G_VARIANT-REPORT = G_REPID.
ENDFORM. " variant_init
Then when u call ALV for display, pass ur display variant, in this case = g_variant
Reward if useful
Cheers
~Arun
Message was edited by:
Arun Shekhar -
How to dispay report with layout option in selection screen?
Hi all,
I have designed a report which also has a list box in the selection screen for the type of saved layout that users have saved. I want the report to be displayed in the layout that the user has entered.
Eg: if user chooses \RP from the listbox in the selection screen; then the layout format for \RP should be displayed as output of the report.Can anyone tell me how to do this?Thanks in Advance.Hi ,
parameters:p_vari type disvariant.
data: v_save type c.
v_save = 'A'.
data:i_variant type disvariant.
write the code in the At selection screen on value request p_vari.use the FM reuse_alv_variant_f4.
then in the at selection screen check weather the selected variant is existed by using the FM reuse_alv_variant_existance
and in the main GRID FM pass the variant internal table.
or check BALV* in the Se38 for examples
Regards,
Bharani, -
How to get rid of the loop in ALV output from At selection screen event?
I have several push buttons on a selection screen.
Clikc on a button, then it pops up an editable ALV report. (This gets triggered AT SELECTION SCREEN event.). REUSE_ALV_GRID_DISPLAY_LVC..
On the ALV output, I enabled F4 for a couple of fields. Once I click on the F4 button, ONF4 method gets triggerd and a pop up appears with custom search helps.
choose a line and it fills the cell.
Upto this it works fine.
Now I click on the BACK button at the ALV output, it takes me to the selection screen. I click on the button again, it show the editable ALV. Now when I click on the F4 button, the pop up comes up twice and the cell gets filled from the second pop - up.
How to control this?
Probably I am not refreshing something?
(I am using REUSE_ALV_GRID_DISPLAY_LVC and tooks ome code for ONF4 event from BCALV_*DATATYPES (forgot the exact name) program.)
Thanks,
VenHi,
FORM refresh_grid USING pw_grid TYPE REF TO cl_gui_alv_grid.
*Work area
DATA : wal_stable TYPE lvc_s_stbl.
CHECK NOT pw_grid IS INITIAL.
wal_stable-col = c_check.
wal_stable-row = c_check.
*Method to refresh grid
CALL METHOD pw_grid->refresh_table_display
EXPORTING
is_stable = wal_stable
i_soft_refresh = c_check
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDFORM. " refresh_grid
Thanks,
Sree. -
Problem with ALV and user defined selection screen. please help!
Hi Experts,
I have program which has a user defined selection screen 9001. On executing the selection screen i call a ALV using resuse_alv_grid function module.
What problem I am facing is that when I press back button from ALV page it goes to the se38 editor instead of selection screen.
How to resolve this?
Thanks
GopalHi,
This might be due to LEAVE TO TRANSACTION statement. You might be running the program from SE38. Try to run the program using Z-TCode assigned to it.
Thanks and Regards,
Bharat Kumar Reddy.V
Message was edited by: Bharat Reddy V -
Alv Output after dynamic selection screen
Hi Guys
I have coded a dynamic selection screen (shown below). I want to create an ALV report based on what the user enters in the selection screen. Is the right way of doing this to code an IF s_matnr is not initial statement then call all the subroutines for output of material data and then else call a second batch of subroutines for billing data. It seems a bit long winded to me but I haven't been able to find anything on google that clearly explains the approach.
REPORT ZTREVOR_DYNAMIC_ALV_MAKT_VBRP.
TABLES : makt,
marc,
t001w,
vbrk,
vbrp.
CONSTANTS : c_yes TYPE c VALUE '1',
c_no TYPE c VALUE '0'.
Selection-screen begin of block b1 with frame title text-sc1.
PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1, "Material
p_opt2 TYPE c RADIOBUTTON GROUP radi. "Billing Document
Selection-screen end of block b1.
Selection-screen begin of block b2 with frame title text-sc2.
SELECT-OPTIONS : s_matnr FOR makt-matnr MODIF ID op1, "Material
s_vbeln FOR vbrp-vbeln MODIF ID op2. "Billing Document
Selection-screen end of block b2.
T SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN .
IF screen-group1 = 'OP1' .
IF p_opt1 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
IF screen-group1 = 'OP2' .
IF p_opt2 = 'X' .
screen-invisible = c_no .
screen-active = c_yes .
ELSE.
screen-invisible = c_yes .
screen-active = c_no .
ENDIF.
MODIFY SCREEN .
ENDIF.
ENDLOOP.Hi,
First of all, you should check your radiobutton instead of select-option...
Then you will have to build the output internal table dynamically based on the option chosen. There are lot of example on SDN...
Here is a start: http://wiki.sdn.sap.com/wiki/display/Snippets/Tutorialabap-CodeforDynamicAlv+grid
Kr,
m. -
Layout variants in Selection screen
Hi All,
I have a requirement where i need to create a functinal key on selection screen'Disp Variant' and i need to provide F4 help when user click on button and when layout is selected the report should show the layout according to selected layout variant.
I have written following code but it is not workin for me.Please help.
initialisation.
wa_functxt-icon_id = icon_variants.
wa_functxt-quickinfo = 'CHOOSE'.
wa_functxt-icon_text = 'DISP VAR'.
sscrfields-functxt_01 = wa_functxt.
wa_functxt of type smp_dyntxt and sscrfields have been declared at top.
CLEAR: wa_variant2.
wa_variant2-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = ' '
CHANGING
cs_variant = wa_variant2
EXCEPTIONS
not_found = 2.
IF sy-subrc EQ 0.
PERFORM f_select_alv_variant.
ENDIF.
even this is in initialisation.
form F_SELECT_ALV_VARIANT .
MOVE sy-repid TO wa_variant1-report.
CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
EXPORTING
i_dialog = space
i_user_specific = 'X'
i_default = space
it_default_fieldcat = i_fieldcat[]
i_layout = wa_layout
IMPORTING
et_fieldcat = i_fieldcat[]
CHANGING
cs_variant = wa_variant2
EXCEPTIONS
wrong_input = 1
fc_not_complete = 2
not_found = 3
program_error = 4
OTHERS = 5.
IF sy-subrc EQ 0.
"Do nothing.
ENDIF.
endform.
AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
*When Display Variant button is clicked
WHEN c_fc01.
PERFORM f_f4_for_variant.
WHEN OTHERS.
ENDCASE.
form F_F4_FOR_VARIANT .
CLEAR: wa_variant1,
wa_variant2.
wa_variant1-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant1
i_save = 'U'
IMPORTING
e_exit = v_variant_exit
es_variant = wa_variant2.
PERFORM f_select_alv_variant.
IF v_variant_exit EQ 'X'..
PERFORM f_get_default_variant.
ENDIF.
endform.
Thanks in Advance,
AnjanaLet's discuss based on something. On that program, I don't have any issue, check it.
INCLUDE <icon>.
TABLES sscrfields.
DATA wa_variant1 TYPE disvariant.
DATA wa_variant2 TYPE disvariant.
SELECTION-SCREEN FUNCTION KEY 1.
PARAMETERS dummy.
INITIALIZATION.
DATA wa_functxt TYPE smp_dyntxt.
wa_functxt-icon_id = icon_variants.
wa_functxt-quickinfo = 'CHOOSE'.
wa_functxt-icon_text = 'DISP VAR'.
sscrfields-functxt_01 = wa_functxt.
PERFORM f_get_default_variant.
FORM f_get_default_variant.
CLEAR: wa_variant2.
wa_variant2-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = ' '
CHANGING
cs_variant = wa_variant2
EXCEPTIONS
not_found = 2.
ENDFORM. "f_get_default_variant
AT SELECTION-SCREEN.
PERFORM at_selection_screen.
*& Form at_selection_screen
* text
FORM at_selection_screen.
CASE sscrfields-ucomm.
*When Display Variant button is clicked
WHEN 'FC01'.
PERFORM f_f4_for_variant.
WHEN 'ONLI'.
DATA gt_output TYPE TABLE OF t000 WITH HEADER LINE.
SELECT * FROM t000 INTO TABLE gt_output.
DATA lo_table TYPE REF TO cl_salv_table.
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = lo_table
CHANGING
t_table = gt_output[].
CATCH cx_salv_msg.
ENDTRY.
DATA lo_layout TYPE REF TO cl_salv_layout.
lo_layout = lo_table->get_layout( ).
lo_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
DATA ls_layout_key TYPE salv_s_layout_key.
ls_layout_key-report = sy-repid.
lo_layout->set_key( ls_layout_key ).
DATA l_variant TYPE slis_vari.
l_variant = wa_variant2-variant.
lo_layout->set_initial_layout( l_variant ).
DATA lo_functions_list TYPE REF TO cl_salv_functions_list.
lo_functions_list = lo_table->get_functions( ).
lo_functions_list->set_all( ).
lo_table->display( ).
ENDCASE.
ENDFORM. "at_selection_screen
FORM f_f4_for_variant .
CLEAR: wa_variant1, wa_variant2.
wa_variant1-report = sy-repid.
DATA v_variant_exit TYPE flag.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = wa_variant1
i_save = 'U'
IMPORTING
e_exit = v_variant_exit
es_variant = wa_variant2.
IF v_variant_exit EQ 'X'..
PERFORM f_get_default_variant.
ENDIF.
ENDFORM. "F_F4_FOR_VARIANT -
Hi all,
I have created varient for my selection screen.
If other user run my program he should not see my varient.
please suggest me in this regard.
With rds
anandHi anand,
I guess there is no option to hide your variant from other user.
But there are other options like.,
Protect Variant - If you select the field Protect variant, the variant can only be changed by the person who created it or last changed it.
No Display - If you select the field Do not display variant, the variant name appears in the directory, but not in the general input help.
Regards,
Sachin M M -
Defaulting Varient on selection screen
Hi All,
For my program i have created one varient.which i have to default that varient when ever i executed that program.Is there any way that i can do this.
Thanks.you can define default values in the statement
parameters p_par type <type> default ' <your value >'.
This will set the default value for your selection screen.
Also you can you
RS_VARIANT_DISPLAY
to create variant
Regards,
Lalit Mohan Gupta.
Maybe you are looking for
-
Can i upload the same songs and apps to my new ipod touch that was on my stolen I pod touch?
i want to upload all my apps that i bought on my stolen ipod touch to my new ipod touch is this possible
-
Hi gurus, I have the following scenario: The MB03 material document # 4928972791 (2008) has 2 accounting documents linked to it; 4913234128 u2013 this is a WA document type posted with MIGO by the mill (user inputs a quantity only) 4800228727 u2013 t
-
Problem connecting 7.1 speaker system to iMac
I purchased creative 7.1 speaker system yesterday (Model No: Inspire:T7900). The package contains a cable to connect iMac and woofer system. The cable has 4 pins to one end and 3 pin to other end. According to the manual, I connected the 4 pins to wo
-
Scripting QTP to start a new Audio Capture
I'm trying to find a way to have QTPro open and start recording an audio capture at a preprogrammed time of day. Sort of a audio DVR if you will. What app do you think I can use that has a clock I can link to QT? Thanks
-
I got a new hard drive and downloaded my DVD music backup from the old drive. Went fine for the 1st DVD ( backup on 2 DVD's) Later on when I went to download the 2nd I find iTunes won't open now. When I go to force quit it says iTunes not responding.