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

AS01 Transaction

Former Member
0 Likes
559

Hi Gurus,

I was tasked to do some changes on AS01 transaction.

What is required is when assets are created,

1. When cost centre is entered then put the correct coordinator for the specific cost centre

otherwise the error message must be displayed.

2. I have done some coding on the following user exit but i have a challenge regarding when i assign the coordinator

(Assign (coordinator) to <gdlgrp>).

3. Please assist.

tables:csks.

data: costcentre(30) value '(SAPLAIST)anlz-KOSTLV'. "cost centre

data: coordinator(30) value '(SAPLAIST)is_anla-GDLGRP'. "asset coordinator

field-symbols: <kostlv> type kostl.

field-symbols: <gdlgrp> type GDLGRP.

Assign (costcentre) to <kostlv>.

if sy-subrc = 0.

if not <kostlv> is initial.

select single zz_gdlgrp into csks-zz_gdlgrp

from csks

where kostl = <kostlv>.

Assign (coordinator) to <gdlgrp>.

if sy-subrc = 0.

if csks-zz_gdlgrp ne <gdlgrp>.

message E000(ZFI00) with

'Invalid Asset Coordinator' <gdlgrp> 'for cost center' <kostlv>.

endif.

endif.

endif.

endif.

Hi Gurus,

I was tasked to do some changes on AS01 transaction.

What is required is when assets are created,

1. When cost centre is entered then put the correct coordinator for the specific cost centre

otherwise the error message must be displayed.

2. I have done some coding on the following user exit but i have a challenge regarding when i assign the coordinator

(Assign (coordinator) to <gdlgrp>).

3. Please assist.

tables:csks.

data: costcentre(30) value '(SAPLAIST)anlz-KOSTLV'. "cost centre

data: coordinator(30) value '(SAPLAIST)is_anla-GDLGRP'. "asset coordinator

field-symbols: <kostlv> type kostl.

field-symbols: <gdlgrp> type GDLGRP.

Assign (costcentre) to <kostlv>.

if sy-subrc = 0.

if not <kostlv> is initial.

select single zz_gdlgrp into csks-zz_gdlgrp

from csks

where kostl = <kostlv>.

Assign (coordinator) to <gdlgrp>.

if sy-subrc = 0.

if csks-zz_gdlgrp ne <gdlgrp>.

message E000(ZFI00) with

'Invalid Asset Coordinator' <gdlgrp> 'for cost center' <kostlv>.

endif.

endif.

endif.

endif.

1 REPLY 1
Read only

Former Member
0 Likes
464

Hi Guys,

I have resolved my problem, now it is working fine.

See the solution below:

tables:csks.

data: costcentre(30) value '(SAPLAIST)anlz-KOSTLV'. "cost centre

data: coordinator(30) value '(SAPLAIST)anla-GDLGRP'. "asset coordinator

data: actual_coordinator like anla-GDLGRP. "

field-symbols: <kostlv> type kostl.

field-symbols: <gdlgrp> type GDLGRP.

Assign (costcentre) to <kostlv>.

if sy-subrc = 0.

**Get the asset coordinator from csks table

if not <kostlv> is initial.

select single zz_gdlgrp into csks-zz_gdlgrp

from csks

where kostl = <kostlv>.

Assign (coordinator) to <gdlgrp>.

**Validate asset coordinator against cost centre

if sy-subrc = 0 and not <gdlgrp> is initial.

if csks-zz_gdlgrp ne <gdlgrp>.

move <gdlgrp> to actual_coordinator.

clear <gdlgrp>.

message E000(ZFI00) with

'Invalid Asset Coordinator' actual_coordinator 'for cost center' <kostlv>.

endif.

endif.

endif.

endif.

Regards,

Themba