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

Drop down in Module pool program

Former Member
0 Likes
1,270

Hi,

I need to have a drop down input/output field. For that I have given a name like YHRTM_LEAVE-ATEXT in screen painter. Here YHRTM_LEAVE is table and ATEXT is a field. I have maintained the possible values in ATEXT domain to avail the drop down values.

In PAI, I need to access YHRTM_LEAVE-ATEXT . But only YHRTM_LEAVE value appears only while debugging.

Could anybody help me to achieve my requirement.

Thanks

jey

11 REPLIES 11
Read only

Former Member
0 Likes
1,059

hi,

u have to write this on screen flow logic after PAI...

PROCESS ON VALUE-REQUEST.

FIELD ifmtp-form_type MODULE fm_drop.

MODULE fm_drop INPUT.

CLEAR ifmtp.

REFRESH ifmtp.

ifmtp-form_type = 'C'.

APPEND ifmtp.

ifmtp-form_type = 'F'.

APPEND ifmtp.

ifmtp-form_type = 'H'.

APPEND ifmtp.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'FORM_TYPE'

value_org = 'S'

TABLES

value_tab = ifmtp.

IF sy-subrc 0.

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

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

ENDIF.

ENDMODULE. " fm_drop INPUT

here ifmtp-form_type is my field which i have taken as listbox

DATA : BEGIN OF ifmtp OCCURS 0,

form_type LIKE zform_track_mast-form_type,

END OF ifmtp.

Read only

0 Likes
1,059

Hi,

I am looking for Drop Down not F4 help. Hence I can't use this FM.

Read only

0 Likes
1,059

hi,

my field is as list box on screen.....

Read only

0 Likes
1,059

what is the name did you give for your Drop Down field ?

Read only

0 Likes
1,059

hi,

my field name is ifmtp-form_type

and u have to use FM..

Edited by: Dhwani shah on Mar 18, 2008 11:57 AM

Read only

0 Likes
1,059

This is an alternative option to using Domain.

I use this method to customize the dropdown/listbox available to a field.

Here I retrieve from a custom table to fill the values, however, you can read DD07T to obtain the Domain Values.

This code retrieves a value from DD07T.


  SELECT SINGLE ddtext INTO p_value
    FROM dd07t
    WHERE domname = 'ZDROPTYPE'
      AND ddlanguage = sy-langu
      AND domvalue_l = p_key.
  IF sy-subrc NE 0.
    p_value = 'Undefined'.

This is different code to retrieve from custom table and display.


TYPE-POOLS             vrm.

DATA:   " Letter Name Restrict List
  rletname_field   TYPE vrm_id,
  rletname_result  TYPE STANDARD TABLE OF vrm_value,
  rletname_val     LIKE LINE OF rletname_result.

In the PBO routine


  REFRESH rletname_result.
  SELECT letterid letterdesc
    INTO TABLE rletname_result
    FROM zlmetext
    WHERE relid = base_relid
      AND appl  = base_appl.

* Field name to assign drop down values
  rletname_field = 'BASE_RLETTER'.
  CALL FUNCTION 'VRM_SET_VALUES'
       EXPORTING
            id              = rletname_field
            values          = rletname_result
       EXCEPTIONS
            id_illegal_name = 1
            OTHERS          = 2.

You must, in the screen painter attribute screen make the Dropdown option = Listbox.

Additionally, on the attribute screen on the Program tab, you must make the Value list (under Entry Help) = 'A'.

Read only

0 Likes
1,059

I got the drop down box refferred by a data dictionary table field. Its appearing very well. But the issue is that I am unable to access the value I selected.

For instance, say there is a table named TABLE1. It has two field; FIELD1 and FIELD2. FIELD1 is the key in this table. FIELD2 has got some value in Domain level. So I created a drop down field as TABLE1-FIELD2. I have got the drop down value from the table.

But the issue is when I access TABLE1-FIELD2 in PAI. It has no value.

Only TABLE1 has the codes I mentioned in Domain level. You could ask me then why don't you use it easily. But I could see the value only during debugging not in the program.

In the program I haven't defined TABLE1 anywhere. So I can't access the code. If I tried to define TBALE1, it says already you have defined.Its something strange.

Read only

0 Likes
1,059

ok,

so u having drop down list in table control?

u need to take drop down field of different internal table...

Edited by: Dhwani shah on Mar 18, 2008 12:46 PM

Read only

0 Likes
1,059

It was not a table control. Its just a drop down field.

Read only

0 Likes
1,059

The dropdown process will only return the key of your table. You will need to READ TABLE table1 WITH KEY FIELD1 = (screen field name of dropdown). You will then have access to FIELD2 information.

Read only

0 Likes
1,059

Thanks for the input Paul. But it says Internal table is not defined. I like to highlight one thing here.

During debugging, I am able to see the value : (

When I tried to define as an internal table, it says you can't re-deinfe TABLE1-FIELD2 even though I defined lik

data: TABLE1 like standard table of TABLE1 with header line.

Edited by: Jey on Mar 19, 2008 10:22 AM