I've tried a number of different things trying to comparing the field lop_d_list_hd-doc_item_no to wbhi-tposn. Nothing seems to be working. Neither of the bold options below is working.
doc_item_no: 0000000010 would be item 10. The data type is NUMC and the length is 10.
tposn: 000010 would be item 10. The data type is numc and the length is 6.
Does anyone know of a way to compare the two columns inside the inner join so I don't have to loop through the table to do the compare?
SELECT DISTINCT
A~DOC_NO, ", -- Document Number (TC #)
A~DOC_ITEM_NO, " DOC_ITEM_NO,
A~MASTER_NO, ", -- List Number
A~LOP_CAT, ", -- Option Category
A~LOP_ID, ", -- Option Category Description
B~MATNR, ", -- Material
C~TPOSN
INTO Table @IT_LOP_TEMP FROM LOP_D_LIST_HD AS A
INNER JOIN LOP_D_LIST_IT AS B
ON A~LIST_GUID = B~LIST_GUID
INNER JOIN WBHI AS C ON
C~TKONN = A~DOC_NO
* AND C~TPOSN = RIGHT(A~DOC_ITEM_NO)
*AND A~DOC_ITEM_NO = C~TPOSN
INNER JOIN WBHK AS D ON D~TKONN = C~TKONN
wHERE
A~LOP_CAT = P_LOP_CAT AND
B~MATNR in so_matnr AND
D~KUNNR = i_kunnr AND " -- Customer
D~btbsta in T_BTBSTA_RFC_SELOPT.