‎2008 Feb 12 4:38 AM
hi all,
Can you please refer me to the exit for validating asset master data. I need to validate asset number for number range (as it is alphanumeric). Also I need to validate the entries in tab 'Time-dependent'. So an exit at around SAVE event would be required.
Thanks for your assistance.
Regards,
FS
‎2008 Feb 13 2:31 AM
Hi Swaminathan ,
Thanks for your reply. I have used the exit 'EXIT_SAPLAIST_003' as suggested but the it is not reading any field of table ANLZ so I cannot put a check for ANLZ fields. Please advise how can that be done. Thanks.
Regards,
FS
‎2008 Feb 12 5:36 AM
Can I use validations or substitutions for this check. I saw some exits in validations of asset master. So how can I use validations through those use exit. Thanks.
Regards,
FS
‎2008 Feb 12 8:58 AM
Hi..
The following are the exits found for AS01
AAPM0001 Integration of asset accounting and plant maintenance
AFAR0003 External changeover method
AFAR0004 Determination of proportional values for retirement
AINT0004 Change amount posted for certain areas
AINT0005 Dummy for extended syntax check. Do not use.
AISA0001 Assign Inventory Number
AIST0001 Exchange number range in master data maintenance
AIST0002 Customer fields in asset master
AMSP0002 Determine relationship type for two company codes
TRAN0001 User exit for asset transfer
From these.. u can find out the userexits using SMOD transaction( Goto smod input exit name eg: AAPM0001
and click on components, u can see the exits available.)
Check whethr it satisfies your requirement..
(U can put break points at these FMs and check whether it is getting activated while creating asset..(running AS01 tcode))
Check whethr AIST0001 will meet your requiremnt
there is an exit EXIT_SAPLAIST_001 in tis which is used for exchange number range
‎2008 Feb 12 9:16 AM
Hi FS,
For Time Dependent Tab, You need to write the code in the below exit:
EXIT_SAPLAIST_003.
This will definitely solve your issue as i already worked on this exit.
Thanks.
Note:Reward Points if you find useful.
‎2008 Apr 02 3:40 AM
Hi,
I am new to the oncept of user exit.
they told me i need to refer master data exit transaction data exit hierarchy exit.
pls pls help me and guide me to finish my task...
i m just new to the concept of user exit and i have just little bit of theory knowledge.
pls guide me with the topic as well as coding.
thanks a lot in advance
jaya
‎2008 Apr 02 3:41 AM
Hi,
I am new to the concept of user exit.
they told me i need to refer master data exit transaction data exit hierarchy exit.
pls pls help me and guide me to finish my task...
i m just new to the concept of user exit and i have just little bit of theory knowledge.
pls guide me with the topic as well as coding.
thanks a lot in advance
jaya
‎2008 Feb 13 2:31 AM
Hi Swaminathan ,
Thanks for your reply. I have used the exit 'EXIT_SAPLAIST_003' as suggested but the it is not reading any field of table ANLZ so I cannot put a check for ANLZ fields. Please advise how can that be done. Thanks.
Regards,
FS
‎2008 Feb 13 9:35 AM
Hi FS,
Please refer the below code:
Here i have done a check for ANLZ table.
*************************************************************************
*&----
**& Include ZXAISU04 *
*&----
*************************************************************************
D A T A D E C L A R A T I O N *
*************************************************************************
*Tables
TABLES: anlz.
*Types contianing the structure of tables ANLZ TITAB
DATA: BEGIN OF ly_anlz_cot.
INCLUDE STRUCTURE anlz.
INCLUDE STRUCTURE titab.
DATA: kz(1).
DATA: END OF ly_anlz_cot.
*Local Internal Tables
DATA: lt_anla TYPE STANDARD TABLE OF ranla ,
lt_anlz LIKE ly_anlz_cot OCCURS 0 .
DATA: lt_anla_aux LIKE ranla OCCURS 0 WITH HEADER LINE,
lt_anlz_aux LIKE ly_anlz_cot OCCURS 0 WITH HEADER LINE.
*Local Work Areas
DATA: lw_anla TYPE ranla.
*Variables
DATA:
lv_anla TYPE char30 VALUE '(SAPLAIST)ANLA', "ANLA Table
lv_anlz TYPE char30 VALUE '(SAPLAIST)ANLZ', "ANLZ Table
lv_anlz_cot TYPE char30 VALUE '(SAPLAIST)ANLZ_COT[]', "ANLZ Table
lv_ok-code TYPE char30 VALUE '(SAPLAIST)OK-CODE',
lv_plant TYPE werks_d,
lv_location TYPE stort,
lv_resp_cost TYPE kostlv,
lv_cost TYPE kostl,
lv_flag_resp TYPE aavis,
lv_flag_cost TYPE aavis.
DATA: lv_invnr type invnr,
lv_anln1 type anln1.
*Constants
CONSTANTS:
lc_update TYPE aavis VALUE 'U',
lc_flag TYPE aavis VALUE 'X',
lc_space TYPE aavis VALUE ' ',
lc_save TYPE fcode VALUE 'BUCH',
lc_save1 TYPE fcode VALUE 'SAVE',
lc_general TYPE fcode VALUE 'TAB01',
lc_tab TYPE fcode VALUE 'TAB02',
lc_allocation TYPE fcode VALUE 'TAB03',
lc_origin TYPE fcode VALUE 'TAB04',
lc_depre_area TYPE fcode VALUE 'TAB08',
lc_yes TYPE fcode VALUE 'YES',
lc_msgtyp TYPE msgty_co VALUE 'E',
lc_msgid TYPE arbgb VALUE 'ZMBRAA_SU',
lc_msgnr TYPE msgnr VALUE '002',
*-----Begin of <ins> 2007.01.10 PR1151 D12K912685
lc_dist TYPE fcode VALUE 'DIST',
lc_back TYPE fcode VALUE 'RW',
lc_comp_code TYPE aavis VALUE '9'.
*-----End of <ins>
*Field Symbols
FIELD-SYMBOLS:
<fs_anlz> TYPE STANDARD TABLE,
<fs_anla> STRUCTURE anla DEFAULT anla,
<fs_anlz_cot> STRUCTURE anlz DEFAULT anlz,
<fs_okcode> TYPE char10.
*Assigning the values of table ANLA to field symbol
ASSIGN (lv_anla) TO <fs_anla>.
MOVE <fs_anla> TO lw_anla.
*Assigning the values of table ANLZ to field symbol
ASSIGN (lv_anlz_cot) TO <fs_anlz>.
ASSIGN (lv_anlz) TO <fs_anlz_cot>.
ASSIGN (lv_ok-code) TO <fs_okcode>.
MOVE <fs_anlz> TO lt_anlz.
Begin of <ins> Siva 14/1/2006
if sy-tcode = 'AS01'.
if <fs_anla>-bukrs = '0650' and sy-dynnr = '1000' .
select single anln1 invnr into (lv_anln1,lv_invnr) from anla where invnr = <fs_anla>-invnr.
if sy-subrc is initial.
IF sy-ucomm = lc_save OR sy-ucomm = lc_yes OR sy-ucomm EQ lc_back OR sy-ucomm EQ lc_dist .
message e503(z001) with lv_invnr lv_anln1.
elseIF sy-ucomm EQ lc_general OR sy-ucomm EQ lc_tab OR sy-ucomm EQ lc_allocation OR sy-ucomm EQ lc_origin or sy-ucomm EQ ''.
message w503(z001) with lv_invnr lv_anln1.
endif.
endif.
endif.
endif.
if sy-tcode = 'AS02'.
if <fs_anla>-bukrs = '0650' and sy-dynnr = '1000'.
select single anln1 invnr into (lv_anln1,lv_invnr) from anla where invnr = <fs_anla>-invnr.
if sy-subrc is initial and <fs_anla>-anln1 <> lv_anln1.
IF sy-ucomm = lc_save OR sy-ucomm = lc_yes OR sy-ucomm EQ lc_back OR sy-ucomm EQ lc_dist .
message e503(z001) with lv_invnr lv_anln1.
elseIF sy-ucomm EQ lc_general OR sy-ucomm EQ lc_tab OR sy-ucomm EQ lc_allocation OR sy-ucomm EQ lc_origin or sy-ucomm EQ ''.
message w503(z001) with lv_invnr lv_anln1.
endif.
endif.
endif.
endif.
End of <ins> Siva 14/1/2006
*-----Begin of <ins> 2007.01.10 PR1151 D12K912685
*Check for Brazil Company Code
IF <fs_anlz_cot>-bukrs+0(1) EQ lc_comp_code.
*-----End of <ins>
*Check whether the Responsible cost center/Cost center have value
IF NOT <fs_anlz_cot>-kostl IS INITIAL OR
NOT <fs_anlz_cot>-kostlv IS INITIAL.
lt_anlz_aux[] = lt_anlz[].
READ TABLE lt_anlz_aux INDEX 1.
*Check whether the responsible cost center have value
IF NOT <fs_anlz_cot>-kostlv IS INITIAL.
lv_resp_cost = <fs_anlz_cot>-kostlv.
*Retreive the Plant and Location for the selected Responsible cost center
SELECT SINGLE stort werks
INTO (lv_location, lv_plant)
FROM ztbraa_cost
WHERE kostl EQ lv_resp_cost.
IF sy-subrc IS INITIAL.
lv_flag_resp = lc_flag.
*Assign the retrieved Plant and Location to the table ANLZ
<fs_anlz_cot>-werks = lv_plant.
<fs_anlz_cot>-stort = lv_location.
lt_anlz_aux-werks = lv_plant.
lt_anlz_aux-stort = lv_location.
MODIFY lt_anlz_aux INDEX 1.
lt_anlz[] = lt_anlz_aux[].
<fs_anlz>[] = lt_anlz[].
ELSE.
*Display warning message if the selected Resposible cost center does not have Plant and Location
IF sy-ucomm NE lc_save AND sy-ucomm EQ space AND <fs_okcode> NE lc_save.
<fs_okcode> = lc_tab.
sy-ucomm = <fs_okcode>.
ENDIF.
IF sy-ucomm EQ lc_general OR sy-ucomm EQ lc_tab OR sy-ucomm EQ lc_allocation OR sy-ucomm EQ lc_origin OR sy-ucomm EQ lc_depre_area.
MESSAGE w002(zmbraa_su) WITH text-001 text-002 lv_resp_cost .
ENDIF.
ENDIF.
*Check whether the cost center have value
ELSEIF NOT <fs_anlz_cot>-kostl IS INITIAL.
lv_cost = <fs_anlz_cot>-kostl.
*Retreive the Plant and Location for the selected cost center
SELECT SINGLE stort werks
INTO (lv_location, lv_plant)
FROM ztbraa_cost
WHERE kostl EQ lv_cost.
IF sy-subrc IS INITIAL.
lv_flag_cost = lc_flag.
*Assign the retrieved Plant and Location to the table ANLZ
<fs_anlz_cot>-werks = lv_plant.
<fs_anlz_cot>-stort = lv_location.
lt_anlz_aux-werks = lv_plant.
lt_anlz_aux-stort = lv_location.
MODIFY lt_anlz_aux INDEX 1.
lt_anlz[] = lt_anlz_aux[].
<fs_anlz>[] = lt_anlz[].
ELSE.
*Display Warning message if the selected cost center does not have Plant and Location
IF sy-ucomm NE lc_save AND sy-ucomm EQ space AND <fs_okcode> NE lc_save .
<fs_okcode> = lc_tab.
sy-ucomm = <fs_okcode>.
ENDIF.
IF sy-ucomm EQ lc_general OR sy-ucomm EQ lc_tab OR sy-ucomm EQ lc_allocation OR sy-ucomm EQ lc_origin OR sy-ucomm EQ lc_depre_area.
MESSAGE w002(zmbraa_su) WITH text-001 text-002 lv_cost.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*Clear Plant and Location if Responsible cost center/Cost center is initial
IF <fs_anlz_cot>-kostl IS INITIAL AND <fs_anlz_cot>-kostlv IS INITIAL.
lt_anlz_aux[] = lt_anlz[].
READ TABLE lt_anlz_aux INDEX 1.
IF lt_anlz_aux-kz EQ lc_update.
CLEAR :<fs_anlz_cot>-werks,<fs_anlz_cot>-stort.
lt_anlz_aux-werks = <fs_anlz_cot>-werks.
lt_anlz_aux-stort = <fs_anlz_cot>-stort.
MODIFY lt_anlz_aux INDEX 1.
lt_anlz[] = lt_anlz_aux[].
<fs_anlz>[] = lt_anlz[].
ENDIF.
ENDIF.
*Display Error message if the selected Responsible cost center/Cost center does not have Plant and Location
IF sy-ucomm = lc_save OR sy-ucomm = lc_yes OR sy-ucomm EQ lc_back OR sy-ucomm EQ lc_dist OR sy-ucomm = lc_save1 OR <fs_okcode> EQ lc_save .
IF lv_flag_resp = lc_space AND lv_cost IS INITIAL.
IF sy-ucomm = lc_yes.
LEAVE SCREEN.
ENDIF.
MESSAGE e002(zmbraa_su) WITH text-001 text-002 lv_resp_cost.
ENDIF.
IF lv_flag_cost = lc_space AND lv_resp_cost IS INITIAL.
IF sy-ucomm = lc_yes.
LEAVE SCREEN.
ENDIF.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = lc_msgid
exception_if_not_active = space
msgty = lc_msgtyp
msgv1 = text-001
msgv2 = text-002
msgv3 = lv_cost
txtnr = lc_msgnr
EXCEPTIONS
message_type_not_valid = 1
not_active = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*-----End of <ins>
Thanks.
Note:Reward Points if you find useful.
‎2015 Feb 03 4:18 PM
Hello Swaminathan,
This is a great code you got here. I just would like to ask for your assistance on how can i move and transfer values from the table (SAPLAIST) ANLZ', "ANLZ to new table lw_anlz [ ] . I tried to enhance the code to cater the requirements needed by our clients.
Basically our requirements is to get the 'KZ' on time-dependent data by transferring the whole table.
DATA: lw_anlz TYPE STANDARD TABLE OF RANLZ. "New table
I tried to transfer by adding this code line however, no values where transfered.
Maybe you have better recommendation for this one.
Thank you!
Gabriel
‎2008 Feb 13 11:08 PM
Thanks Swaminathan. Great technique. I guess in this way we can capture any table for that a transaction. Thanks for your guidance. Full points rewarded.
Regards,
FS
‎2008 Feb 14 2:54 AM
Just one more thing please. When I display a error message due to a validation I am using the function as you specified:
CALL FUNCTION 'MESSAGE_STORE'
But it does not go to the transaction screen and just holds on to the error. Please advise.
Regards,
FS
‎2008 Feb 14 1:31 PM
Hi FS,
It should display the message in transaction, just check your import parameters.
Thanks.
Note:Reward points if you find it useful.
‎2008 Feb 18 2:09 AM