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

statement is not accessible

Former Member
0 Likes
1,565

Hi All,

I am trying to copy some code from old system 4.5 to new ecc6 instead of transporting. But it is giving this error at first if stment

any suggestions would be helpfull

Thanks in advance.

Thanks

Ritika

13 REPLIES 13
Read only

Former Member
1,498

HI,

if give some code here it will be helpful to understand.

By the way did u declare all the variables?

Is your program executable or Include program?

Regards,

Parvin

Read only

Former Member
0 Likes
1,498

Where is this if condition used? Is that a include, top include or in between 2 forms...endforms? This error can occur in various situations. It wont be of much help without showing us the relevant portion of the code and details

Vikranth

Read only

0 Likes
1,498

Hi guys,

Thanks for the quick response.

This the code i want to copy from old system to new. in se80 i have created and include in program SAPMV45A.

Let me know if any more details are required

constants: c_objectclas type cdpos-objectclas value 'VERKBELEG',
              c_tabname    type tabname          value 'VBAP',
              c_vbtyp_so   type vbak-vbtyp       value 'C',
              c_va02       type sy-tcode         value 'VA02',
              c_va02x      type sy-tcode         value 'VA02X'.
   types: begin of ty_cdpos,
            tabkey type cdpos-tabkey,
          end of ty_cdpos.
   types: begin of ty_vbap,                                
       posnr type vbap-posnr,                              
     end of ty_vbap.                                       
   data: t_cdpos      type standard table of ty_cdpos,
         st_cdpos     type ty_cdpos,
         t_vbap_curr  type standard table of ty_vbap,     
         st_vbap_curr type ty_vbap,                         
         w_high_posnr type posnr.
   if vbak-vbtyp  eq c_vbtyp_so
   and ( sy-tcode eq c_va02 or sy-tcode eq c_va02x ).
     refresh: t_cdpos.
     clear: w_high_posnr.
     select tabkey
       from cdpos
       into table t_cdpos
      where objectclas eq c_objectclas
        and objectid   eq vbak-vbeln
        and tabname    eq c_tabname.
     if sy-subrc eq 0
     and not t_cdpos[] is initial.
       sort t_cdpos by tabkey descending.
       read table t_cdpos into st_cdpos index 1.
       if sy-subrc eq 0.
         w_high_posnr = st_cdpos-tabkey+13(6).
         if w_high_posnr gt xvbap_high_posnr.
           xvbap_high_posnr = w_high_posnr.
         endif.
       endif.
     endif.                                                 
          refresh t_vbap_curr[].                           
     select posnr                                           
       from vbap                                            
       into table t_vbap_curr                               
      where vbeln eq vbak-vbeln.                           
     if sy-subrc eq 0                                    
     and not t_vbap_curr[] is initial.                     
       sort t_vbap_curr by posnr descending.               
       read table t_vbap_curr into st_vbap_curr index 1.   
       if sy-subrc eq 0                                     
       and st_vbap_curr-posnr gt xvbap_high_posnr.          
         xvbap_high_posnr = st_vbap_curr-posnr.            
       endif.                                               
     endif.
endif.

Thanks

Ritika

Edited by: ritika red on May 4, 2010 12:42 PM

Edited by: ritika red on May 4, 2010 12:44 PM

Read only

0 Likes
1,497

Could you please format the code in readable format? It looks messy and difficult to understand.

What is the error? Which IF statement is not accessible. Please be specfic.

Read only

0 Likes
1,497

This formatted code.

Code you please suggest something.

constants: c_objectclas type cdpos-objectclas value 'VERKBELEG', 
                           c_tabname type tabname value 'VBAP', 
c_vbtyp_so type vbak-vbtyp value 'C', 
c_va02 type sy-tcode value 'VA02', 
c_va02x type sy-tcode value 'VA02X'.
 types: begin of ty_cdpos, 
tabkey type cdpos-tabkey,
 end of ty_cdpos. 
types: begin of ty_vbap, 
posnr type vbap-posnr, 
end of ty_vbap.
 data: t_cdpos type standard table of ty_cdpos, 
        st_cdpos type ty_cdpos, 
        t_vbap_curr type standard table of ty_vbap, 
st_vbap_curr type ty_vbap, 
w_high_posnr type posnr. 
if vbak-vbtyp eq c_vbtyp_so 
       and ( sy-tcode eq c_va02 or sy-tcode eq c_va02x ). 
refresh: t_cdpos.
 clear: w_high_posnr. 
