2007 Sep 19 7:38 AM
hi to all experts,
what is the effect of this keywords.
CONDENSE WA_ITAB-TAGNAME.
TRANSLATE WA_ITAB-TAGNAME TO UPPER CASE.
and when we used 'Load-of-program' event.
what is the effect of this event.
this is trigrred before initilization or after.
thanks in advance and reward also
regard : deep.
2007 Sep 19 7:45 AM
<b>CONDENSE</b> c.
Addition:
... NO-GAPS
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See Use Only Character-Type Fields when Processing Strings.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Character String Processing and Unicode
Effect
Shifts the content of the field c to the left, so that sequences of blanks are reduced to exactly one blank. Leading blanks are removed, as are trailing blanks in string type fields.
Example
DATA NAME (30).
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
displays the following:
Dr. Michael Hofmann
Addition
... NO-GAPS
Effect
Suppresses all blanks from the field c
Example
DATA: BEGIN OF NAME,
TITLE(8) VALUE ' Dr.',
FIRST_NAME(10) VALUE 'Michael',
SURNAME(10) VALUE 'Hofmann',
END OF NAME.
CONDENSE NAME NO-GAPS.
The contents of NAME is now "Dr.MichaelHofmann".
Since the NAME structure is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any subfields. The contents of the subfield would therefore now be as follows:
NAME-TITLE = 'Dr.Micha'
NAME-FIRST_NAME = 'elHofmann '
NAME-SURNAME = ' '
Note
Do not use CONDENSE to manipulate field strings that include fields not of type C. This could result in the subfields containing characters of a different (that is, incorrect) type. Nor can you apply the statement to structures that contain components of type STRING.
Note
Performance:
The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn.
Related
SHIFT, CONCATENATE, REPLACE, SPLIT
Additional help
Condensing Field Contents
<b>TRANSLATE</b>
Variants:
1. TRANSLATE c TO UPPER CASE.
2. TRANSLATE c TO LOWER CASE.
3. TRANSLATE c USING r.
4. TRANSLATE c ...FROM CODE PAGE g1... TO CODE PAGE g2.
5. TRANSLATE f ...FROM NUMBER FORMAT n1... TO NUMBER FORMAT n2.
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Only character-type fields allowed in string processing.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.
See String processing
Variant 1
TRANSLATE c TO UPPER CASE.
Variant 2
TRANSLATE c TO LOWER CASE.
Effect
The first variant converts all lowercase letters in c to uppercase. The second variant converts all uppercase letters to lowercase.
Example
DATA letters(3) TYPE C.
MOVE 'abc' TO letters.
TRANSLATE letters TO UPPER CASE.
letters now has the contents 'ABC'.
Note
The classification of upper- and lowercase, and the actual characters used are determined by the current text environment (see SET LOCALE LANGUAGE). Problems may occur when the system converts the characters, if the wrong language has been specified in SET LOCALE LANGUAGE, or if data has been processed that does
Variant 3
TRANSLATE c USING r.
Effect
Replaces all the characters in the field c according to the rule in field r. c1 containscharacter pairs. The second character in each pair replaces the first. If r does not contain a character in c, this character remains unchanged. r can also be a variable.
Example
DATA: letters(20) TYPE C VALUE 'abcabcabcXab',
change(15) TYPE C VALUE 'aXbaYBabZacZ'.
TRANSLATE letters USING change.
letters now contains 'XaZXaZXaZXXaZ'.
Variant 4
TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.
Parts marked with " ..." are interchangeable
TRANSLATE c TO CODE PAGE g2.
TRANSLATE c FROM CODE PAGE g1.
Instead you can use conversion classes.
Effect
Converts the contents of the field c from character set g1 to character set g2. This variant uses the conversion table g1 to determine the SAP character, which is then used to determine the new character from g2.
Transaction SPAD allows you to display and maintain character sets. If one of the conversion tables does not exist, the runtime error CONVERSION_CODEPAGE_UNKNOWN occurs. Conversion combinations that are maintained as part of the runtime system for performance reasons do not trigger runtime errors, and you cannot change them using Transaction SPAD.
Example
DATA c(72) TYPE C.
TRANSLATE c FROM CODE PAGE '1110' TO CODE PAGE '0100'.
This statement converts the contents of field c from the HP-UX character set to IBM EBCDIC.
Note
Fields with types I, P, F, and X remain unchanged by the conversion. The syntax check only allows character fields for specifying the codepage. However, since the codepage is maintained in table TCP00 as a type N field with length 4, you should use this type.
Variant 5
TRANSLATE f ...FROM NUMBER FORMAT n1 ...TO NUMBER FORMAT n2.
Parts marked with " ..." are interchangeable
TRANSLATE f TO NUMBER FORMAT n1.
TRANSLATE f FROM NUMBER FORMAT n1.
Instead you can use conversion classes.
Effect
Converts the number formats in f. Currently, the number formats '0000' (HP, SINIX, IBM) and '0101' (DEC-alpha OSF) are supported. Other formats trigger the runtime error TRANSLATE_WRONG_NUM_FORMAT . If you omit FROM NUMBER FORMAT or TO NUMBER FORMAT, the system uses the system number format.
Example
DATA: f TYPE F,
hex(2) TYPE X,
nform LIKE tcp00-cpcodepage.
...
The contents of fields hex and f are stored in /ARCHIV
from another platform. hex is stored in a valid number
form when it is saved, and can therefore be read on
all platforms.
READ DATASET '/ARCHIV' INTO hex.
READ DATASET '/ARCHIV' INTO f.
nform = hex. "Conversion from non-host-specific. HEX into N(4)
TRANSLATE f FROM NUMBER FORMAT nform.
Effect
Converts the contents of f from the nform format of a given platform into the system representation.
Note
This converts fields with types I and F. As in variant 4, you should define the number formats with type N and length 4.
You can display system codepage and number formats using the function module SYSTEM_FORMAT. This allows you to store additional information for archiving purposes.
Note
Performance:
Converting lowercase letters to uppercase (or the other way round) in a 10 byte character field requires around 7 msn (standardized microseconds).
If you use ... c USING c1... to replace two characters of a 10 byte character field,the runtime is around 9 msn.
Exceptions
Non-Catchable Exceptions
Cause: Invalid number format.
TRANSLATE_WRONG_NUM_FORMAT
Related
REPLACE, OVERLAY, Conversion Classes
Additional help
Converting to Upper or Lower Case or Converting Characters
2.LOAD-OF-PROGRAM.
Effect
This event keyword defines an event block whose event is triggered by the ABAP-runtime environment when an executable program, a module pool, a function group or a sub-routine pool is loaded in the internal session.
When calling a program through SUBMIT or through a transaction code, then, at every call, a new internal session is opened and the event block is executed once at every call. You can initialize global data objects of the program here.
At the first call of an external Procedure (sub-program or function module), the framework program of the called procedure is loaded into the internal session of the caller, thus triggering the event LOAD-OF-PROGRAM. The event block is executed before the called procedure. At any further call of a procedure of the same framework program by a caller of the same internal session, the event LOAD-OF-PROGRAM is triggered no longer.
Note
The event LOAD-Of-PROGRAM should mainly be used to initialize global data when calling external procedures or Transactions. If you call executable programs with SUBMIT, we recommend that you use the event INITIALIZATION, as the Starting values for parameter and selection criteria are set after LOAD-OF-PROGRAM
Event Blocks
Event blocks are called through events which are triggered by user actions on selection screens and lists or by the ABAP runtime environment. You only have to define event blocks for events to which you want the program to react (whereas a subroutine call, for example, must have a corresponding subroutine). This ensures that while an ABAP program may react to a particular event, it is not forced to do so.
Program Constructor
Directly after an executable program, a module pool, a function group or a subroutine pool has been loaded, a special processing block can be executed exactly once. This processing block is defined as an event block using the event keyword LOAD-OF-PROGRAM. The processing block for LOAD-OF-PROGRAM has the same function for ABAP programs as a constructor has for classes.
Refer
2007 Sep 19 7:42 AM
Condense will remove the gaps. Suppose if a variable has the value 'A r u n'. then the after condense the answer will be 'Arun'.
Translate will translate the string into uppercase words. Eg. 'arun' to 'ARUN'.
Please reward points if useful.
2007 Sep 19 7:43 AM
Hello,
<b>CONDENSE c.</b>
Addition:
... NO-GAPS
Like all string processsing statements, you can only use character-type operands here. If the type of an operand is not STRING, the operand is treated like a type C field, regardless of its actual type, even though no actual conversion takes place.
Effect
Shifts the contents of c to the left, so that sequences of blanks are reduced to exactly one blank. Leading spaces (and, for type C fields, trailing spaces as well), are removed completely.
<b>TRANSLATE c TO UPPER CASE.
TRANSLATE c TO LOWER CASE.</b>
Effect
The first variant converts all lowercase letters in c to uppercase. The second variant converts all uppercase letters to lowercase.
Example
DATA letters(3) TYPE C.
MOVE 'abc' TO letters.
TRANSLATE letters TO UPPER CASE.
letters now has the contents 'ABC'.
<b>LOAD-OF-PROGRAM.</b>
Effect
Event keyword:
The corresponding event is triggered in an internal session immediately after a program with type 1, M, F, or S is loaded. The corresponding processing block is processed once per program and internal session.
The processing block LOAD-OF-PROGRAM has approximately the same function in an ABAP program with type 1, M, F, or S as the constructor method of a class in ABAP Objects.
Programs wiht type 1, M, F, or S can be loaded into an internal session in two ways:
Program calls
Whenever you call a program using SUBMIT or a transaction code, a new internal session is opened. The LOAD-OF-PROGRAM event is therefore called in each program call.
External procedure calls
The first time you call an external procedure (subroutine or function module), the main program of the procedure that you called is loaded into the internal session of the calling program. The event LOAD-OF-PROGRAM is triggered and the corresponding processing block is executed before the procedure that you called. However, subsequent calls from the same calling program to a procedure in the same subroutine pool or function group do not trigger the LOAD-OF-PROGRAM event.
Reaward if helpful,
Regards,
LIJO
2007 Sep 19 7:45 AM
HI
CONDENSE WA_ITAB-TAGNAME. this statement deletes the spaces in between the words
TRANSLATE WA_ITAB-TAGNAME TO UPPER CASE this statement makes the data stored in this to upper case ie a to A
LOAD OF PROGRAM IS THE VERY FIRST EVENT WHICH LOADS THE PROGRAM TO SAP MEMORY IT IS TRIGGERED BEFOR INITIALISATION AND IS AN INTERNAL EVENT YOU CANNOT CONTROL THIS
REWARD IF HELPFUL
VIVEKANAND
2007 Sep 19 7:45 AM
<b>CONDENSE</b> c.
Addition:
... NO-GAPS
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.See Use Only Character-Type Fields when Processing Strings.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Character String Processing and Unicode
Effect
Shifts the content of the field c to the left, so that sequences of blanks are reduced to exactly one blank. Leading blanks are removed, as are trailing blanks in string type fields.
Example
DATA NAME (30).
NAME(10) = ' Dr.',
NAME+10(10) = 'Michael',
NAME+20(10) = 'Hofmann'.
CONDENSE NAME.
WRITE NAME.
displays the following:
Dr. Michael Hofmann
Addition
... NO-GAPS
Effect
Suppresses all blanks from the field c
Example
DATA: BEGIN OF NAME,
TITLE(8) VALUE ' Dr.',
FIRST_NAME(10) VALUE 'Michael',
SURNAME(10) VALUE 'Hofmann',
END OF NAME.
CONDENSE NAME NO-GAPS.
The contents of NAME is now "Dr.MichaelHofmann".
Since the NAME structure is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any subfields. The contents of the subfield would therefore now be as follows:
NAME-TITLE = 'Dr.Micha'
NAME-FIRST_NAME = 'elHofmann '
NAME-SURNAME = ' '
Note
Do not use CONDENSE to manipulate field strings that include fields not of type C. This could result in the subfields containing characters of a different (that is, incorrect) type. Nor can you apply the statement to structures that contain components of type STRING.
Note
Performance:
The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn.
Related
SHIFT, CONCATENATE, REPLACE, SPLIT
Additional help
Condensing Field Contents
<b>TRANSLATE</b>
Variants:
1. TRANSLATE c TO UPPER CASE.
2. TRANSLATE c TO LOWER CASE.
3. TRANSLATE c USING r.
4. TRANSLATE c ...FROM CODE PAGE g1... TO CODE PAGE g2.
5. TRANSLATE f ...FROM NUMBER FORMAT n1... TO NUMBER FORMAT n2.
Depending on whether byte or character string processing is carried out, the operands can only be byte-type or character-type (see Overview).
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Only character-type fields allowed in string processing.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.
See String processing
Variant 1
TRANSLATE c TO UPPER CASE.
Variant 2
TRANSLATE c TO LOWER CASE.
Effect
The first variant converts all lowercase letters in c to uppercase. The second variant converts all uppercase letters to lowercase.
Example
DATA letters(3) TYPE C.
MOVE 'abc' TO letters.
TRANSLATE letters TO UPPER CASE.
letters now has the contents 'ABC'.
Note
The classification of upper- and lowercase, and the actual characters used are determined by the current text environment (see SET LOCALE LANGUAGE). Problems may occur when the system converts the characters, if the wrong language has been specified in SET LOCALE LANGUAGE, or if data has been processed that does
Variant 3
TRANSLATE c USING r.
Effect
Replaces all the characters in the field c according to the rule in field r. c1 containscharacter pairs. The second character in each pair replaces the first. If r does not contain a character in c, this character remains unchanged. r can also be a variable.
Example
DATA: letters(20) TYPE C VALUE 'abcabcabcXab',
change(15) TYPE C VALUE 'aXbaYBabZacZ'.
TRANSLATE letters USING change.
letters now contains 'XaZXaZXaZXXaZ'.
Variant 4
TRANSLATE c ...FROM CODE PAGE g1 ...TO CODE PAGE g2.
Parts marked with " ..." are interchangeable
TRANSLATE c TO CODE PAGE g2.
TRANSLATE c FROM CODE PAGE g1.
Instead you can use conversion classes.
Effect
Converts the contents of the field c from character set g1 to character set g2. This variant uses the conversion table g1 to determine the SAP character, which is then used to determine the new character from g2.
Transaction SPAD allows you to display and maintain character sets. If one of the conversion tables does not exist, the runtime error CONVERSION_CODEPAGE_UNKNOWN occurs. Conversion combinations that are maintained as part of the runtime system for performance reasons do not trigger runtime errors, and you cannot change them using Transaction SPAD.
Example
DATA c(72) TYPE C.
TRANSLATE c FROM CODE PAGE '1110' TO CODE PAGE '0100'.
This statement converts the contents of field c from the HP-UX character set to IBM EBCDIC.
Note
Fields with types I, P, F, and X remain unchanged by the conversion. The syntax check only allows character fields for specifying the codepage. However, since the codepage is maintained in table TCP00 as a type N field with length 4, you should use this type.
Variant 5
TRANSLATE f ...FROM NUMBER FORMAT n1 ...TO NUMBER FORMAT n2.
Parts marked with " ..." are interchangeable
TRANSLATE f TO NUMBER FORMAT n1.
TRANSLATE f FROM NUMBER FORMAT n1.
Instead you can use conversion classes.
Effect
Converts the number formats in f. Currently, the number formats '0000' (HP, SINIX, IBM) and '0101' (DEC-alpha OSF) are supported. Other formats trigger the runtime error TRANSLATE_WRONG_NUM_FORMAT . If you omit FROM NUMBER FORMAT or TO NUMBER FORMAT, the system uses the system number format.
Example
DATA: f TYPE F,
hex(2) TYPE X,
nform LIKE tcp00-cpcodepage.
...
The contents of fields hex and f are stored in /ARCHIV
from another platform. hex is stored in a valid number
form when it is saved, and can therefore be read on
all platforms.
READ DATASET '/ARCHIV' INTO hex.
READ DATASET '/ARCHIV' INTO f.
nform = hex. "Conversion from non-host-specific. HEX into N(4)
TRANSLATE f FROM NUMBER FORMAT nform.
Effect
Converts the contents of f from the nform format of a given platform into the system representation.
Note
This converts fields with types I and F. As in variant 4, you should define the number formats with type N and length 4.
You can display system codepage and number formats using the function module SYSTEM_FORMAT. This allows you to store additional information for archiving purposes.
Note
Performance:
Converting lowercase letters to uppercase (or the other way round) in a 10 byte character field requires around 7 msn (standardized microseconds).
If you use ... c USING c1... to replace two characters of a 10 byte character field,the runtime is around 9 msn.
Exceptions
Non-Catchable Exceptions
Cause: Invalid number format.
TRANSLATE_WRONG_NUM_FORMAT
Related
REPLACE, OVERLAY, Conversion Classes
Additional help
Converting to Upper or Lower Case or Converting Characters
2.LOAD-OF-PROGRAM.
Effect
This event keyword defines an event block whose event is triggered by the ABAP-runtime environment when an executable program, a module pool, a function group or a sub-routine pool is loaded in the internal session.
When calling a program through SUBMIT or through a transaction code, then, at every call, a new internal session is opened and the event block is executed once at every call. You can initialize global data objects of the program here.
At the first call of an external Procedure (sub-program or function module), the framework program of the called procedure is loaded into the internal session of the caller, thus triggering the event LOAD-OF-PROGRAM. The event block is executed before the called procedure. At any further call of a procedure of the same framework program by a caller of the same internal session, the event LOAD-OF-PROGRAM is triggered no longer.
Note
The event LOAD-Of-PROGRAM should mainly be used to initialize global data when calling external procedures or Transactions. If you call executable programs with SUBMIT, we recommend that you use the event INITIALIZATION, as the Starting values for parameter and selection criteria are set after LOAD-OF-PROGRAM
Event Blocks
Event blocks are called through events which are triggered by user actions on selection screens and lists or by the ABAP runtime environment. You only have to define event blocks for events to which you want the program to react (whereas a subroutine call, for example, must have a corresponding subroutine). This ensures that while an ABAP program may react to a particular event, it is not forced to do so.
Program Constructor
Directly after an executable program, a module pool, a function group or a subroutine pool has been loaded, a special processing block can be executed exactly once. This processing block is defined as an event block using the event keyword LOAD-OF-PROGRAM. The processing block for LOAD-OF-PROGRAM has the same function for ABAP programs as a constructor has for classes.
Refer
2007 Sep 19 7:45 AM
Condense will remove all the spaces from the given variable.
eg. if you have wa_itab-tagname as abc def then after condense you will get abcdef.
Translate will merely change the case of the letters.
so if you have wa_itab-tagname as abcdef then after translate to upper case you will get ABCDEF.
The event LOAD-Of-PROGRAM should mainly be used to initialize global data when calling external procedures or Transactions.
INITIALIZATION is triggered directly after LOAD-OF-PROGRAM and before the selection screen processing.
2007 Sep 19 7:46 AM
hi deep
condense wa_itab-tagname no gaps
it concatenate all the values with out gaps in between values
translate wa_itab-tagname to upper case
it changes lower case alphabets to uppercase
2007 Sep 19 7:50 AM
hi
condense will remove the spaces
translate : if u wnat to convert the lower case data to uppercase or viceversa u will use translate command.
abt Load-Of-Program event plz see below documentation .
The corresponding event is triggered in an internal session immediately after a program with type 1, M, F, or S is loaded. The corresponding processing block is processed once per program and internal session.
The processing block LOAD-OF-PROGRAM has approximately the same function in an ABAP program with type 1, M, F, or S as the constructor method of a class in ABAP Objects.
Programs wiht type 1, M, F, or S can be loaded into an internal session in two ways:
Program calls
Whenever you call a program using SUBMIT or a transaction code, a new internal session is opened. The LOAD-OF-PROGRAM event is therefore called in each program call.
External procedure calls
The first time you call an external procedure (subroutine or function module), the main program of the procedure that you called is loaded into the internal session of the calling program. The event LOAD-OF-PROGRAM is triggered and the corresponding processing block is executed before the procedure that you called. However, subsequent calls from the same calling program to a procedure in the same subroutine pool or function group do not trigger the LOAD-OF-PROGRAM event.
thanks,
maheedhar
2007 Sep 19 7:52 AM
Hi Deep,
1.Condense
*In the variable text, leading and closing blanks are completely removed
*and any other directly consecutive blanks are all replaced by exactly one
*space character or - if NO-GAPS is specified - are also removed completely.
DATA: BEGIN OF sentence,
word1(30) TYPE c VALUE 'She',
word2(30) TYPE c VALUE 'feeds',
word3(30) TYPE c VALUE 'you',
word4(30) TYPE c VALUE 'tea',
word5(30) TYPE c VALUE 'and',
word6(30) TYPE c VALUE 'oranges',
END OF sentence,
text TYPE string.
text = sentence.
Write 😕 'Before Condense::' , text.
skip.
CONDENSE text.
skip.
write 😕 'After Condense::', text.
2.Translate
<b>*With Translate you can convert lowercase to upper case or viceversa:</b>
DATA text TYPE string.
text = `Careful with that Axe, Eugene`.
write 😕 text.
TRANSLATE text TO UPPER CASE.
write:/ text.
3.Load-of-program
This event keyword defines an event block whose event is triggered by the ABAP-runtime environment when an executable program, a module pool, a function group or a sub-routine pool is loaded in the internal session.
The event LOAD-Of-PROGRAM should mainly be used to initialize global data when calling external procedures or Transactions. If you call executable programs with SUBMIT, we recommend that you use the event INITIALIZATION, as the Starting values for parameter and selection criteria are set after LOAD-OF-PROGRAM
Regards,
Madhu