2008 Aug 04 5:47 PM
Hi All
I want to create filter option in ALV layout,I created by using FM REUSE_ALV_VARIANT_F4.but getting sy-subrc = 1.
Could you tell me why its happening ?
To be reward all helpful answers,
Regards,
Jay.
2008 Aug 04 6:23 PM
Hi,
I coudn't tell you exactly...i'm providing a link of sample code using that function module...
Please check this link...
[Sample code for FM--REUSE_ALV_VARIANT_F4|http://www.sap-img.com/abap/use-simple-alv-functions-to-make-reporting-easy.htm]
Hope this would help you.
Good luck
Narin
2008 Aug 04 6:36 PM
Hi
I think that you have a problem in the call of the function
Look part of mi code:
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
IS_VARIANT = VARIANTE
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
I_SAVE = 'X'
I_DISPLAY_VIA_GRID = 'X'
IMPORTING
E_EXIT = variante_exit
ES_VARIANT = def_variante
EXCEPTIONS
NOT_FOUND = 1
PROGRAM_ERROR = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
IF VARIANTE_EXIT NE 'X'.
XVARIAN = DEF_VARIANTE-VARIANT.
ENDIF.
ENDIF.
can you write your code ? or part of your code?
Regards
Gregory
2008 Aug 04 6:47 PM
Hi,
you will get sy-subrc = 1 if it fails to find the variant. if sy-subrc <> 0, you can use else part to fill the layout
you can use like
gs_variant-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = gs_variant
i_save = 'A'
IMPORTING
e_exit = fl_exit
es_variant = *gs_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 fl_exit = space.
p_layout = *gs_variant-variant.
ENDIF.
ENDIF.
Please reward if you find the answer useful.
Thanks,
Kamesh Bathla
2008 Aug 05 3:42 PM