cancel
Showing results for 
Search instead for 
Did you mean: 

Variant Configuration Procedure - convert numeric into char

0 Kudos

Hello SDN!

I am using CU02 procedures and now I want to convert a numeric value into a character value.

What I have tried so far:

$self.machno = $self.maschnr.

But the syntax check brings up and error:

E28075 Character string required in inverted commas

E28024 Syntax error in simple action/procedure

Details of the error

E28049 Characteristic MACHNO is not restrictable

E28049 Characteristic MACHNO is not restrictable

E28054 MACHNO is not a multiple-value characteristic

E28054 MACHNO is not a multiple-value characteristic

E28075 Character string required in inverted commas

E28039 Alphanumeric expression required

What can I do? I cannot find any help or information what kind of commands I could use.

E.g. the ABAP command write is not working.

Please help me!

Thanks

Matthias

Accepted Solutions (0)

Answers (3)

Answers (3)

lat_gmbh
Explorer
0 Kudos

I found another solution for that problem I started to face today (I'm not that VC experienced, so didn't understand how to use the solution shown above):

Using CU65 I created a function that does the conversion I need (in may case a floating point number to a character string and added a prefix). The function has the same name as the abap function module (I had to code first). Here is the code for my example:

Note:
the interface of the FM must be as shown below.
in table QUERY the values a received from the calling procedure
in table MATCH the values (characteristics) are returned back to the procedure:

FUNCTION Z_CONV_FLTP_2_CHAR
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(GLOBALS) TYPE CUOV_00
*" TABLES
*" QUERY STRUCTURE CUOV_01
*" MATCH STRUCTURE CUOV_01
*" EXCEPTIONS
*" FAIL
*" INTERNAL_ERROR
*"----------------------------------------------------------------------
* Data declaration
data: lv_atflv_char type ATWRT. "char. numeric value as char
data: lv_atflv_number type QSOLLWERTC.

* read which parameter is giving the length
Read TABLE query with key VARNAM = 'OBJEKTMERKMAL_CHAR_NAME'.
IF SY-SUBRC <> 0 OR QUERY-ATCIO <> 'I'. "I = input parameter
RAISE INTERNAL_ERROR.
endif.

* read input parameter: length of tube
Read TABLE query with key VARNAM = query-atwrt.
IF SY-SUBRC <> 0 OR QUERY-ATCIO <> 'I'. "I = input parameter
RAISE INTERNAL_ERROR.
endif.

* convert floating point number to character

** convert float to decimal

call FUNCTION 'QSS0_FLTP_TO_CHAR_CONVERSION'

EXPORTING

I_NUMBER_OF_DIGITS = 3

I_FLTP_VALUE = query-ATFLV "number in float format

importing

E_CHAR_FIELD = lv_atflv_number. "number in decimal format

** internal format with decimal point instead of comma.

TRANSLATE lv_atflv_number using ',.'.

** convert decimal number to character

lv_atflv_char = lv_atflv_number .

** remove leading spaces

shift lv_atflv_char LEFT DELETING LEADING space.

** add 'LAENGE_' up front so the value for calculation can be recognized

lv_atflv_char = 'LAENGE_' && lv_atflv_char.

* provide output data to procedure

CALL FUNCTION 'CUOV_SET_FUNCTION_ARGUMENT'

EXPORTING

argument = 'OBJEKTMERKMAL'

vtype = 'CHAR'

sym_val = lv_atflv_char

TABLES

match = match

EXCEPTIONS

existing_value_replaced = 01.

ENDFUNCTION.

Here is the coding from the procedure:

pfunction Z_CONV_FLTP_2_CHAR

( OBJEKTMERKMAL_CHAR_NAME = 'SCHLAUCH_LAENGE',

OBJEKTMERKMAL = $self.OBJEKTMERKMAL,

SCHLAUCH_LAENGE = $self.SCHLAUCH_LAENGE)

0 Kudos

I know this question is over 10 years ago but sharing a solution that worked in my case. I was looking for a similar request.

Initially, I thought I would be able to achieve this by using a variant table, in my case the values were defined. Unfortunately, after writing the dependency code, I did not get a syntax error, but I was unable to save the dependency.

I then created a dependency net to infer values from Numeric char to Character Char, this worked in my case.

I hope this helps!

OBJECTS:

A IS_A(300) Class**

RESTRICTIONS:

TABLE T_**

(CH_123* = A.CH_123*,

CH_345* = A.CH_345*)

INFERENCES:

A.CH_CH_345*

Former Member
0 Kudos

I face the same problem. but too long nobody answer this question! Did you solved that problem?