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: 

Fetching Field Name/Domain Name/Check Table name based on Select-Option

Former Member
0 Kudos

Hi,

I have my selection screen declared with below select-option.

DATA: gv_vkorg TYPE vkorg.

SELECT-OPTIONS: s_vkorg FOR gv_vkorg.

Now i want to fetch Field Name, Domain Name, Check Table related to 'VKORG' based on select-option: S_VKORG.

Can it be possible possible to directly fetch these based on S_VKORG!

Based on Field Name i am able fetech Domain Name from DD03L, Check table from DD01L based on domain name.

But i want to fetch Field Name, Domain Name, Check Table based on select-option: S_VKORG!

Thanks in advance.

Thanks,

Kumar.

5 REPLIES 5

Former Member
0 Kudos

Hi Kumar,

You can use the run tine service classes to do this.


DATA:
      type   TYPE REF TO cl_abap_typedescr,
      descr TYPE REF TO cl_abap_datadescr,
      range TYPE REF TO cl_abap_structdescr.

type = cl_abap_typedescr=>describe_by_data( s_vkorg ).
range ?= type.
descr = range->get_component_type( 'LOW' ).

Cheers

Jon

0 Kudos

Hi Jonathan,

Thank you for the reply.

I can see field name under Help_ID.

How can i get it (Help_ID value) into some variable!

Thanks,

Kumar.

0 Kudos

Add below marked lines additionally to your code.


DATA:
      type   TYPE REF TO cl_abap_typedescr,
      descr TYPE REF TO cl_abap_datadescr,
      range TYPE REF TO cl_abap_structdescr,
      p_name TYPE string.                      " <--------

type = cl_abap_typedescr=>describe_by_data( s_vkorg ).
range ?= type.
descr = range->get_component_type( 'LOW' ).

p_name = descr->get_relative_name( ).   " <-------- Variable P_NAME contains 'VKORG'

0 Kudos

Hi,

Thank you for reply.

I have one more issue.

I have written a method for validation of selection screen elements.

This method i am calling as below:

Method

EXPORTING

im_sel_scr_field = gt_sel_field[]

Where gt_sel_field[] = s_vkorg[]. (or) gt_sel_field[] = s_vtweg[] etc.. i will pass for each validation

gt_sel_field TYPE TABLE OF zsel_field,

zsel_field structure is created with sign, option low, high field values.

im_sel_scr_field is of type zsel_field_tt (Table type for zsel_field structure)

But i want to pass s_vkorg and s_vtweg etc... sel-options as method parameter instead of gt_sel_field[].

Can anyone resolve this issue.

Thanks in advance.

Thanks,

Kumar.

0 Kudos

Hi,

Any resolution for above issue!

Basically my intention is to pass S_VKORG, S_VTWEG, S_PSTYV etc... different type of select-option as method paramters but corresponding structure in Method should be compatiable.

But currently my method structure in having low as 45 char, high as 45 char. But if i am trying to pass S-VKORG it is saying as not compatiable as lengths differ.

Can any one provide inputs for the same!

Thanks,

Kumar.