Application Development 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: 

Need help with screen programming

Former Member
0 Kudos

Hi all,

In my screen, I have 2 fields. The first field, I would like to enter some data. The second field, I would like to attach a Search Help depending on the data entered on the first field. How can I do that? Currently, when I try to debug, I found out that when I run the logic to generat the search help, the first field value is not captured, Thanks in advance.

4 REPLIES 4

Former Member
0 Kudos

do not write the code under process on value-request.

just write the code under chain endchain.

See the statement

PAI

chain.

field fieldname module modname.

endchain.

module modname.

here you need to write the code.

you can see the first value,pass this value to search help function module

endmodule.

gopi_narendra
Active Contributor
0 Kudos

You should write it in the POV Process on Value Request event.

process on value-request.

field ZES_PO_ITEM-ST_PRIOK module GET_PRIORITY_F4.

in the module make use of the FM: DYNP_VALUES_READ. Its a good practice to use the FM. this refreshes you screen filed values.

now based on this you can get the values in the search help by using the

FM: F4IF_INT_TABLE_VALUE_REQUEST

If not you can create a new search help in SE11 and attach it to be table itself at the field level in case of customised tables.

Regards

Gopi

0 Kudos

Hi Gopi,

Below is my code

I_FIELDS-FIELDNAME = D_EBELN.

APPEND I_FIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'ZTEST'

DYNUMB = '0100'

TABLES

DYNPFIELDS = I_FIELDS.

But the field's value (D_EBELN) is still not acquired in the internal table I_FIELDS although the return code is 0. Please advice.

0 Kudos

I_FIELDS-FIELDNAME = D_EBELN.

APPEND I_FIELDS.

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = 'ZTEST'

DYNUMB = '0100'

TABLES

DYNPFIELDS = I_FIELDS.

the i_fields shoudl contain only the screen field names but not any values. It should carry only the <b>SCREEN FIELD NAMES(NOT ANY VALUES) GIVEN IN QUOTES</b>

See my similar code . the declarations are as below.

data : IT_DYNPREAD type standard table of DYNPREAD initial size 0,
       IS_DYNPREAD type DYNPREAD.
data : IT_RETURN type standard table of DDSHRETVAL initial size 0,
       IS_RETURN type DDSHRETVAL.

*&---------------------------------------------------------------------*
*&      Module  GET_PRIORITY_F4  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module GET_PRIORITY_F4 input.

  clear : IS_DYNPREAD, T350, T356_T.
  refresh : IT_DYNPREAD, IT_PRIOK.

  IS_DYNPREAD-FIELDNAME = 'ZES_PO_ITEM-ST_AUART'.
  append IS_DYNPREAD to IT_DYNPREAD.

  call function 'DYNP_VALUES_READ'
    exporting
      DYNAME     = 'ZESR0050'
      DYNUMB     = '0200'
    tables
      DYNPFIELDS = IT_DYNPREAD.

  read table IT_DYNPREAD into IS_DYNPREAD with key FIELDNAME = 'ZES_PO_ITEM-ST_AUART'.
  if SY-SUBRC = 0.
    ZES_PO_ITEM-ST_AUART = IS_DYNPREAD-FIELDVALUE.

    if not ZES_PO_ITEM-ST_AUART is initial.
      select single * from T350 where AUART eq ZES_PO_ITEM-ST_AUART.
      select B~PRIOK B~PRIOKX into table IT_PRIOK
      from T356_T as B
      inner join T356A as A
      on A~ARTPR = B~ARTPR
      where A~ARTPR eq T350-ARTPR.
      if SY-SUBRC = 0.
        call function 'F4IF_INT_TABLE_VALUE_REQUEST'
          exporting
            RETFIELD        = 'ZES_PO_ITEM-ST_ILART'
            WINDOW_TITLE    = 'Priority'
            VALUE_ORG       = 'S'
          tables
            VALUE_TAB       = IT_PRIOK
            RETURN_TAB      = IT_RETURN
          exceptions
            PARAMETER_ERROR = 1
            NO_VALUES_FOUND = 2
            others          = 3.
        if SY-SUBRC <> 0.
        endif.
        read table IT_RETURN into IS_RETURN with key FIELDNAME = 'F0002'.
        if SY-SUBRC = 0.
          read table IT_PRIOK into IS_PRIOK with key ARTPRX = IS_RETURN-FIELDVAL.
          if SY-SUBRC = 0.
            IS_POITEM_ENTRY-ST_PRIOK = IS_PRIOK-PRIOK.
            ZES_PO_ITEM-ST_PRIOK     = IS_PRIOK-PRIOK.
            T356_T-PRIOKX            = IS_PRIOK-ARTPRX.
            if not ZES_PO_ITEM-ST_PRIOK is initial.
              clear : T356_T.
              select single * from T356_T
                              where SPRAS = SY-LANGU
                                and PRIOK = ZES_PO_ITEM-ST_PRIOK.
            endif.
            modify IT_POITEM_ENTRY from IS_POITEM_ENTRY index IND
                                                        transporting ST_PRIOK.
            clear : IS_RETURN.
          endif.
        endif.
      else.
        message S138(ZSM) with 'No Input values found'.
      endif.
    endif.
    clear : IS_DYNPREAD.
  endif.

endmodule.                 " GET_PRIORITY_F4  INPUT

Regards

Gopi