09-26-2007 12:47 PM
Hi ABAPers,
I am giving an editable field in alv grid for the country & also giving default values as 'Hong Kong' & 'South Africa' based on some condition. But now the problem is that when we edit this field, its giving all the caharacters in upper case, whether i give the same country name or other.Simply screen is validating the input made by the user & giving it in upper case.But i want it as it is as the user enters (Proper case) when we go to print preview or after editing a field. So can any one plz help me how to do this.
Helpfull answer ll be rewarded.
Regards
Pankaj
09-27-2007 11:09 AM
Hi Pankaj ,
if you select wa_fieldcata-LOWERCASE = 'X' your alv cell can accept LOWER and UPPER CASE. ( It's not only lower case) .
Regards Dinh.
09-26-2007 12:51 PM
hi pankaj,
use this syntax,
PARAMETERS <p> ...... LOWER CASE ......
If you do not use the LOWER CASE addition, all input values are automatically converted into upper case.
If you use the TYPE addition to refer to data types from the ABAP Dictionary, the parameter adopts all attributes of the Dictionary field. These attributes cannot be changed, and you cannot use the LOWER CASE addition. The possibility for entering either upper- or lower-case values must be defined in the ABAP Dictionary.
Eg:
PARAMETERS: FIELD1(10),
FIELD2(10) LOWER CASE.
WRITE: FIELD1, FIELD2.
Please reward if helpful.
09-26-2007 1:14 PM
Hi
Thanks to u both for ur reply, but i m not using any parameter statement. i m displaying output on a alv grid. In this grid one of the field is 'Country' which is editable. i m passing the default value from my internal table to fieldcatalog as e.g. 'India'. Up to here everything is fine. But as this field is editable so user when changes this field & go for print preview or print then its coming as 'INDIA' which i dont want. i want it as the user enters it should come like that only. Whether he enters as 'India' or 'iNDia' or 'INDIA' or any how. i think now my problem is clear to u. Plz help me if u have some solution to do this.
Regards
Pankaj
09-26-2007 1:22 PM
ok dear create one more field in your internal table .
like
country type SSTRING lower case.
now on user action SY_UCOMM as you use in your program.
move the same into your internal table.
hope it will work.
reward if useful.
Amit
09-26-2007 1:23 PM
hi pankaj,
check the domain for your field. The output characteristics......Lowercase checkbox might be unchecked...
Regards,
Naveen Natarajan
09-26-2007 1:07 PM
use this
Parameters : p_data type SSTRING LOWER CASE.
write : p_data.
reward if useful.
Amit Singla
09-26-2007 1:19 PM
09-26-2007 1:26 PM
Hi,
Check the domain of the field, see if the Lower case check box is checked.This should solve ur problem and the text would remain as you typed it.
Regards,
Farhana
09-26-2007 1:47 PM
Thanks for ur reply frnds, but the thing is this field is of char type with a lenght of 15 & there is no domain or d/b table to get it. i have declared one internal table with field 'Country'. now i am passing value into this internal table field as 'India' by default for each record. So its showing o/p on alv grid as 'India' in editable field. But after editing its coming in upper case. here onwards i think u r clear with my problem.
Regards
Pankaj
09-27-2007 11:14 AM
dear in your internal table replace country from char type to
country type SSTRING LOWER CASE
see what you get in output of alv
09-27-2007 11:27 AM
I got the solution of problem u r facing...
Just define the country fields as TEXT15, it will take lowercase fields too.
e.g.
Data:
Country_name type TEXT15.
Reward points if useful, get back in case of query...
Cheers!!!
09-27-2007 12:34 PM
Hi Tripat,
Thanks for your help. By seeing your reply i thought it ll definitly work but its not working in my case, I have tried in the same way as:
data: country type text15.
syntatically its correct but still its not giving what i was looking for.Do u have something else which can work out in this case.
Thanks
Pankaj
09-27-2007 12:47 PM
can you just copy you entire code here, that wud be very helpful....
09-27-2007 1:02 PM
Thanks for your help frnds. i ve got the solution & that is:
wa_fieldcata-LOWERCASE = 'X'.
Thanks to all.
Pankaj
10-04-2007 11:01 AM
Dear Pankaj,
are you got solution for your issue?
otherwise reply me. i create a function module for this case its working properly if you want i can shear with you.
its too simple i send you all the instruction.
10-06-2007 12:37 PM
Thanks Dear Nelson,
I have got the answer for my problem but would like to see ur function module also. As i may do the same thing somewhere else & others can also take the benefit. So plz share it with all in details, plzzzzz...
Regards
Pankaj
10-27-2007 11:09 AM
Hi Pankaj
Sorry Last pew days i was in busy thats y i unable to reply u.
this is my steps.
1 Create a function group Tcode SE80 (ZProper)
2.Create a Function Module Tcode SE37 (NN_TEXT_CONVERT_PROPER)
2.1 In the Import tab create a veritable <b>STRING1</b>
2.2 In the Export tab create a veritable <b>STRING</b>
2.3 In the Exceptions tab create a veritable <b>NOT_VALID</b> , <b>TOO_LONG</b> and <b>TOO_SMALL</b>
2.4 Source Code tab (Source Code is below)
FUNCTION NN_TEXT_CONVERT_PROPER.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(STRING1)
*" EXPORTING
*" REFERENCE(STRING)
*" EXCEPTIONS
*" NOT_VALID
*" TOO_LONG
*" TOO_SMALL
*"----
*
DATA :
IT_TXTS TYPE TABLE OF STRING, "Tabel for data storing
WA_TXTS(100) TYPE C, "Getting each words
CP_TEXT TYPE STRING, "Copying text
NN_TEXT TYPE STRING. "Result text
*
CP_TEXT = STRING1.
SPLIT CP_TEXT AT SPACE INTO: TABLE IT_TXTS.
*
*break itnr.
LOOP AT IT_TXTS INTO WA_TXTS.
PERFORM CHANGE_CASE USING WA_TXTS.
CONCATENATE NN_TEXT WA_TXTS INTO NN_TEXT SEPARATED BY SPACE.
ENDLOOP.
CONDENSE NN_TEXT.
*
CASE SY-SUBRC.
WHEN 0.
STRING = NN_TEXT.
EXIT.
WHEN 2.
RAISE NOT_VALID.
WHEN 3.
RAISE TOO_LONG.
WHEN 4.
RAISE TOO_SMALL.
ENDCASE.
*
ENDFUNCTION.
3. in the PERFORM PART add following code to the include <b>LZPROPERTOP</b>
FUNCTION-POOL ZPROPER. "MESSAGE-ID ..
&----
*& Form CHANGE_CASE
&----
text
----
-->P_WA_TXTS text
----
FORM CHANGE_CASE USING P_WA_TXTS.
*
DATA : P_DEM.
P_DEM = '&'.
*
CALL FUNCTION 'STRING_UPPER_LOWER_CASE'
EXPORTING
DELIMITER = P_DEM
STRING1 = P_WA_TXTS
IMPORTING
STRING = P_WA_TXTS
EXCEPTIONS
NOT_VALID = 1
TOO_LONG = 2
TOO_SMALL = 3
OTHERS = 4.
*
ENDFORM. " CHANGE_CASE
Thats alll now you can use this function in any programs
if you want any clarification please reply me.
dont forget to rewards
if you like tell me how you solve that matter.
09-26-2007 1:50 PM
Hi Pankaj,
For the editable field, pass
In fieldcatalog,
wa_fieldcata-LOWERCASE = 'X'.
Best regards,
Prashant
09-26-2007 2:10 PM
Thanks dear, but i dont want to lower case also. I want it as user enters like that only or as a proper case like 'South Africa' or 'Hong Kong'.
Regards
Pankaj
09-27-2007 11:09 AM
Hi Pankaj ,
if you select wa_fieldcata-LOWERCASE = 'X' your alv cell can accept LOWER and UPPER CASE. ( It's not only lower case) .
Regards Dinh.