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

Check for Currency Data Type

Former Member
0 Likes
718

Hello All,

In my Dynamic Internal Table I've certain fields.

Now I want to check whether those fields are of type Currency or Quantity .

How to do this ?

Using Describe Field syntax I'm getting as TYPE C for both CURRRENCY as well as CHARACTER.

Any clues ?

Regards,

Deepu.K

Hello All,

In my Dynamic Internal Table I've certain fields.

Now I want to check whether those fields are of type Currency or Quantity .

How to do this ?

Using Describe Field syntax I'm getting as TYPE C for both CURRRENCY as well as CHARACTER.

Any clues ?

Regards,

Deepu.K

2 REPLIES 2
Read only

Former Member
0 Likes
658

Hi,

Use FM GET_COMPONENT_LIST


data: fieldlist type table of rstrucinfo with header line.
* gets all of the components of a structure
call function 'GET_COMPONENT_LIST'
     exporting
          program    = sy-repid
          fieldname  = 'lineitems'       "Use ur internal table name
     tables
          components = fieldlist.
loop at fieldlist.
*whatever fieldlist-compname you want to check
if fieldlist-type = 'P'
*its a currency field
elseif fieldlist-type = 'C'
*its a char field
endif.
endloop.

Hope thuis gives an idea!

Cheers,

Vikram

Read only

0 Likes
658

Hello Vikram,

Thanks for ur reply !

But when I pass my Internal table data Name to ur said FM I'm not getting any data.

So I tried with one more FM :


* Get the Layout Fields Content
  call function 'LVC_VARIANT_SELECT'
    exporting
      i_dialog            = ' '
      i_user_specific     = 'A'
      it_default_fieldcat = gt_fcat
    importing
      et_fieldcat         = gt_fcat
    tables
      it_data             = gt_final
    changing
      cs_variant          = ls_variant
    exceptions
      wrong_input         = 1
      fc_not_complete     = 2
      not_found           = 3
      program_error       = 4
      data_missing        = 5
      others              = 6.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

By using the above FM i got my required content.

In the FIeldcatalog I have all the DATATYPES, INTTYPEs, Decimals etc. and so by reading the values from the field catalog I coud resolve my isssue.

Regards,

Deepu.K

.