Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Assign value to import parameter table

Former Member
0 Likes
978

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
930

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

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.

6 REPLIES 6
Read only

Former Member
0 Likes
930

Hi,

Declare strx as matnr.

DATA: STRX TYPE MATNR.

Reward if it helps,

Satish

Read only

Former Member
0 Likes
931

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

Read only

0 Likes
930

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

Read only

0 Likes
930

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

Read only

0 Likes
929

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!

Read only

0 Likes
929

I think there will not be any..

Regards,

Naimesh Patel