Typecasting XBLNR (CHAR 16) and VBELN(CHAR 10):
I read the issue in SAP SDN:
I am facing type and length error while coding the below select statements.
IF TA_MKPF[] IS NOT INTIAL.
Select TKNUM VBELN from VTTP INTO TA_VTTP FOR ALL ENTRIES IN TA_MKPF
WHERE VBELN = TA_MKPF-XBLNR
ENDIF.
Now XBLNR is CHAR 16 field and VBELN is CHAR 10 field.That the reason why there is a TYPE and LENGHT mismatch error.
Please suggest how to do the type match so that the erro can be removed and the assignment is also done successfully.
IF TA_MKPF[] IS NOT INTIAL.
Select TKNUM VBELN from VTTP INTO TA_VTTP FOR ALL ENTRIES IN TA_MKPF
WHERE VBELN = TA_MKPF-XBLNR
ENDIF.
Now XBLNR is CHAR 16 field and VBELN is CHAR 10 field.That the reason why there is a TYPE and LENGHT mismatch error.
Please suggest how to do the type match so that the erro can be removed and the assignment is also done successfully.
Solution :
DATA : it_mkpf TYPE STANDARD TABLE OF mkpf. TYPES: BEGIN OF t_mkpfnew. INCLUDE STRUCTURE mkpf. TYPES: vbeln TYPE vbeln, END OF t_mkpfnew . DATA : it_mkpfnew TYPE STANDARD TABLE OF t_mkpfnew. DATA : wa_mkpf TYPE mkpf, wa_mkpfnew TYPE t_mkpfnew. * it_mkpf[] = importing table of badi LOOP AT it_mkpf INTO wa_mkpf. MOVE-CORRESPONDING wa_mkpf TO wa_mkpfnew. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = wa_mkpf-xblnr IMPORTING output = wa_mkpfnew-vbeln. APPEND wa_mkpfnew TO it_mkpfnew. ENDLOOP.