select tabkey from cdpos into table t_cdpos 
where objectclas eq c_objectclas and objectid eq vbak-vbeln and tabname eq c_tabname. 
if sy-subrc eq 0 and not t_cdpos[] is initial. 
sort t_cdpos by tabkey descending. 
read table t_cdpos into st_cdpos index 1.
 if sy-subrc eq 0. 
w_high_posnr = st_cdpos-tabkey+13(6). 
if w_high_posnr gt xvbap_high_posnr. 
xvbap_high_posnr = w_high_posnr.
 endif.
 endif.
 endif.
 refresh t_vbap_curr[]. 
select posnr from vbap into table t_vbap_curr 
where vbeln eq vbak-vbeln. 
if sy-subrc eq 0 and not t_vbap_curr[] is initial. 
sort t_vbap_curr by posnr descending. 
read table t_vbap_curr into st_vbap_curr index 1.
 if sy-subrc eq 0 and st_vbap_curr-posnr gt xvbap_high_posnr. 
xvbap_high_posnr = st_vbap_curr-posnr.
 endif.
 endif.
 endif.

}

Thanks

Ritika

Read only

0 Likes
1,497

What is the issue/error you are facing in this code?

Which statement is not accessible?

Read only

0 Likes
1,497

Hi,

where in SAPMV45A, you put this code? I believe its in any of the forms in the MV45AFZZ include .

Also let me know what is the error messgage you are getting ?

constants: c_objectclas type cdpos-objectclas value 'VERKBELEG',

c_tabname type tabname value 'VBAP',

c_vbtyp_so type vbak-vbtyp value 'C',

c_va02 type sy-tcode value 'VA02',

c_va02x type sy-tcode value 'VA02X'. " Let me know what is this T.code. ?

types: begin of ty_cdpos,

tabkey type cdpos-tabkey,

end of ty_cdpos.

types: begin of ty_vbap,

posnr type vbap-posnr,

end of ty_vbap.

data: t_cdpos type standard table of ty_cdpos,

st_cdpos type ty_cdpos,

t_vbap_curr type standard table of ty_vbap,

st_vbap_curr type ty_vbap,

w_high_posnr type posnr.

if vbak-vbtyp eq c_vbtyp_so and ( sy-tcode eq c_va02 or sy-tcode eq c_va02x ).

refresh: t_cdpos.

clear: w_high_posnr.

select tabkey

from cdpos

into table t_cdpos

where objectclas eq c_objectclas

and objectid eq vbak-vbeln

and tabname eq c_tabname.

if sy-subrc eq 0 and not t_cdpos[] is initial.

sort t_cdpos by tabkey descending.

read table t_cdpos into st_cdpos index 1.

if sy-subrc eq 0.

w_high_posnr = st_cdpos-tabkey+13(6).

if w_high_posnr gt xvbap_high_posnr.

xvbap_high_posnr = w_high_posnr.

endif.

endif.

endif.

refresh t_vbap_curr[].

select posnr from vbap

into table t_vbap_curr

where vbeln eq vbak-vbeln.

if sy-subrc eq 0 and not t_vbap_curr[] is initial.

sort t_vbap_curr by posnr descending.

read table t_vbap_curr into st_vbap_curr index 1.

if sy-subrc eq 0 and st_vbap_curr-posnr gt xvbap_high_posnr.

xvbap_high_posnr = st_vbap_curr-posnr.

endif.

endif.

endif.

Thanks,

Sai

Read only

0 Likes
1,496

It is showing the line number of first if stmt.

Say Statement not accessible.

yes it is part of include which is part of MV45AFZZ.

I have checked the code to me it looking same.

I can code the exit thorugh se80 i believe of this could be the problem.

Read only

0 Likes
1,496

hi,

have you uncommented the MODULE names: ???

*MODULE ZZEXAMPLE OUTPUT.

I mean have you written it inside some OUTPUT module with name starting with ZZ??

ags.

Edited by: ags on May 4, 2010 6:09 PM

Read only

0 Likes
1,496

"yes it is part of include which is part of MV45AFZZ."

Did you put the name of the include ( Your Z*** include program ) in the MV45AFZZ program on the top.

Thnaks,

Sai

Read only

0 Likes
1,496

I have include names which needs to be copied to new system from old system.

It can be part of include or it can be part of user exit.

I m comparing se80 and coding.

Let me know if i m following the correct process

Thanks

Ritika

Read only

Former Member
0 Likes
1,496

Hi,

Just add start-of-selection event before that if statement.

If it doest not rectify your problem, please paste the code.

Regards and Best wishes.

Read only

Former Member
0 Likes
1,496

Hi Ritika,

Problem seems to be some formating problem.

Please check proper space settings in this conditional loop.

Regds,

Anil