Assign value to import parameter table
I am very new to ABAP programming.
I have a code looks like below, where ORDER_ITEM_IN is a BAPIITEMIN TYPE. And it's a table passed in as parameter. I am looping through the table to find referenced material from CUST_MAT. But when I try to assign the found value to ORDER_ITEM_IN-MATERIAL, nothing is done. I still have a empty space even though the IMARA-MATNR return correctly. What am I doing wrong? Please let me know, this is urgent!
LOOP AT ORDER_ITEM_IN.
Call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
input = ORDER_ITEM_IN-CUST_MAT
output = strx.
READ TABLE IMARA WITH KEY EAN11 = strx.
strx = IMARA-MATNR.
if IMARA-MATNR NE SPACE.
ORDER_ITEM_IN-MATERIAL = IMARA-MATNR.
Naimesh Patel replied
Did you try like this:
DATA: strx type matnr. data: itab like BAPIITEMIN occurs 0 with header line. itab = ORDER_ITEM_IN. LOOP AT itab. call function 'CONVERSION_EXIT_ALPHA_INPUT' exporting input = itab-CUST_MAT importing output = strx. READ TABLE IMARA WITH KEY EAN11 = strx. if sy-subrc = 0. "<<< strx = IMARA-MATNR. endif. IF IMARA-MATNR is not initial. " <<< itab-MATERIAL = IMARA-MATNR. ENDIF. MODIFY itab. endif. ENDLOOP. ORDER_ITEM_IN = itab.