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

Help with OBJECTS_NOT_CHARLIKE dump

walkerist79
Participant
0 Likes
1,102

Hi, I'm having an issue reading the string length of the value of a BSAK field.
I'm having issue specifically on the field MWSTS.

My code is :

FIELD-SYMBOLS: <ls_field> TYPE ANY.
SELECT *
FROM BSAK INTO TABLE @DATA(it_bsak).
DATA(v_lines) = lines( it_bsak )
DATA(ls_bsak) = it_bsak[ v_lines ]
ASSIGN COMPONENT sy-tabix OF STRUCTURE ls_bsak to <ls_fields>.
IF <ls_field> IS ASSIGNED.
DATA(v_length) = strlen( <ls_field> ).
ENDIF.
1 ACCEPTED SOLUTION
Read only

walkerist79
Participant
0 Likes
1,039

Thanks everyone, I have declared a field to pass the LS_FIELD.
Here's the modified code:

DATA: v_field(100) TYPE C.
FIELD-SYMBOLS: <ls_field> TYPE ANY.
SELECT *
FROM BSAK INTO TABLE @DATA(it_bsak).
DATA(v_lines) = lines( it_bsak )
DATA(ls_bsak) = it_bsak[ v_lines ]
ASSIGN COMPONENT sy-tabix OF STRUCTURE ls_bsak to <ls_fields>.
IF <ls_field> IS ASSIGNED.
v_field = <ls_field>.
DATA(v_length) = strlen( v_field ).
ENDIF.
3 REPLIES 3
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
1,039

Hello walkerist

STRLEN works for strings or character-like fields. Your code tries to apply STRLEN to all the fields of BSAK. Some of them are not character-like, hence the dump. For instance BSAK-MWSTS is the amount field - you can apply STRLEN to it.

Best regards

Dominik Tylczynski

Read only

walkerist79
Participant
0 Likes
1,040

Thanks everyone, I have declared a field to pass the LS_FIELD.
Here's the modified code:

DATA: v_field(100) TYPE C.
FIELD-SYMBOLS: <ls_field> TYPE ANY.
SELECT *
FROM BSAK INTO TABLE @DATA(it_bsak).
DATA(v_lines) = lines( it_bsak )
DATA(ls_bsak) = it_bsak[ v_lines ]
ASSIGN COMPONENT sy-tabix OF STRUCTURE ls_bsak to <ls_fields>.
IF <ls_field> IS ASSIGNED.
v_field = <ls_field>.
DATA(v_length) = strlen( v_field ).
ENDIF.
Read only

0 Likes
1,039

Your code is very confusing: <LS_FIELD> is not initialized, <LS_FIELDS> is not declared, SY-TABIX is not initialized...