cancel
Showing results for 
Search instead for 
Did you mean: 

How to display information on the screen when user hits enter key

Former Member
0 Kudos

Hi all,

I am working on an application, now the requirement is when a user will enter the vendor number and hit enter key from the keyboard (there will not be any button for this) the vendor information should get displayed on the screen such as vendor name and address. For this I have written the following code in the event 'on enter' for the field where user enters th evendor number. My code is grabbing the vendor information and getting it stored in the internal tabke ls_kred but now the problem is I don;t know how can I display this information on the screen.

DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.

  DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
  DATA ls_t_bseg TYPE wd_this->Element_t_bseg.
  DATA lv_lifnr TYPE wd_this->Element_t_bseg-lifnr.
  data: wa_lifnr type lifnr,
        ls_kred type vf_kred.

* navigate from <CONTEXT> to <T_BSEG> via lead selection
  lo_nd_t_bseg = wd_context->path_get_node( path = `PRELIMINARY_POSTING.CHANGING.T_BSEG` ).

* @TODO handle non existant child
* IF lo_nd_t_bseg IS INITIAL.
* ENDIF.

* get element via lead selection
  lo_el_t_bseg = lo_nd_t_bseg->get_element( ).
* alternative access  via index
* lo_el_t_bseg = lo_nd_t_bseg->get_element( index = 1 ).
* @TODO handle not set lead selection
  IF lo_el_t_bseg IS INITIAL.
  ENDIF.

* get single attribute
  lo_el_t_bseg->get_attribute(
    EXPORTING
      name =  `LIFNR`
    IMPORTING
      value = lv_lifnr ).

  wa_lifnr = lv_lifnr .

  CALL FUNCTION 'FI_VENDOR_DATA'
      EXPORTING
        I_BUKRS        = '001'
        I_LIFNR        = wa_lifnr
      IMPORTING
        E_KRED         = ls_kred
      EXCEPTIONS
        VENDOR_MISSING = 1
        OTHERS         = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

Please advice.

Thanks,

Rajat Garg

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

There is nothing special to do here.

Assuming you have UI elements to display name and/or address on the screen (let's say as TextViews) and the 'text' property is bound to corresponding attributes in the context, then all you have to do after reading the data is to update the context with data from ls_cred.

Regards,

George

Former Member
0 Kudos

Thanks for the reply, I have already defined the text view to display the vendor name but now the problem is how can I do the context binding here...

Former Member
0 Kudos

Rajatag,

This is really elementary.

1. Do you have an attribute defined in the context, say 'vendor_name'?

2. Did you setup the binding of the TextView's <Text> property to this attribute?

After reading the vendor, just set the value of this attribute to ls_kred-name1.

Regards,

George

Former Member
0 Kudos

Hi George,

This is my forst web dynpro application and I haven't got any training in this as well, so my question sounds little weird than please excuse me. What I have done is I have already done the forst two steps that you mentioned but I am not sure how can i get the last one done "After reading the vendor, just set the value of this attribute to ls_kred-name1"

Former Member
0 Kudos

It worked now Goerge.

Thanks,

Rajat

Answers (1)

Answers (1)

Former Member
0 Kudos

Any Clue.