2013 May 24 8:33 PM
Can anyone help me please? The following program shows error "type L and T are not compatible"
data: l, "leading characters
t, "trailing characters
done. "done flag
parameters p(25) default ' Vendor Number'.
while done = ' ' "the expression is evaluated first
vary l from p+0 next p+1 "then vary assignments are performed
vary t from p+24 next p+23.
if l = ' ' and t = ' '.
l = t = '-'.
else.
done = 'X'.
endif.
endwhile.
write: / p.
2013 May 25 9:51 AM
The type incompatible error is because you have specified the offset, but not the length.
Correct usage would be like this:
VARY l FROM p+0(1) NEXT p+1(1) RANGE p
VARY t FROM p+24(1) NEXT p+23(1) RANGE p.
Refrain from using VARY keyword if your keyword documentation considers this as obsolete.
The type incompatible error is because you have specified the offset, but not the length.
Correct usage would be like this:
VARY l FROM p+0(1) NEXT p+1(1) RANGE p
VARY t FROM p+24(1) NEXT p+23(1) RANGE p.
Refrain from using VARY keyword if your keyword documentation considers this as obsolete.
2013 May 25 7:28 AM
Hello,
What is ur reqirement
Explain in detail......
thanks
Kranthi
2013 May 25 9:02 AM
Hello Kranthi,
I want to know why it shows the error. It is supposed to give the following out put
The code in Listing 10.12 produces this output:
----Vendor Number ----
Please check the following link
http://www.sapnet.ru/abap21day/ch10/ch10.htm#UsingtheTTFONTSIZEwhileFONTTTFONTSIZEStatementFONT
2013 May 25 7:38 AM
Hi,
You get the type compatible error because the variable ''l'' you have declared is of length 1 and parameter p is of length 25. Tell us what you are trying to acheive from your above code so we could suggest something.
Best Regards,
Arun Krishnamoorthy
2013 May 25 8:59 AM
dear arun,
I have given 25 size to L but it shows the same error. Please check the following link.
http://www.sapnet.ru/abap21day/ch10/ch10.htm#UsingtheTTFONTSIZEwhileFONTTTFONTSIZEStatementFONT
Listing 10.12 An Example of the Use of the WHILE Statement
1 report ztx1012.
2 data: l, "leading characters
3 t, "trailing characters
4 done. "done flag
5 parameters p(25) default ' Vendor Number'.
6 while done = ' ' "the expression is evaluated first
7 vary l from p+0 next p+1 "then vary assignments are performed
8 vary t from p+24 next p+23.
9 if l = ' ' and t = ' '.
10 l = t = '-'.
11 else.
12 done = 'X'.
13 endif.
14 endwhile.
15 write: / p.
It should produce the following output
The code in Listing 10.12 produces this output:
----Vendor Number ----
Analysis Lines 2 and 3 define two single character variables l and t. Line 3 defines a flag to indicate when processing is complete. Line 5 defines p as character 25 with a default value. On line 6, the expression on the while statement is first evaluated. It proves true the first time through the loop. The assignments on lines 7 and 8 are then performed. Line 7 assigns the first character from p to l and line 8 assigns the last character to t. If l and t are both blank, line 10 assigns a dash to both. If they are not, line 12 assigns an 'X' to the done flag. On line 14, endwhile copies the values from l and t back to p. The while loop repeats again from line 6 as long as the done flag is blank.
2013 May 25 12:24 PM
Hi Prince,
Try this code,
data: l(1) type c, "leading characters
t(1) type c, "trailing characters
done. "done flag
parameters p(25) default ' Vendor Number'.
while done = ' ' "the expression is evaluated first
vary l from p+0(1) next p+1(1) RANGE P "then vary assignments are performed
vary t from p+23(1) next p+22(1) range p.
if l = ' ' and t = ' '.
l = t = '-'.
else.
done = 'X'.
endif.
endwhile.
write: / p.
2013 May 25 9:54 PM
2013 May 25 9:51 AM
The type incompatible error is because you have specified the offset, but not the length.
Correct usage would be like this:
VARY l FROM p+0(1) NEXT p+1(1) RANGE p
VARY t FROM p+24(1) NEXT p+23(1) RANGE p.
Refrain from using VARY keyword if your keyword documentation considers this as obsolete.
2013 May 25 9:52 PM
Dear Manish Kumar,
Thank you very much. Can you please help me to solve the following?
I have used 3 tables. The details are -
Table Type -> Check Table
Table Name -> YCT
Fields -> Country, Region
Values -> 1 entry -> INDIA, MUMBAI
Table Type -> Foreign Key table
Table Name -> YFKT
Fields -> Country
Table Type -> Another Table
Table Name -> YADFKT
Fields -> Region
Values -> 1 entry -> MUMBAI
Since this is an adapted Foreign Key, So the relationships are -:
YCT-Country = YFKT-Country
AND
YCT-REGION = YADFKT-Region
That means i want Valid "Country" should be present in check table (YCT) and for that a valid "Region" must be there in "YADFKT".
But when I am trying to enter data "INDIA" in YFKT then it is saying "Entry is not present in Check Table".
Why this error is coming ?
I have seen someone faced the same problem but havent solved yet
Please see the following links
http://scn.sap.com/message/13998633#13998633
http://scn.sap.com/message/13997823#13997823
Thanks again.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |