11-15-2007 4:05 PM
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.
11-15-2007 4:20 PM
Hi,
Please try this.
DATA: strx type matnr.
LOOP AT ORDER_ITEM_IN.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
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.
MODIFY ORDER_ITEM_IN.
ENDLOOP.
Regards,
Ferry Lianto
11-15-2007 4:07 PM
Hi,
Declare strx as matnr.
DATA: STRX TYPE MATNR.
Reward if it helps,
Satish
11-15-2007 4:20 PM
Hi,
Please try this.
DATA: strx type matnr.
LOOP AT ORDER_ITEM_IN.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
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.
MODIFY ORDER_ITEM_IN.
ENDLOOP.
Regards,
Ferry Lianto
11-15-2007 4:30 PM
Sorry. Tried, doesn't work
The ORDER_ITEM_IN is a parameter table, it's not a local table. I don't know if this make sense, but when I call this BAPI ORDER_ITEM_IN. Is that what's causing the problem?
I also have tried to move it to a internal table and modify, doesn't work either! Getting frustrated!
TABLES
*" ORDER_ITEM_IN STRUCTURE BAPIITEMIN
11-15-2007 4:37 PM
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
11-15-2007 5:08 PM
Thank You Naimesh.
This worked fine. however I didn't use a temp table, I just modified the input table. Test out ok, but I wonder if there are possible problem in the future!
11-15-2007 5:14 PM