12-14-2012 7:14 AM
hi all,
i have used sub-routines in my code. recently i did SLIN Overview test in which i got many errors regarding Obsolete statements.
i used Tables in my sub-routine
exp:
perform one_xxx tables itab1 itab2.
form one_xxx tables itab1 structure itab1_type
itab2 structure itab2_type.
endform.
well the error says:
The current ABAP command is obsolete
Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary
types, not "LIKE" or "STRUCTURE".
what does this mean. my code works fine. Should i have to correct my code or just ignore these errors.
pls guide me on this.
regards
satish chandra
Moderator Message - Basic ABAP syntax query. Un-marked as question.
Message was edited by: Suhas Saha
12-14-2012 7:21 AM
Your functionality may work fine even if there are SLIN/Code Inspector issues but for robust and future-proof programming, it's good if you follow best practices. Further, looking at the ones you've listed, I don't think it would take a lot of time to tweak them. Instead of TABLES you can use CHANGING. LIKE can be replaced by TYPE.
12-14-2012 9:09 AM
kumar, if i replace tables with change i am getting errors.
exp
perform one_xxx changing itab1 itab2.
form one_xxx changing itab1 type itab1_type
itab2 type itab2_type.
endform.
error itab1 is not an internal table.
infact i cant even declare a work area for it.
12-14-2012 9:19 AM
12-14-2012 9:23 AM
Itab1_type and itab2_type might not be table types instead just create table types or use like statement.
12-14-2012 9:25 AM
DATA: lsht_deletenos TYPE TABLE OF /hiplvreg/bapi_multipurpos_shr.
PERFORM timsreadreturn2
changing
lsht_deletenos
return.
FORM timsreadreturn2 changing lsht_deletenos type /hiplvreg/bapi_multipurpos_shr
return type bapiret2.
data lshr_deletenos like line of lsht_deletenos.
lshr_deletenos-sign = 'I'.
lshr_deletenos-option = 'EQ'.
lshr_deletenos-low = '577'.
APPEND lshr_deletenos
to lsht_deletenos.
endform.
syntax error: lsht_deletenos is not an internal table.
regards
satish chandra
12-14-2012 9:29 AM
Hi,
Instead of table statement use local type to declare data type of internal table and refer this type in subroutine call refer following screen shot for understanding :
Thanks,
Gagan
12-14-2012 9:33 AM
Type /hiplvreg/bapi_multipurpos_shr appears to be a structure and not a table type. Either you can define a global table type (making use of TYPES keyword) in your TOP include or you can create a table type in SE11 and then use it your FORM statement.
12-14-2012 9:40 AM
Hi Satish
For the syntax error : lsht_deletenos is not an internal table.
You will have to declare an internal table first of the type lsht_deletenos
and then append those values (in wa lshr_deletenos) in that internal table .
from internal table you can make changes or add in database table
regards
vaibhav
12-14-2012 9:49 AM
kumar if i use like instead of type im having no issues.
can't i use the structure to declare table type.
say,
data l_tab type table of /hiplvreg/bapi_multipurpose_str.
and use the same in my forms.
12-15-2012 11:34 AM
thanks guys for your support i did change all obsolete parameters i.e., table parameters in my code.
before closing this thread, i have one doubt, i declared few table type in ddic and few in my code using types.
1. is there any standard to do so?
2. whenever i am using sub-routines then do i have to do the dsame either defina a table type in ddic or define it in my code.
please reply to this and then im done.
regards
satish chandra
12-15-2012 5:21 PM
Well, there is no standard way as such but the advantage with creating table types in DDIC is that it can be re-used in different programs without having to declare the type in each program separately. Another advantage of creating DDIC table types is that they can be used in function module/method/subroutine signatures. If you need a table parameter in the signature of any of those, you will need a DDIC table type.
12-17-2012 5:20 AM
Thank you, Thank you all for your support. i am closing thish thread.
regards
satish chandra
12-14-2012 9:04 AM
Better read here for proper understanding.
http://help.sap.com/saphelp_470/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/content.htm
12-14-2012 9:24 AM
Hello Satish,
check below link, this might be helpful.
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm
regards,
Deepti