‎2006 Dec 06 4:44 AM
‎2006 Dec 06 4:57 AM
I think you must first go and read some documentation on ABAP and other basic things instead of just hosting a Quiz contest over here .
1st go and read ur self.. then If u have doubts come to SDN.
All the questions that you have asked are very basic questions that can be understood just by reading some material.
‎2006 Dec 06 9:57 AM
‎2006 Dec 06 9:59 AM
a case statement is an abap syntax, which wil help you to brach to one of the multiple paths available based on a value.
eg:
case value.
when 1.
do something.
when 2.
do something else.
when 3.
do something else..
when others.
do some other thing.
endcase.
Regards,
Ravi
‎2006 Dec 06 12:11 PM
Case is an ABAP Syntax which will allow u to execute the part depending on the field value in when condition.
E.g
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 100.
WHEN 'CANCEL'.
LEAVE SCREEN.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN OTHERS.
MESSAGE '...' TYPE 'E'.
ENDCASE.
‎2006 Dec 06 1:34 PM
Case statement in ABAP is same as C language for exam:
case value.
when 1.
do something.
when 2.
do something else.
when 3.
do something else..
when others.
do some other thing.
endcase.
Its always preferred to use case statement rather than if else ladder. The case statement internaly generates the binary search to satisfy the "Value". If-else ladder is like linear search.
Hope this helps u to understand case statement.
‎2006 Dec 06 1:36 PM
FYA
I think you must first go and read some documentation on ABAP and other basic things instead of just hosting a Quiz contest over here .
1st go and read ur self.. then If u have doubts come to SDN.
All the questions that you have asked are very basic questions that can be understood just by reading some material.
‎2006 Dec 07 9:18 AM
Hi Abhay Singh
Syntax
CASE operand.
[WHEN operand1 [OR operand2 [OR operand3] ...].
[statement_block1] ]
...
[WHEN OTHERS.
[statement_blockn] ]
ENDCASE.
Effect
These statements define a control structure that can contain multiple statement blocks statement_block1 ... statement_blockn, of which no more than one is executed depending on the value in the operand operand.
Starting with the first WHEN-statement, the content of the operand operand is compared with the content of the operand operand1 operand2 ... in a descending order. The statement block is executed after the first identical instance is found. If no matches are found, the statement block is executed after the statement WHEN OTHERS.
For operand, operand1, operand2 , ...you can use the data object built-in functions and functional methods. With the latter, you receive the return value as an operand.
If the end of the executed statement block is reached or no statement block is executed, then the processing continues after ENDCASE.
For the comparison of the contents, the following logical expression can be used:
operand = operand1 [OR operand = operand2 [OR operand = operand3] ... ]
For the execution of the comparison with dependency on the data types of the involved operands, the same rules apply as described in the section Relational Operators for all Data Types.
Note
You cannot use a statement between the statement CASE and the first statement WHEN
Example
Linking the program flow according to the function code in the system field sy-ucomm.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 100.
WHEN 'CANCEL'.
LEAVE SCREEN.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN OTHERS.
MESSAGE '...' TYPE 'E'.
ENDCASE.