‎2008 Jun 10 7:53 AM
hi
I had made an SAP Script,in my MAIN Window my IF-ELSE condition are there,but they are not working fine.
If I use WRITE FM for MAIN inside loop-endloop at my itab,than IF condition are displaying,if I not use LOOP-ENDLOOP,my ELSE part is working.
/E----
ITEM
/:----
IF &P_MATNR& EQ &ITAB-MATNR&.
*----
Material No Material Type Material Group
*----
&ITAB-MATNR& &ITAB-MTART& &ITAB-MATKL&
/:----
ELSE.
*----
Please Enter Correct Value.
/:----
ENDIF.
Please tell how to make both working together.
‎2008 Jun 10 8:26 AM
Hi,
I guess your loop statement looks like LOOP AT ITAB?
In that case ITAB-MATNR will only be filled within this loop. Outside the loop this field will be initial thus causing your script to go into the ELSE fork.
Regards,
John.
‎2008 Jun 10 8:45 AM
hi,
/E PRINT
/: IF &SLSLOCATION& = &SPACE&.
&SLSCITY1&&' 'SLSPINCODE1&&' 'SLSCOUNTRY&
/: ELSE.
&SLSLOCATION&&' 'SLSCITY1&&' 'SLSPINCODE1&&' 'SLSCOUNTRY&
/: ENDIF.
I have done the same but its working correctly..
try to use one WRITE FM in loop & before WRITE use condition & in else part use another WRITE for else part..
like
loop at itab..
if p_matnr NE itab-matnr.
write form.. "(for print)
else
write form" for error
endif.
endloop.
reward points if useful
thx
twinkal.