Skip to main content

INTERNAL TABLES CONTINUATION ....2

Object(task):

   To  Display  the  company  codes , company names, and  cities.

solution:(our  task is to fetch  the data from database and display it).

To Fetch  data  from database we need to write a select query:

Syntax of Select Query:

  Select  <field 1> <field 2>....<field n>   from <Data Base Table>
   Into    Table    <Internal Table>     where <condition>.

T001(Company Table):
 
It is standard database table which is given by SAP. It consists of data.
BUKRS ----->  Company Code.
BUTXT ------->Company Name.
ORT01 -------->City
LAND1 --------> Country.


TO KNOW THE DATATYPE  AND LENTH OF DATATYPE:

we follow  this  method  initially , but  there is  another  method  i  will dicuss in next post declearing  the  field  variables.

>> But  right now  , go  to   ABAP  screen. execute  SE11.



>> SELECT   database table  and  type   the  table  name  as                    T001(T ZERO ZERO ONE).

>> Click  on  display. 


>> There  you  can  fields  like  BUKRS ,BUTXT ...ETC on the             same  row   of  the  field  you  can  see the  type  and  length  of       the  field.
(THIS  BELOW FIGURE  IS NOT  EXACT  OF T001 BUT THIS IS THE  WAY  TO  FIND  BUKRS, BUTXT....ETC).


PROGRAM:
  
  * declaring  work area(work area name  is  wa ,  internal table                                                      name  is  It).
       
        DATA : Begin of  wa,
                      BUKRS(4)   Type  C,
                      BUTXT(25)  Type  C,
                      ORT01(25)    Type   C,
                      End  of  wa.

*declaring  internal table.
     
    DATA   It  Like  Table   of   wa.

*select query to fetch data from  database.

Select  BUKRS   BUTXT   ORT01  From  T001   Into  Table  It.

*loop for  printing data

Loop  At  It  into  wa.
  Write : /  wa-BUKRS,
                 wa-BUTXT,
                 wa-ORT01.
ENDLOOP. 

>> Save  , Check , Activate  the  program  and  test   it .(same  as  before  program if  you  need  it  refer to  previous  post.)

>>  The  output  is  displayed.










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...