2023 Oct 23 11:28 AM
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.
2023 Oct 23 12:25 PM
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.
2023 Oct 23 11:50 AM
2023 Oct 23 12:25 PM
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.
2023 Oct 23 1:11 PM
Your code is very confusing: <LS_FIELD> is not initialized, <LS_FIELDS> is not declared, SY-TABIX is not initialized...