‎2008 Nov 24 10:32 AM
hi experts,
i want to pass the data through parameters and return it will give length, for e.g if i
give sapabap in parameters the o/p will be 7 , for this i m using follwing piece of code.
REPORT ycompute NO STANDARD PAGE HEADING .
DATA: n TYPE i,
word1 type string.
parameters: p_word1 like word1.
n = STRLEN( p_word1 ).
WRITE:/ n.
on activation it sends error
the reference field 'WORD1' has an invalid nested data type.
how to proceed?
i m using 4.7 version.
regards
pankaj
‎2008 Nov 24 11:00 AM
Hi,
Try this...
DATA: n TYPE i.
parameters: p_word1 type string.
n = STRLEN( p_word1 ).
WRITE:/ n.
Regards,
N M Poojari
‎2008 Nov 24 10:33 AM
‎2008 Nov 24 10:39 AM
hi amit,
if i use data type c and give a data which has bigger length say 150 or more,
for e.g. wwwwwwwwwwwwwwwwwwwwwwwwwwwaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllllllllllllllll
mmmmmmmmmmmmmmmmmmmmmm in parameter
the o/p always will be 132
regards
pankaj
‎2008 Nov 24 10:47 AM
DATA: a TYPE char200 VALUE 'wwwwwwwwwwwwwwwwwwwwwwwwwwwaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmm'.
DATA: n(3) TYPE n.
n = strlen( a ).
WRITE: n.
‎2008 Nov 24 10:50 AM
hi amit ,
this is what which i have already done ok.
i want a parameter on screen in which data whose length to be calculated is to be passed
regards
pankaj
‎2008 Nov 24 10:35 AM
Hi,
Try using Datatype of Char instead of string.
Hope it solves out.
Thanks & Regards
‎2008 Nov 24 10:35 AM
Hi,
Try this....
REPORT ycompute NO STANDARD PAGE HEADING .
DATA: n TYPE i,
word1 type string.
parameters: p_word1 type string.
word1 = p_word1.
n = STRLEN( p_word1 ).
WRITE:/ n
‎2008 Nov 24 10:35 AM
hi,
use this instead...
parameters: p_word1 type string.
regards,
Peter
‎2008 Nov 24 10:45 AM
hi peter and avinash,
the data type string is not allowed with parameters,
it is giving error of deep data type.
regards
pankaj
‎2008 Nov 24 10:38 AM
Hi,
Basically the parameter field to be displayed on screen must contain certain defined length.
if you take parameters type string it takes 256 char length.
so
to best of my knowledge
parameters p_word type char40.
data n type i.
n = strleng( P_word ).
try this out.
regards
Ramchander Rao.K
‎2008 Nov 24 10:47 AM
hi ramchander ,
here u r fixing the length only upto 40.
what for length greater than 40?
regards
pankaj
‎2008 Nov 24 10:53 AM
‎2008 Nov 24 10:57 AM
Hi,
As per my knowledge in 4.7c, we cann't declare string in the selection screen. Its the data type which cann't be used for the parameters or select-options.
I think you got to use char with the restricted length.
If wrong please correct me.
In ECC6.0 your declaration is valid and you can directly declare even "TYPE STRING" in the parameters.
Edited by: Krishna Adabala on Nov 24, 2008 11:59 AM
‎2008 Nov 24 10:59 AM
There is a workaround for this:
Let ZTEST be your program in which parameter is defined.
Open this program in se51 with screen no 1000.
Double click input/output box of parameter in screen layoout.
Change defined from 132 to any value u like.
Note: Donot activate ztest in se38 again
‎2008 Nov 24 11:00 AM
Hi,
Try this...
DATA: n TYPE i.
parameters: p_word1 type string.
n = STRLEN( p_word1 ).
WRITE:/ n.
Regards,
N M Poojari
‎2008 Nov 24 11:04 AM
You may try using inline editor on Screen.
This will capture data in lines, you can add up string length of all lines.
Regards,
Mohaiyuddin
‎2008 Nov 24 12:00 PM
hi all,
thnks all for ur valuable inputs...........
as one of the frnds suggested that string declaration is not allowed with parameters in 4.7,,i also think so................
string declaration with parameters may work in ecc 6.0...if any one of frnds finds its solution then please leave a reply ,
this thread for length calculation remains open..
thanks and regards
pankaj
‎2010 Dec 23 6:41 AM