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

Select Statement - from Decimal Fields into Char

Former Member
0 Likes
924

Hi

I would like to run a SELECT from table T007A into an internal table which is of type TXW_TAXCOD.

T007A has a decimal field in it ( TOLERANCE ) which is of data type DEC, length of 3 and 1 decimal place.

This is the code in the standard program --

select * from t007a
         into corresponding fields of table t_txw_taxcod up to 20 rows.

I have to make the TOLERANCE field value in T007A land up in a character field in the structure, I have declared the TOLERANCE field in structure TXW_TAXCOD as a character field of type 5 (infact tried CHAR4 and CHAR8 etc etc) but I face a runtime error

I cannot change the code in standard program, can you please tell me what other data type can I use to make this select work

3 REPLIES 3
Read only

former_member194669
Active Contributor
0 Likes
664

If LTXW0F02 is your program and form extract_txw_taxcod

then



  select * from t007a
           into corresponding fields of table t_txw_taxcod.

  sort t_txw_taxcod.
  loop at t_txw_taxcod.
    select single * from t007s
                    where spras = sy-langu
                      and kalsm = t_txw_taxcod-kalsm
                      and mwskz = t_txw_taxcod-mwskz.
    if sy-subrc = 0.
      move-corresponding t007s to t_txw_taxcod.
    endif.
    call function 'TXW_SEGMENT_RECORD_EXPORT'
      exporting
        data_record = t_txw_taxcod.
  endloop.

Within the function module TXW_SEGMENY_RECORD_EXPORT have implicit enhancements try to use then and make one more select to table t007s using key KALSM and fill the char field TOLERENCE


 select tolerence from t007a into v_tolerence
          where kalsm = t_txw_taxcod-kalsm.
   write: v_tolerence to t_txw-taxcod-tolerence.

a®

Read only

Former Member
0 Likes
664

Hi

The target structure has to have fields having the same type of the fields of source structure while selecting, and transform the data after selecting them.

So u need to change the ABAP code

Max

Read only

0 Likes
664

Well cannot change the ABAP code as it is standard SAP code, so I need to make a select based on primary field in the user exit FTXW0001...