Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Thursday, September 23, 2010

Change any sentence to upper case

Go to SE37
Enter Name <>
Press Create Button
Enter Import & Export Variables as Type String
Enter Exceptions as NOT_VALID
TOO_LONG
TOO_SMALL
Create Source Code as Follows
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.

In the Perform part add code as follows (include LZPROPERTOP)
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

No comments: