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: 

help neede

Former Member
0 Kudos
101

Hi Guys,

i have a situation. I have 2 fields material number and serial number. Now the client wants that if i key in a material number and then press F4 in the serial number then all the values for equi-sernr for that particular material number should come up.

Please help me out regarding this.

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos
78

Hi

This is the Sample code .. just change the fields as per the need.

PARAMETERS: p_vbeln TYPE vbaP-VBELN,

p_posnr TYPE vbap-posnr,

P_MATKL TYPE VBAP-MATKL.

DATA : IT_RTAB TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.

DATA: BEGIN OF help_item OCCURS 0,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

MATKL TYPE VBAP-MATKL,

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 MATKL 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

  • DDIC_STRUCTURE = ' '

retfield = 'POSNR'

dynprofield = 'P_POSNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = HELP_ITEM

  • FIELD_TAB =

RETURN_TAB = IT_RTAB

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 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.

ENDIF.

<b>REWARD IF HELPFUL.</b>

2 REPLIES 2

Former Member
0 Kudos
78

Hi,

What you can do is, once you key in the material number, using event,

AT SELECTION-SCREEN ON FIELD p_matnr.
" Export the value entered to ABAP Memory.

Now, when you press F4 Help on Serial Number,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_serial.
" Retreive the material number from ABAP Memory into a local variable.
" SELECT equi-sernr FROM TABLE WHERE MATNR = (Localvariable).
" Call the F4_INT_VALUE_REQUEST function module.

This would help you to provide the serial number for the entered material number.

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

Best Regards,

Ram

varma_narayana
Active Contributor
0 Kudos
79

Hi

This is the Sample code .. just change the fields as per the need.

PARAMETERS: p_vbeln TYPE vbaP-VBELN,

p_posnr TYPE vbap-posnr,

P_MATKL TYPE VBAP-MATKL.

DATA : IT_RTAB TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.

DATA: BEGIN OF help_item OCCURS 0,

posnr TYPE vbap-posnr,

matnr TYPE vbap-matnr,

MATKL TYPE VBAP-MATKL,

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 MATKL 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

  • DDIC_STRUCTURE = ' '

retfield = 'POSNR'

dynprofield = 'P_POSNR'

dynpprog = sy-cprog

dynpnr = sy-dynnr

  • STEPL = 0

  • WINDOW_TITLE =

  • VALUE = ' '

VALUE_ORG = 'S'

  • MULTIPLE_CHOICE = ' '

  • DISPLAY = ' '

  • CALLBACK_PROGRAM = ' '

  • CALLBACK_FORM = ' '

  • MARK_TAB =

  • IMPORTING

  • USER_RESET =

TABLES

VALUE_TAB = HELP_ITEM

  • FIELD_TAB =

RETURN_TAB = IT_RTAB

  • DYNPFLD_MAPPING =

  • EXCEPTIONS

  • PARAMETER_ERROR = 1

  • NO_VALUES_FOUND = 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.

ENDIF.

<b>REWARD IF HELPFUL.</b>