2015 May 05 3:03 PM
hi ji's,
I need to know what to do to get the "alv_layout" parameter in my selection screen. actually now am using "reuse_alv_list_display" for this i got the
alv layout variant in my selection screen I can select the desire layout option which i saved before. its all working fine..
but now i need to know how to do for "cl_salv_table" . I am going to use "cl_salv_table" instead of "reuse_alv_list_display". I know am unable to use
"'REUSE_ALV_VARIANT_F4'.
please help me to do this friends.
thanks in advance.
2015 May 05 3:47 PM
Hi,
Please implement the below code.
REPORT ZLAYOUT_VARIET.
data:BEGIN OF wa_kna1,
kunnr type kunnr,
name1 type name1,
ort01 type ort01,
end of wa_kna1.
data:it_kna1 like TABLE OF wa_kna1,
set_key type SALV_S_LAYOUT_KEY,
G_EXIT TYPE C,
G_VARIANT TYPE DISVARIANT,
SET_LAY TYPE SLIS_VARI.
data:r_alv type REF TO cl_salv_table,
r_lay type REF TO CL_SALV_LAYOUT.
PARAMETERS:p_var type DISVARIANT-VARIANT.
INITIALIZATION.
G_varIANT-report = sy-repid.
at SELECTION-SCREEN on VALUE-REQUEST FOR p_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
I_SAVE = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = G_VARIANT
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC = 0.
P_VAR = G_VARIANT-VARIANT.
SET_LAY = G_VARIANT-VARIANT.
ENDIF.
START-OF-SELECTION.
select kunnr name1 ort01 FROM kna1 INTO TABLE it_kna1 where kunnr BETWEEN '1000' and '1500'.
set_key-REPORT = sy-repid.
TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
EXPORTING
LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER =
* CONTAINER_NAME =
IMPORTING
R_SALV_TABLE = r_alv
CHANGING
T_TABLE = it_kna1.
CATCH CX_SALV_MSG .
ENDTRY.
CALL METHOD R_ALV->GET_LAYOUT
RECEIVING
VALUE = r_lay.
CALL METHOD R_LAY->SET_KEY
EXPORTING
VALUE = Set_key.
CALL METHOD R_LAY->SET_SAVE_RESTRICTION
EXPORTING
VALUE = IF_SALV_C_LAYOUT=>RESTRICT_NONE
.
CALL METHOD R_LAY->SET_INITIAL_LAYOUT
EXPORTING
VALUE = SET_LAY
.
CALL METHOD R_ALV->DISPLAY
.
Regards,
Quddus.
hi ji's,
I need to know what to do to get the "alv_layout" parameter in my selection screen. actually now am using "reuse_alv_list_display" for this i got the
alv layout variant in my selection screen I can select the desire layout option which i saved before. its all working fine..
but now i need to know how to do for "cl_salv_table" . I am going to use "cl_salv_table" instead of "reuse_alv_list_display". I know am unable to use
"'REUSE_ALV_VARIANT_F4'.
please help me to do this friends.
thanks in advance.
2015 May 05 3:12 PM
2015 May 05 3:25 PM
hi Ali Fragozo ,
thanks for your reply, already I have seen this program I have doubts and lot of confusions.
just can I take the "perform f4_layouts" part or I should nee to declare class and implement it. bcoz inside that perform there is no need of class .
please correct me if am wrong.
2015 May 05 3:47 PM
Hi,
Please implement the below code.
REPORT ZLAYOUT_VARIET.
data:BEGIN OF wa_kna1,
kunnr type kunnr,
name1 type name1,
ort01 type ort01,
end of wa_kna1.
data:it_kna1 like TABLE OF wa_kna1,
set_key type SALV_S_LAYOUT_KEY,
G_EXIT TYPE C,
G_VARIANT TYPE DISVARIANT,
SET_LAY TYPE SLIS_VARI.
data:r_alv type REF TO cl_salv_table,
r_lay type REF TO CL_SALV_LAYOUT.
PARAMETERS:p_var type DISVARIANT-VARIANT.
INITIALIZATION.
G_varIANT-report = sy-repid.
at SELECTION-SCREEN on VALUE-REQUEST FOR p_var.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = G_VARIANT
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
I_SAVE = 'A'
* I_DISPLAY_VIA_GRID = ' '
IMPORTING
E_EXIT = G_EXIT
ES_VARIANT = G_VARIANT
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC = 0.
P_VAR = G_VARIANT-VARIANT.
SET_LAY = G_VARIANT-VARIANT.
ENDIF.
START-OF-SELECTION.
select kunnr name1 ort01 FROM kna1 INTO TABLE it_kna1 where kunnr BETWEEN '1000' and '1500'.
set_key-REPORT = sy-repid.
TRY.
CALL METHOD CL_SALV_TABLE=>FACTORY
EXPORTING
LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
* R_CONTAINER =
* CONTAINER_NAME =
IMPORTING
R_SALV_TABLE = r_alv
CHANGING
T_TABLE = it_kna1.
CATCH CX_SALV_MSG .
ENDTRY.
CALL METHOD R_ALV->GET_LAYOUT
RECEIVING
VALUE = r_lay.
CALL METHOD R_LAY->SET_KEY
EXPORTING
VALUE = Set_key.
CALL METHOD R_LAY->SET_SAVE_RESTRICTION
EXPORTING
VALUE = IF_SALV_C_LAYOUT=>RESTRICT_NONE
.
CALL METHOD R_LAY->SET_INITIAL_LAYOUT
EXPORTING
VALUE = SET_LAY
.
CALL METHOD R_ALV->DISPLAY
.
Regards,
Quddus.
2015 May 05 4:25 PM
hi Mohammed Quddus,
thanks for your reply. your code helped me out partially but the issue am facing is i can able to save my layout but the alv output is always showing the default layout. its not showing the output by the selected layout.
actually the same problem i face when i did with resue_alv_grid_display but time i declared variant inside the from so i faced this. now i declared all as global.
still I am facing the issue.
2015 May 05 4:46 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |