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: 

About AT SELECTION SCREEN

Former Member
0 Kudos

Hi guys,

I need help about AT SELECTION SCREEN ON VALUE REQUEST FOR a.

Actually, I need this to be ON VALUE REQUEST FOR a and b, because I need to update both parameter with this single search help. Can anybody show me how to do this?

Thanks before.

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

Hi...Samanta...

This is the proper code that give u the Complete info on How to write the Logic:

REPORT zsel_f4help .

*---Report with selection screen and to display the list of

  • possible entries for field 'B' as per the value in field 'A'.

PARAMETERS: p_vbeln TYPE vbak-vbeln,

p_posnr TYPE vbap-posnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.

DATA: BEGIN OF help_item OCCURS 0,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

arktx TYPE vbap-arktx,

END OF help_item.

DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE.

dynfields-fieldname = 'P_VBELN'.

APPEND dynfields.

**Read the Values of the SCREEN FIELDs

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.

**Find out the Value of P_VBELN

READ TABLE dynfields WITH KEY fieldname = 'P_VBELN'.

p_vbeln = dynfields-fieldvalue.

**Convert the Value into internal format

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_vbeln

IMPORTING

output = p_vbeln.

**Fetch the correponding itemnos from VBAP

SELECT posnr matnr arktx INTO TABLE help_item

FROM vbap

WHERE vbeln = p_vbeln.

**Generate the F4 help with internal table values

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'POSNR'

dynprofield = 'P_POSNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = help_item.

<b>Reward if Helpful</b>

6 REPLIES 6

Former Member
0 Kudos

Hi!

Have you tried

AT SELECTION SCREEN ON VALUE REQUEST FOR a.

...

AT SELECTION SCREEN ON VALUE REQUEST FOR b.

...

I've found it in the help:

Addition 3

... ON VALUE-REQUEST FOR psel_low_high

Effect

In this addition, the field psel_low_high iseither the name of a report parameter or of the form sel-LOW orsel-HIGH, where sel is the name of a selection criterion.The effect of this is twofold:

The possible entries pushbutton for F4 appears beside theappropriate field.

When the user activates this pushbutton or presses F4 for thefield, the event is executed. You can thus implement a self-programmedpossible entries routine for the input/output fields of the selectionscreen. If the program contains such an event and the user pressesF4, the system processes this rather than displaying the checktable or the fixed values of the Dictionary field - even if the reportparameter or the selection option with LIKE or FOR pointsto a Dictionary field. You can, for example, use the CALL SCREEN statement to display a selection list ofpossible values. The contents of the field psel_low_high at theend of this processing block are copied to the appropriate input/outputfield.

This addition is only allowed with report-specific parameters ( PARAMETERS ) or selection options (SELECT-OPTIONS). Fordatabase-specific parameters or selection options, you can achieve thesame effect by using the addition VALUE-REQUEST FOR ... with thekey word PARAMETERS or SELECT-OPTIONS in the includeDBxyzSEL (where xyz = name of logical database). In this case,you must program the possible entries in the database programSAPDBxyz.

Regards

Tamás

Message was edited by:

Tamás Nyisztor

Former Member
0 Kudos

Hi Samanta,

You cannot use AT SELECTION SCREEN ON VALUE REQUEST FOR a and b.

Instead what you can do is,

Write the code for search help in a sub-routine.

FORM Search_help.

ENDFORM.

Now,

AT SELECTION SCREEN ON VALUE REQUEST FOR a.

PERFORM Search_help.

AT SELECTION SCREEN ON VALUE REQUEST FOR b.

PERFORM Search_help.

Meaning, call the same sub-routine for both the events. This solves the purpose.

<b>Reward points for helpful answers.</b>

Best Regards,

Ram.

Former Member
0 Kudos

hi,

giv separately...

AT SELECTION SCREEN ON VALUE REQUEST FOR VAL1

...

AT SELECTION SCREEN ON VALUE REQUEST FOR VAL2.

With Regards,

S.Barani

Former Member
0 Kudos

Hi,

You could use

AT SELECTION SCREEN ON VALUE REQUEST FOR a. Get the values for a first. Then fetch the corresponding values for b. Then populate the b in the selection screen. So the effect is, when user clicks f4 he will select a and after he says continue he can see 2 values in a and b.

Thanks...

Preetham S

Former Member
0 Kudos

hi

u can do it separately for both fields as it does not allow for 2 fields simultaneously.

varma_narayana
Active Contributor
0 Kudos

Hi...Samanta...

This is the proper code that give u the Complete info on How to write the Logic:

REPORT zsel_f4help .

*---Report with selection screen and to display the list of

  • possible entries for field 'B' as per the value in field 'A'.

PARAMETERS: p_vbeln TYPE vbak-vbeln,

p_posnr TYPE vbap-posnr.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.

DATA: BEGIN OF help_item OCCURS 0,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

arktx TYPE vbap-arktx,

END OF help_item.

DATA: dynfields TYPE TABLE OF dynpread WITH HEADER LINE.

dynfields-fieldname = 'P_VBELN'.

APPEND dynfields.

**Read the Values of the SCREEN FIELDs

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.

**Find out the Value of P_VBELN

READ TABLE dynfields WITH KEY fieldname = 'P_VBELN'.

p_vbeln = dynfields-fieldvalue.

**Convert the Value into internal format

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_vbeln

IMPORTING

output = p_vbeln.

**Fetch the correponding itemnos from VBAP

SELECT posnr matnr arktx INTO TABLE help_item

FROM vbap

WHERE vbeln = p_vbeln.

**Generate the F4 help with internal table values

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'POSNR'

dynprofield = 'P_POSNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

value_org = 'S'

TABLES

value_tab = help_item.

<b>Reward if Helpful</b>