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

Table Control dynamic F4

Former Member
0 Likes
1,770

Hi All

i have created a table control in that i have two fields

one is o/p filed and another one is i/p filed i have place a f4 for that

and if i press f4 for first column i need values

and if i press f4 for second column i need different values

how to do that

can u please tel some to solve this

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
920

Hi Suri,

Welcome to SDN

This is test program where in the Table Control Field are taken from ITAB declared in Top Include with fields from table SFLIGHT

PROCESS ON VALUE-REQUEST.

  FIELD itab-connid MODULE f4_get.

In Program

MODULE f4_get INPUT.
  DATA : fnam TYPE string,
         fval TYPE string.
*         lin TYPE i.
  DATA : BEGIN OF f4_tab OCCURS 0,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
    END OF f4_tab.
   CLEAR lin.

  GET CURSOR FIELD fnam VALUE fval LINE lin. " This gives the Current Line in Table Control

  DATA : dynpread TYPE TABLE OF dynpread WITH HEADER LINE. 
  REFRESH dynpread.
  CLEAR dynpread.
  dynpread-fieldname = 'ITAB-CARRID'.
  dynpread-stepl = lin.  " You need to pass this line Value here 
  APPEND dynpread.
  CLEAR dynpread.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                               = sy-repid
      dynumb                               = sy-dynnr
    TABLES
      dynpfields                           = dynpread
   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 IS INITIAL.
    READ TABLE dynpread WITH KEY fieldname = 'ITAB-CARRID'.
    IF sy-subrc IS INITIAL.
      SELECT carrid connid FROM sflight
            INTO TABLE f4_tab
             WHERE carrid = dynpread-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'CONNID'
         dynpprog               = sy-repid
         dynpnr                 = sy-dynnr
         dynprofield            = 'ITAB-CONNID'
         value_org              = 'S'
        TABLES
          value_tab              = f4_tab
    ENDIF.
  ENDIF.
ENDMODULE.                 " f4_get  INPUT

Cheerz

Ram

Edited by: Ramchander Krishnamraju on Nov 17, 2009 10:31 AM

Hi All

i have created a table control in that i have two fields

one is o/p filed and another one is i/p filed i have place a f4 for that

and if i press f4 for first column i need values

and if i press f4 for second column i need different values

how to do that

can u please tel some to solve this

4 REPLIES 4
Read only

Former Member
0 Likes
921

Hi Suri,

Welcome to SDN

This is test program where in the Table Control Field are taken from ITAB declared in Top Include with fields from table SFLIGHT

PROCESS ON VALUE-REQUEST.

  FIELD itab-connid MODULE f4_get.

In Program

MODULE f4_get INPUT.
  DATA : fnam TYPE string,
         fval TYPE string.
*         lin TYPE i.
  DATA : BEGIN OF f4_tab OCCURS 0,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
    END OF f4_tab.
   CLEAR lin.

  GET CURSOR FIELD fnam VALUE fval LINE lin. " This gives the Current Line in Table Control

  DATA : dynpread TYPE TABLE OF dynpread WITH HEADER LINE. 
  REFRESH dynpread.
  CLEAR dynpread.
  dynpread-fieldname = 'ITAB-CARRID'.
  dynpread-stepl = lin.  " You need to pass this line Value here 
  APPEND dynpread.
  CLEAR dynpread.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname                               = sy-repid
      dynumb                               = sy-dynnr
    TABLES
      dynpfields                           = dynpread
   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 IS INITIAL.
    READ TABLE dynpread WITH KEY fieldname = 'ITAB-CARRID'.
    IF sy-subrc IS INITIAL.
      SELECT carrid connid FROM sflight
            INTO TABLE f4_tab
             WHERE carrid = dynpread-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'CONNID'
         dynpprog               = sy-repid
         dynpnr                 = sy-dynnr
         dynprofield            = 'ITAB-CONNID'
         value_org              = 'S'
        TABLES
          value_tab              = f4_tab
    ENDIF.
  ENDIF.
ENDMODULE.                 " f4_get  INPUT

Cheerz

Ram

Edited by: Ramchander Krishnamraju on Nov 17, 2009 10:31 AM

Read only

0 Likes
920

Hey Ram

Thanks for ur responce

i need f4 differently for each column

is this works?

Read only

0 Likes
920

Suri,

Ofcouser it works.

This is for Dynamic line wise F4 Help. Code is infront of you. Just check and enjoy

Cheerz

Rm

Read only

0 Likes
920

Hey ram Thank u very much

the code is perfectly working

Thanks alot

Regards

Surendra