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: 

F4 help for layout parameter

Former Member
0 Kudos
1,046

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

3 REPLIES 3

Former Member
0 Kudos
132

you are not capturing teh value enterd manually into the p_layout, but you are handling when user press F4.

I355602
Advisor
Advisor
0 Kudos
132

Hi,

Refer this code. It will definitely help you.

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/learn%252bto%252bdisplay%252bdata%252bin...

Check the use of variant in ALV.

Regards,

Tarun

Former Member
0 Kudos
132

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.