Skip to main content

INTERNAL TABLES(SELECT OPTIONS,PARAMETER)

SELECT-OPTIONS:

     Select - options    is  the  keyword  which  accepts  single                value, multiple  single values, single range ,multiple ranges.

Syntax:

  Select-options  <Name of the select-options>   for                          <variable name>.

eg:
        
       Data  V1  TYPE  T001-BUKRS .
       Select-options  S_BUKRS  for  V1.

(the  variable v1  must  be decleared  before  the  statement).


eg:

    Data V TYPE  KNA1-KUNNR.
   Select-options  S_KUNNR   for  V.

  
Syntax  of  Select-options  in Select Query:

 Select  <field1> <field2>.......  from  <database table>  Into Table  <internal table>  where  <field>  in <select-options> .

OBJECT:
      
Based on given  company codes  ,   display  the company codes 
, company names , and cities.

solution:

backend fetching:

PROGRAM:

*syntax  of select options

            Data  V1  Type  T001-Bukrs.
            Select-options   S_BUKRS  for   V1.

*syntax of work area.
  
     Data : Begin of  WA,
                Bukrs  Type  T001-Bukrs,
               Butxt   Type   T001-Butxt,
              Ort01   Type   T001-Ort01,
               End of  WA.

*syntax of  internal table
   
Data  IT Like  Table of  WA.

*select options syntax

Select   Bukrs  Butxt  Ort01  from  T001  Into  Table  IT  Where  Bukrs in  S_BUKRS.

*Loop  syntax

   Loop  At  IT  into  WA.
     WRITE : / WA-Bukrs,
                   WA-Butxt,
                   WA-Ort01.
      ENDLOOP.

>> Save  ,check  ,activate  and  test  the program   then  you  will find new  screen.


>>Provide  the  from  value  and  to  value  eg  3000 to 4000
   or  provide  multiple  value  eg  like   3000,  3005.....

>> according to the  given  values  the  output  is  displayed.

PARAMETER:

  Parameter   is  the  keyword  which   accepts  single  value  at  run-time.

SYNTAX:
  
     parameter <name of  parameter>  TYPE  <data type>.

eg:
       parameter  P_BUKRS  Type  T001-BUKRS.

       Syntax  of  parameter  in  select  query:

Select  <field1> <field2>........  from  <database table>
Into Table  <internal table>  where <field> = <parameter>

NOTE:

WE  USE  WHERE<FIELD>  IN <select option>  in  select options

we use   where<field> = <parameter>  .

OBJECT:

Based on the  given  company code  , to display  the  company  code, company  name  and  city.

solution:

*parameter syntax

 Parameter P_BUKRS   Type  T001-BUKRS.

*declaring work area and internal  table

 Data : Begin of  WA,
                Bukrs  Type  T001-Bukrs,
               Butxt   Type   T001-Butxt,
              Ort01   Type   T001-Ort01,
               End of  WA.

*syntax of  internal table
   
Data  IT Like  Table of  WA.

*select options syntax

Select   Bukrs  Butxt  Ort01  from  T001  Into  Table  IT  Where  Bukrs = P_BUKRS.

*Loop  syntax

   Loop  At  IT  into  WA.
     WRITE : / WA-Bukrs,
                   WA-Butxt,
                   WA-Ort01.
      ENDLOOP.

>>save ,check, activate, test   you  will new  screen as show  in  select options.

>> provide  the  value  you  will get  corsponding  output.


Difference  between  parameters  and  select  options

PARAMETERS                                         SELECT-OPTIONS

1. parameters  is  the  keyword     1.  select options is  the key-
   which  accepts  the  single-             -word  which  accepts  the 
  value  at  run time.                            single value,multiple-single
                                                             value,single value,multiple 
                                                              value.

2. without  providing  any  input   2. without  providing  any 
   to  the  parameter  we  an  not        input  to  the  select options
   get  output.                                       we  can  get  the  entire 
                                                             data  of  database.





Comments

Popular posts from this blog

ABAP BASICS CONTINUEATION

message: daily just follow my post maximum i will cover upto 90% of abap.                   DATA TYPES IN ABAP Data type specifies what type of the variable it is. data types in abap are divided into two categories.                                    NUMERIC DATATYPE                                   CHARACTER DATATYPE         1. Integer  [ I ]                                             1. Char  [ C ]           2. Float       [ F ]                                         ...

STEPS TO LOG ON TO SAP

            STEPS   TO   UP (ON) THE  SERVER: >> Double  click  on   the  SAP  Management  console  on desktop.   >> Select   the   server   , right   click ,   all tasks,  start. >> Provide  the  password. >>Expand  the server [ECC6], double click on the  ABAP WP               Table  in   the  leftside  , contiuncely  click  on  Refresh  button       until  the  status  is  wait   then  minimize  the  server. >>  Check  until  the  status  is  wait  ,if  it is  in  run  status  you             cannot  login.  so  check  until  status  is  wait. ...

INTRODUCTION TO SAP ABAP

                                                        SAP SAP   stands   as Systems Applications  and  Products in data processing. manufacturing unit Purchasing : The    purchasing department purchases  raw materials from the shops . Warehouse: The raw materials which are received  by  the unit is stored in the ware house. Finance: The amount of the raw materials are paid to shops by the finance department. Production: The production department looks after the production from the raw materials which are in the warehouse. Sales and Distribution: This department looks after the sales. Shipping: Shipping department looks after delevering the products from ware houseto the customers. And again finance department collects the amount from the customers. Human resou...