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

Module Pool Programming

Former Member
0 Likes
1,135

Hi,

I have a requirement where i have to do screen enhancement for the tcode CJ20N at the Project definition.

I have added total 3fields. Now depending on the input of the 1 and 2 fields i want to fetch the drop down values for the 3 field.

but i couldn't able to know how to read the first two fields in the program.

Where does the values given on the screen will get stored.

Please help in this regard.

Regards,

NSK

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,091

Hi Shashikanth ,

Inside the Module dynamic_f4_help write these codes  .

CALL FUNCTION 'DYNP_GET_STEPL'         "to fetch the stepl of the screen

  IMPORTING

    povstepl               = lv_stepl                     (lv_stepl should be of the type sy-stepl ) .

DATA :

         t_screen_values  TYPE TABLE OF dynpread ,
         x_screen_values  TYPE          dynpread.

x_screen_values-stepl = lv_stepl .                          "adding first field of which value to be fetched

  x_screen_values-fieldname = 'ZAPS_ROOMS-CHK_IN_DAT' . (Your first  fieldname based on which the field 3 should be filled)

  APPEND x_screen_values TO t_screen_values .

  CLEAR x_screen_values .

  x_screen_values-stepl = lv_stepl .                     "adding second field of which value to be fetched

  x_screen_values-fieldname = 'ZAPS_ROOMS-CHK_OUT_DAT' . (Your 2nd  fieldname based on which the field 3 should be filled)

  APPEND x_screen_values TO t_screen_values .

  CLEAR x_screen_values .

  

CALL FUNCTION 'DYNP_VALUES_READ'         (reads the values of the two fields you mentioned)

    EXPORTING

      dyname     = sy-repid

      dynumb     = sy-dynnr

    TABLES

      dynpfields = t_screen_values.

Now you need to fill the internal table ( lt_ro ) based on your logic using two fields .

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

        retfield    = 'ROM_NO'

        dynpprog    = sy-repid

        dynpnr      = sy-dynnr

        dynprofield = 'FIELD 3 NAME'

        value_org   = 'S'

      TABLES

        value_tab   = lt_ro                     (Internal table filled based on the two fields )

        return_tab  = t_rtn.

I suggest you to put search help .If u are using drop down .Initially it will load 3rd field value based on the first two fields but when you enter new values on the first two fields,3rd field dropdown will not get refreshed .

6 REPLIES 6
Read only

Former Member
0 Likes
1,091

If you want to read the values entered as input parameter to the current screen (which havent been submitted yet), you can use the following FM to get the values entered in the fields of the current screen:

CALL FUNCTION 'DYNP_VALUES_READ'

  EXPORTING

    dyname               = sy-repid

    dynumb               = sy-dynnr

  TABLES

    dynpfields           = li_dynpfields

  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.

You can accordingly add enhancements for the same.

Read only

Former Member
0 Likes
1,091

hi

as u have 3 fields on the screen.......the value will get stored in the corresponding textlabel name that you have given.

after drag and dropping the the textlabesls. just double click on the the textlabel and give any name you like. then you can use the same name in  you moudle program. the values will be recieved. you can store the value to another temp variable depending upon your convinience.

With regards

Suneesh

Read only

anubhab
Active Participant
0 Likes
1,091

Hello Shashikanth,

You need to put your logic for the first two fields in the PAI of that screen, where you added those two fields. Hope you declared some parameters/ select-options for those fields. The values for those fields will be stored in those parameters/ select-options. And you just need to create a module in the PAI and do your coding in that module.

Please check the attached screen-shots once. Hope this clarifies your query.

Regards,

Anubhab

Read only

Former Member
0 Likes
1,092

Hi Shashikanth ,

Inside the Module dynamic_f4_help write these codes  .

CALL FUNCTION 'DYNP_GET_STEPL'         "to fetch the stepl of the screen

  IMPORTING

    povstepl               = lv_stepl                     (lv_stepl should be of the type sy-stepl ) .

DATA :

         t_screen_values  TYPE TABLE OF dynpread ,
         x_screen_values  TYPE          dynpread.

x_screen_values-stepl = lv_stepl .                          "adding first field of which value to be fetched

  x_screen_values-fieldname = 'ZAPS_ROOMS-CHK_IN_DAT' . (Your first  fieldname based on which the field 3 should be filled)

  APPEND x_screen_values TO t_screen_values .

  CLEAR x_screen_values .

  x_screen_values-stepl = lv_stepl .                     "adding second field of which value to be fetched

  x_screen_values-fieldname = 'ZAPS_ROOMS-CHK_OUT_DAT' . (Your 2nd  fieldname based on which the field 3 should be filled)

  APPEND x_screen_values TO t_screen_values .

  CLEAR x_screen_values .

  

CALL FUNCTION 'DYNP_VALUES_READ'         (reads the values of the two fields you mentioned)

    EXPORTING

      dyname     = sy-repid

      dynumb     = sy-dynnr

    TABLES

      dynpfields = t_screen_values.

Now you need to fill the internal table ( lt_ro ) based on your logic using two fields .

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

      EXPORTING

        retfield    = 'ROM_NO'

        dynpprog    = sy-repid

        dynpnr      = sy-dynnr

        dynprofield = 'FIELD 3 NAME'

        value_org   = 'S'

      TABLES

        value_tab   = lt_ro                     (Internal table filled based on the two fields )

        return_tab  = t_rtn.

I suggest you to put search help .If u are using drop down .Initially it will load 3rd field value based on the first two fields but when you enter new values on the first two fields,3rd field dropdown will not get refreshed .

Read only

Former Member
0 Likes
1,091

Hi

  I think you can use this FMs

Step 1:

'DYNP_GET_STEPL'

In a module at the time Process On Value-Request (POV), the functionmodule defines the current step loop line from which the F4 help wascalled

Step 2 .

call another function module :

DYNP_VALUES_READ  (reads the values of the fields you mentioned)

Step 3:

Then use this fm

'F4IF_INT_TABLE_VALUE_REQUEST'

pls check this link http://scn.sap.com/thread/3426982

Read only

sivaganesh_krishnan
Contributor
0 Likes
1,091

HI Shashikanth,

  1.Please refer this link : DYNP_VALUES_READ | SCN

  2. You will get the values in  xdynpfields-fieldvalue . Just refer the link that i showed you for getting    the values.

  3.Based on the value , entered write your logic in inserting values in drop down list. http://help.sap.com/saphelp_470/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm