Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Assign value to import parameter table

Hello All:

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'

Exporting

input = ORDER_ITEM_IN-CUST_MAT

Importing

output = strx.

READ TABLE IMARA WITH KEY EAN11 = strx.

strx = IMARA-MATNR.

if IMARA-MATNR NE SPACE.

ORDER_ITEM_IN-MATERIAL = IMARA-MATNR.

ENDIF.

ENDLOOP.

Tags:
Former Member
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[].

Regards,

Naimesh Patel

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question