Application Development and Automation 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: 
Read only

Data entry in module pool screen

Former Member
0 Likes
4,763

Hi all,

I have created a module pool program. on the screen of the program, i have entered a dictionary field KNA1-KUNNR. On the second field on the screen, i have coded a search help to generate the F4 help based on the entries in the first field. Now the problem is that the entry made in the first screen is not available in the code, i.e. when i have entered a value in the first screen, in the debugger it shows the field as empty. i tried declaring a variable of the same name as the field, but it gives me error that the variable is already declared. any help will be appreciated.

regards,

hamza

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,506

Hi.

just check it when u enter the value in ist parameter then u press the enter key or not.

if not then press the enter key and then check in debugger or where u are checking the value (i.e where it is not coming)

10 REPLIES 10
Read only

Former Member
0 Likes
3,506

Hi,

Use teh FM DYNP_VALUES_READ to get the screen values.

Read only

0 Likes
3,506

i am creating a table for manual entry in module pool but problem is whenever user enter material no the description should automatically comes in other field and at last the data should save in the table i will attach you the screen shot pls guide me. when user press enter the field entry disappears.

Read only

GauthamV
Active Contributor
0 Likes
3,506

try this.

execute and check the selection screen fields.



tables tcurt.
DATA DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS, "Currency
P_LTEXT LIKE TCURT-LTEXT, "Long Text
P_KTEXT LIKE TCURT-KTEXT. "Short Text

*Example of updating value of another field on the screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
CLEAR: DYFIELDS[], DYFIELDS.
*select currency
CALL FUNCTION 'HELP_VALUES_GET'
EXPORTING
fieldname = 'WAERS'
tabname = 'TCURT'
IMPORTING
SELECT_VALUE = P_WAERS.

*get long text for the selected currency
SELECT SINGLE LTEXT FROM TCURT
INTO DYFIELDS-FIELDVALUE
WHERE SPRAS = SY-LANGU
AND WAERS = P_WAERS.
IF SY-SUBRC <> 0.
CLEAR DYFIELDS-FIELDVALUE.
ENDIF.

*update another field
DYFIELDS-FIELDNAME = 'P_LTEXT'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
tables
dynpfields = DYFIELDS .

*Example of reading value of another field
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*read another field
CLEAR: DYFIELDS[], DYFIELDS.
DYFIELDS-FIELDNAME = 'P_WAERS'.
APPEND DYFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYFIELDS .
READ TABLE DYFIELDS INDEX 1.

*get short text and update current field
SELECT SINGLE KTEXT FROM TCURT
INTO P_KTEXT
WHERE SPRAS EQ SY-LANGU
AND WAERS EQ DYFIELDS-FIELDVALUE.

Read only

Former Member
0 Likes
3,507

Hi.

just check it when u enter the value in ist parameter then u press the enter key or not.

if not then press the enter key and then check in debugger or where u are checking the value (i.e where it is not coming)

Read only

0 Likes
3,506

Thank you all for your quick replies. Tahir's reply got me thinking about the solution. The problem was that i had declared the second field as mandatory, so without the entry in the second field, data from the screen was not being passed to the code when i pressed enter. Once again, thank you all for your reply.

regards,

Hamza

Read only

Former Member
0 Likes
3,506

Hi,

You have to use the below 2 FM to do this task

1.DYNP_VALUES_READ that actually reads the data from the screen field, internal table to be passed should be of type DYNPREAD,FIELDNAME AND FIELDVALUE are the two attributes to be used for this FM.

2.F4IF_INT_TABLE_VALUE_REQUEST that gives f4 help depending upon the screen field value.

Pooja

Read only

Former Member
0 Likes
3,506

Hi,

You can write like:

DATA : TB_DYNPFIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE. "internal table declared

CLEAR: TB_DYNPFIELDS.

REFRESH: TB_DYNPFIELDS.

MOVE 'ZTG_EMP-HLTH_PLAN' TO TB_DYNPFIELDS-FIELDNAME. " fieldname whose value needs to be catched dynamically

APPEND TB_DYNPFIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'SAPMZTG01' *"program name *

DYNUMB = '1010' "screen number

  • TRANSLATE_TO_UPPER = ' '

  • REQUEST = ' '

  • PERFORM_CONVERSION_EXITS = ' '

  • PERFORM_INPUT_CONVERSION = ' '

  • DETERMINE_LOOP_INDEX = ' '

  • START_SEARCH_IN_CURRENT_SCREEN = ' '

  • START_SEARCH_IN_MAIN_SCREEN = ' '

  • START_SEARCH_IN_STACKED_SCREEN = ' '

  • START_SEARCH_ON_SCR_STACKPOS = ' '

  • SEARCH_OWN_SUBSCREENS_FIRST = ' '

  • SEARCHPATH_OF_SUBSCREEN_AREAS = ' '

TABLES

DYNPFIELDS = TB_DYNPFIELDS "internal table to be passed

  • 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

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

READ TABLE TB_DYNPFIELDS INDEX 1.

IF SY-SUBRC EQ 0.

PLAN_ID = TB_DYNPFIELDS-FIELDVALUE. *"internal table passed in the funcn module has one field as fieldvalue which will catch that fields value dynamically *

ENDIF.

Hope it helps you

Regrds

Mansi

Read only

0 Likes
3,506

i am creating a table for manual entry in module pool but problem is whenever user enter material no the description should automatically comes in other field and at last the data should save in the table i will attach you the screen shot pls guide me. when user press enter the field entry disappears.

Read only

Former Member
0 Likes
3,506

Hii use this FM to read values in screen fields.

DYNP_VALUE_READ

Use of this FM causes forced transfer of data from screen fields to ABAP fields.

There are 3 exporting parameters

DYNAME = program name = SY-CPROG

DYNUMB = Screen number = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

and one importing TABLE parameter

DYNPFIELDS = Table of TYPE DYNPREAD

The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD

to this FM and the values read from the screen will be stored in this table.This

table consists of two fields:

FIELDNAME : Used to pass the name of screen field for which the value is to

be read.

FIELDVALUE : Used to read the value of the field in the screen.

e.g.

DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,

SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.

SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read

APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = SY-CPROG

DYNUMB = SY-DYNNR

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = SCREEN_VALUES.

READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill

the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.

Hope this Helps you,

Regards,

Sandy.

Read only

0 Likes
3,506

i am creating a table for manual entry in module pool but problem is whenever user enter material no the description should automatically comes in other field and at last the data should save in the table i will attach you the screen shot pls guide me. when user press enter the field entry disappears.