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: 

Sub-Routines?

former_member210158
Active Participant
0 Kudos

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

14 REPLIES 14

kakshat
Advisor
Advisor
0 Kudos

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.

0 Kudos

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.

0 Kudos

That's strange. Can you share how you have declared itab1?

Former Member
0 Kudos

Itab1_type and itab2_type might not be table types instead just create table types or use like statement.

0 Kudos

 

 

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

0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

Thank you, Thank you all  for your support. i am closing thish thread.

regards

satish chandra

Former Member

Former Member
0 Kudos

Hello Satish,

  check below link, this might be helpful.

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db979035c111d1829f0000e829fbfe/content.htm

regards,

Deepti