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

subroutines

Former Member
0 Likes
688

Hi,

My case is like this .

LOOP

IF

<b>IF

ENDIF.</b>

ENDIF.

ENDLOOP.

I want to move the code between my middle if-endif(bold here) to a subroutine. if i move to a subroutine it is showing error that inconsistent nesting.

request your help.

regards,

Ratna

Hi,

My case is like this .

LOOP

IF

<b>IF

ENDIF.</b>

ENDIF.

ENDLOOP.

I want to move the code between my middle if-endif(bold here) to a subroutine. if i move to a subroutine it is showing error that inconsistent nesting.

request your help.

regards,

Ratna

5 REPLIES 5
Read only

Former Member
0 Likes
664

Could you paste your actual code here.

Read only

Former Member
0 Likes
664

Hi Ratan ,

It should not display such an error , if you have moved your code to a subroutine .

Coule you please paste the relevant code here so that we can help you out .

Regards

Arun

Read only

Former Member
0 Likes
664

Hi Ratna,

Inside the second if statement, it is possible to send the values to the subroutine.for ex:

if gc_mode = 'W'.

PERFORM opendataset_mode USING gv_intrn gc_mode.

endif.

this will work even if it is within another if statement.

just use 'USING' while passing the values to the subroutine.it will work.

hope it is helpful, let me know if you still have doubt in this topic.

reward points if helpful.

Message was edited by:

Pradeep Kumar

Read only

Former Member
0 Likes
664

I just tried following way and I dont get any nesting error. Is this what you are saying?

data: begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

data: var type c value 'x'.

loop at itab.

if var eq 'x'.

if var eq 'x1'.

perform xx.

endif.

endif.

endloop.

&----


*& Form xx

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form xx.

endform. " xx

Thanks,

Santosh

Read only

Former Member
0 Likes
664

I think probably why the error is coming is because u havent put a period after 'if'...it should be like this...

<b>If</b> <condition><b> .</b>

<b>If</b> <condition><b> .</b>

Perform .......

<b>Endif.

Endif.</b>