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: 

User exit

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

6 REPLIES 6

Former Member
0 Kudos

Yes code is correct.

Former Member
0 Kudos

Hi,

The correct code is...

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'.

MODIFY t_item from wa_item index sy-index.

ENDIF.

ENDLOOP.

ELSE.

EXIT.

ENDIF.

reward if helpful.

thanks

Former Member
0 Kudos

Hi,

Sorry....

as per coding syntax, wat i sent before was correct.But now only I checke d the exit.In table t_item there is no pstyv or anything.U cant use that.But u have got

T_ACCIT in which there is item category as LINETYPE.I am on search of the warehouse cost.So u have to find in which tables these fields are present and use those in the code to retrieve the coreect values.

I will look into it and let u know by the time u search for it.

0 Kudos

yes.In T_ITEM does not having any fields.

the structure CE10001 having all fields(PSTYV,VV504).That why i was use the move-correspong statement

move-corresponding t_item to CE10001.

Thanks & Regards,

sudhakar

Former Member
0 Kudos

Hi,

but while debugging are u getting all these values in t_item?Is der any values coming in t_item while entering the exit?can u say in which transaction are u going to use this exit?

0 Kudos

Thanks for reply.Iam using VF01 Tcode.I will assign points.

Thanks & Regards,

sdudhakar