Application Development 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: 

COPA0005

Former Member
0 Kudos

Hi,

Iam working one userexit COPA0005 which having function module EXIT_SAPLKEII_002.

Import parameters is I_ERKRS

Table T_ITEM

The table is not refering any tables.

My requirement is below

1.Check if operating concern(I_ERKRS) is 0001 than go to step 2 else go to step

2.Read each record of T_Item which is of structure CE10001 table and verify

the value for item category(CE10001-PSTYV) .

3. If the item Category (CE10001-PSTYV) is TAS Than change Warehouse cost value field (CE10001-VV504) value to 0.00 irrespective of its current value).

Else don’t change value of warehouse cost value field(CE10001-VV504).

4.Exit from the function module.

I write the code

DATA: ce1_0001 type ce10001.

data : wa_item type ce10001.

IF i_erkrs EQ '0001'.

LOOP AT t_item into wa_item.

MOVE-CORRESPONDING t_item TO ce1_0001.

IF ce1_0001-pstyv = 'TAS'.

ce1_0001-vv504 = '0.00'.

ENDIF.

MOVE-CORRESPONDING ce1_0001 TO t_item.

MODIFY t_item from wa_item index sy-index.

ENDLOOP.

ELSE.

EXIT.

ENDIF.

Is it correct code?Or any changes.

Thanks,

sudhakar

2 REPLIES 2

former_member480923
Active Contributor
0 Kudos

Hi Change ur code to the following


DATA : wa_item TYPE ce10001.
IF i_erkrs EQ '0001'.
  LOOP AT t_item INTO wa_item.
    IF wa_item-pstyv = 'TAS'.
      wa_item-vv504 = '0.00'.
    ENDIF.
    MODIFY t_item FROM wa_item INDEX sy-index
                           TRANSPORTING vv504.
  ENDLOOP.
ELSE.
  EXIT.
ENDIF.

Hope That Helps

Anirban M.

0 Kudos

Hi Amit,

Thanks for reply.But iam getting error "The specified type has no structure and therefore no component called VV504".

Thanks & Regards,

Sudhakar