Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

sy-subrc =1 in FM REUSE_ALV_VARIANT_F4

Former Member
0 Kudos
420

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.

4 REPLIES 4

narin_nandivada3
Active Contributor
0 Kudos
149

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

Former Member
0 Kudos
149

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

Former Member
0 Kudos
149

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

Former Member
0 Kudos
149

thanks for all