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

display default value in table control based on another field

Former Member
0 Likes
1,484

ZTABLE fields

Downtime code Text

1 No Load

2 M/C Breakdown

Suppose I press F4 for possible values for Downtime code.

The above 2 column screen shows the F4 help for down time code with thieir text.

Now if i select 2 for downtime code, then tha text(M/C BREAKDOWN) should appear in the next column(Ztable-SUP_TEXT) automatically.

these two fields are in table control.

Please help.

Thanks in advance,

Siddhartha Prakash

ZTABLE fields

Downtime code Text

1 No Load

2 M/C Breakdown

Suppose I press F4 for possible values for Downtime code.

The above 2 column screen shows the F4 help for down time code with thieir text.

Now if i select 2 for downtime code, then tha text(M/C BREAKDOWN) should appear in the next column(Ztable-SUP_TEXT) automatically.

these two fields are in table control.

Please help.

Thanks in advance,

Siddhartha Prakash

7 REPLIES 7
Read only

sivasatyaprasad_yerra
Product and Topic Expert
Product and Topic Expert
0 Likes
1,173

Try like this..


    move '<structure name - field name>' to dynpfields-fieldname.
    move <value> to dynpfields-fieldvalue.
    append dynpfields.
    call function 'DYNP_VALUES_UPDATE'
      exporting
        dyname               = sy-repid
        dynumb               = '0010' " screen number
      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.

and update internal table also for the current row.

<removed_by_moderator>.

Regards,

Siva.

Edited by: Julius Bussche on Aug 8, 2008 2:47 PM

Read only

0 Likes
1,173

Hi Siva,

i tried this but its not working accordingly. can we do this using parameter id. please help me.

bye,

Siddhartha

Read only

Former Member
0 Likes
1,173

Hi,

try like this...

here t1 = table name.

f1 = first field name.

f2 = second feld name.

in screen flow logic ...

process on value-request.
 field <t1-f1> module <name1>.
 field <t1-f2> module <name2>.

in the main code....

module name1 input.

  call function 'F4IF_FIELD_VALUE_REQUEST'
    exporting
      tabname     = 't1'
      fieldname   = 'f1'
      dynpprog    = progname
      dynpnr      = screennumber
      dynprofield = screen field name.

endmodule.

module name2 input.

  dynpro_table-fieldname = 't1-f1'.
  append dynpro_table.
  clear dynpro_table.

  call function 'DYNP_VALUES_READ'
    exporting
      dyname             = sy-repid
      dynumb             = sy-dynnr
      translate_to_upper = 'X'
    tables
      dynpfields         = dynpro_table.


  read table dynpro_table with key dynpro_table-fieldname.

  select *  from <tablename> into corresponding fields of table values_tab
         where f1 = dynpro_table-fieldvalue.

  call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
      retfield               = 'f2'
      dynpprog               = sy-repid
      dynpnr                 = sy-dynnr
      dynprofield            =screen field name
      value_org              = 'S'
    tables
      value_tab              = values_tab.
endmodule

Regards,

Sathish Reddy.

Read only

0 Likes
1,173

Hi Sathish,

i tried your code but still unable to get the text in my field zshft1-sup_text after pressing enter for zshft1-downtime. int the table control.

i have declared dynpro_table as

DATA BEGIN OF DYNPRO_TABLE OCCURS 1.

INCLUDE STRUCTURE dynpread.

DATA END OF DYNPRO_TABLE.

and values_tab as

DATA BEGIN OF VALUES_TAB OCCURS 1.

INCLUDE STRUCTURE SEAHLPRES.

DATA END OF VALUES_TAB.

please guide me on this issue too.

awaiting for your response.

Regards,

Siddhartha Prakash.

Read only

0 Likes
1,173

Hi,

Capitalize the fields that you give in quotes, as given below.

call function 'F4IF_INT_TABLE_VALUE_REQUEST'

exporting

retfield = 'f2' " replace with 'F2' ........

And, check in debugging if you get data.

Regards,

Wajid Hussain P.

Read only

0 Likes
1,173

Thanks for your reply Wajid, but i've already done that .

Read only

Former Member
0 Likes
1,173

TYPES: BEGIN OF ty_dat,

kunnr TYPE kunnr,

name1 TYPE name1_gp,

ort01 TYPE ort01,

END OF ty_dat.

DATA: i_dat TYPE STANDARD TABLE OF ty_dat WITH HEADER LINE,

i_return TYPE STANDARD TABLE OF ddshretval WITH HEADER LINE,

i_dynpread TYPE TABLE OF dynpread WITH HEADER LINE.

MODULE VALUE_CUSTNO INPUT.

CLEAR : D_WORK_ORDER,

D_DATE_ORDER.

SELECT KUNNR NAME1 ORT01

INTO TABLE I_DAT

FROM KNA1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'KUNNR'

DYNPPROG = SY-REPID

DYNPNR = SY-DYNNR

DYNPROFIELD = 'D_CUSOTMER_NO'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = I_DAT

RETURN_TAB = I_RETURN

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

IF SY-SUBRC = 0.

I_DYNPREAD-FIELDNAME = 'D_CUSOTMER_NO'.

I_DYNPREAD-STEPL = 0.

I_DYNPREAD-FIELDVALUE = I_RETURN-FIELDVAL.

I_DYNPREAD-FIELDINP = 'X'.

APPEND I_DYNPREAD.

        • V_RETURN will be your customer number

CLEAR V_NAME.

SELECT SINGLE NAME1 INTO V_NAME

FROM KNA1 WHERE KUNNR = V_RETURN.

IF SY-SUBRC = 0.

I_DYNPREAD-FIELDNAME = 'D_CUSTOMER_NAME'.

I_DYNPREAD-STEPL = 0.

I_DYNPREAD-FIELDVALUE = V_NAME.

I_DYNPREAD-FIELDINP = 'X'.

APPEND I_DYNPREAD.

ENDIF.

*

CALL FUNCTION 'DYNP_VALUES_UPDATE'

EXPORTING

DYNAME = SY-REPID

DYNUMB = SY-DYNNR

TABLES

DYNPFIELDS = I_DYNPREAD

EXCEPTIONS

INVALID_ABAPWORKAREA = 1

INVALID_DYNPROFIELD = 2

INVALID_DYNPRONAME = 3

INVALID_DYNPRONUMMER = 4

INVALID_REQUEST = 5

NO_FIELDDESCRIPTION = 6

UNDEFIND_ERROR = 7

OTHERS = 8.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDIF.