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 - table control

former_member386063
Participant
0 Likes
539

Hello,

I'am designing a screen in module pool programming.

It is having i/o fields from different tables.

There are two table controls in it having fields from different tables again.

The tables in database are properly related to each other through foreign keys.

I need to connect the values to be taken in i/o field to table control.

According to the value in i/o field, related values should appear in table control.

One table control is having two fields in it. If one value is selected from 1st field then corresponding values should come in 2nd field

of table control.

And if same value is selected from 1st field in the 2nd row of table control then the list of corresponding values in the 2nd field should not display the value previously selected from 2nd field.

Please Help!!

2 REPLIES 2
Read only

sivaganesh_krishnan
Contributor
0 Likes
492

HI Titiksha,

Based on your scenario, you can create a search help for first field using POV and inside POV try to generating the Dynamic Search help using 'F4IF_INT_TABLE_VALUE_REQUEST' .

Refer for FM 'F4IF_INT_TABLE_VALUE_REQUEST' = https://scn.sap.com/thread/928071

After selecting the row in order to update the 2nd field use the following fm

data :  step_line type sy-stepl.

DATA: dynpfields TYPE TABLE OF dynpread,
            x_dynpfields TYPE dynpread.

  CALL FUNCTION 'DYNP_GET_STEPL'

    IMPORTING

      povstepl        = step_line

    EXCEPTIONS

      stepl_not_found = 1

      OTHERS          = 2.



  CLEAR x_dynpfields.

  x_dynpfields-fieldname  = ' '. "Screen field name

  x_dynpfields-fieldvalue = ''.

  x_dynpfields-stepl = step_line.                 "table control row

  APPEND x_dynpfields TO dynpfields.

CALL FUNCTION 'DYNP_VALUES_UPDATE'

    EXPORTING

      dyname                     = sy-cprog

      dynumb                     = sy-dynnr

    TABLES

      dynpfields                 = dynpfields

*   EXCEPTIONS

*     INVALID_ABAPWORKAREA       = 1

*     INVALID_DYNPROFIELD        = 2

*     INVALID_DYNPRONAME         = 3

*     INVALID_DYNPRONUMMER       = 4

*     INVALID_REQUEST            = 5

*     NO_FIELDDESCRIPTION        = 6

*     UNDEFIND_ERROR             = 7

*     OTHERS                     = 8

            .

Hope this helps.

Regards,

Sivaganesh.

Read only

Former Member
0 Likes
492

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

Step 3:

Then use this fm

'F4IF_INT_TABLE_VALUE_REQUEST'

example:

DATA :

        lv_stepl                TYPE          sy-stepl ,

        t_screen_values  TYPE TABLE OF dynpread ,

        x_screen_values  TYPE          dynpread,

     

       t_rtn                        TYPE TABLE OF       ddshretval,

CALL FUNCTION 'DYNP_GET_STEPL'

    IMPORTING

      povstepl = lv_stepl.

  x_screen_values-stepl     = lv_stepl .

  x_screen_values-fieldname = 'ZAPS_SERVICE-SER_NAME' ."fieldname

  APPEND x_screen_values TO t_screen_values .



  CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname     = sy-repid

      dynumb     = sy-dynnr

    TABLES

      dynpfields = t_screen_values.



  READ TABLE t_screen_values INTO x_screen_values INDEX 1 .

  IF sy-subrc = 0.

    SELECT     item_name         "fetching item name based on the hotel and type of service

               price

    FROM       zapt_item_list

    INTO TABLE lt_item_name

    WHERE      hid EQ zapt_bokin_head-hid AND service_name = x_screen_values-fieldvalue .



    IF sy-subrc = 0 .

      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

        EXPORTING

          retfield    = 'ITEM_NAME'

          dynpprog    = sy-repid

          dynpnr      = sy-dynnr

          dynprofield = 'ZAPS_SERVICE-ITEM_NAME'

          value_org   = 'S'

        TABLES

          value_tab   = lt_item_name

          return_tab  = t_rtn.

      CLEAR lt_item_name .

    ENDIF.