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: 

Help with OBJECTS_NOT_CHARLIKE dump

walkerist
Participant
0 Kudos
390

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

walkerist
Participant
0 Kudos
327

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

DominikTylczyn
Active Contributor
327

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

walkerist
Participant
0 Kudos
328

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.

0 Kudos
327

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