‎2006 Sep 11 4:47 AM
Hi All,
I have a requirement for the user to dictate the length of a field. A field in the selection screen would ask for a length (a number) for example 6.
The program would then read this field and use the value 6 to be the length of an internal variable, CTR.
DATA: CTR(4) TYPE N.
CTR's default length is 4, but since the user wants it to be 6, it should be changed.
This is important since this field will be used to split a string into exact number of characters.
Please help.
Thanks,
Kenny
‎2006 Sep 11 6:23 AM
here is the code sample.
parameters: size(10) .
data: elem type ref to CL_ABAP_ELEMDESCR .
data: len type i .
data: dref type ref to data .
field-symbols: <field> type any.
start-of-selection .
len = size .
elem = cl_abap_elemdescr=>get_c( len ).
create data dref type handle elem.
assign dref->* to <field>.
clear len .
describe field <field> length len in character mode .
write:/ len .Regards
Raja
‎2006 Sep 11 6:48 AM
Hi Durairaj,
Thanks for the reply.
This method doesn't exist though.
cl_abap_elemdescr=>get_c
Please help.
Thanks,
Kenny
‎2006 Sep 11 6:49 AM
‎2006 Sep 11 6:52 AM
‎2006 Sep 11 6:56 AM
sorry, the code sample i had given wont work in 4.6B, you need atleast WAS6.20
i dont know how this can be done in 4.6B
Regards
Raja
‎2006 Sep 11 7:18 AM
Hi,
Is the program going to be used by various users @ the same time?
If yes then I guess it would be very difficult to do it otherwise if it's going to be used by only one user @ a time then I can give you a very crude way of doing it.
Reply if needed.
Regards
Nishant