‎2009 Feb 27 9:52 AM
Hello Experts,
I m using one parameter for layout like in std report MB51 & put F4 help for that.
My problem is when user select from layout it is working fine but when user ENTER FROM KEYBOARD it is not accepting the layout..
My code is
PARAMETERS :p_layout LIKE disvariant-variant.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM alv_f4 USING sy-repid p_layout.
FORM alv_f4 USING p_report CHANGING p_layout.
l_layout-report = sy-repid .
dynfields-fieldname = 'P_LAYOUT'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields
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.
read table dynfields with key fieldname = 'P_LAYOUT'.
p_layout = dynfields-fieldvalue.
CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = l_layout
i_save = 'A'
IMPORTING
es_variant = l_layout
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_layout = l_layout-variant.
ENDIF.
ENDFORM.
Plz suggest where i m wrong.
Ravi
‎2009 Feb 27 10:18 AM
you are not capturing teh value enterd manually into the p_layout, but you are handling when user press F4.
‎2009 Feb 27 10:20 AM
Hi,
Refer this code. It will definitely help you.
Check the use of variant in ALV.
Regards,
Tarun
‎2009 Feb 27 10:22 AM
Hi,
you need to check this l_layout structure is initial or not before calling the ALV grid display FM.
If user select from F4 help then l_layout structure get's populated. if user enter's then this structure donot get populated. so you need to check if initial populate this structure before passing.