Skip to main content

INTERNAL TABLES 3( DECLARING THE FIELDS VARIABLES).

Syntax  of  declaring  the  field  variables: 

 Data <field name>(<length>)  Type  <Data Type>   ----->1st(way).

                           or
  Data <field name>  Type   <Data Element>. --------> 2nd(way).
                           
                           or
Data <field name>   Type  <Database table name>--<field name>.
      3rd(way) [this is the most preferable way of declaring fields].


Eg:
          Data   BUKRS(4)  Type  C.    1st way.

         Data  BUKRS   Type BUKRS.   2nd  way(the  data element                                                name  may  change from  fields).

         Data   BUKRS  Type  T001-BUKRS.  3rd  way.


OBJECT:

        To display  the  vendor   numbers  , names  , and  countries. 

solution:
                   LFA1(Vendor master table)

               1.LIFNR  ----->Vendor Number.
               2. NAME1 ----->  Vendor Name.
              3.ORT01     ------> City.
              4. LAND1   ------> Country.

(before  writing  the  program see the  steps  to create  an             internal table in previous  post because  i  repeated  it twice)


PROGRAM:

       *Declaring  work area   with  3rd  way  of declaring field variables.

      DATA :  Begin  of  WA.
                      LIFNR     Type    LFA1-LIFNR ,
                      NAME1   Type   LFA1-NAME1 ,
                      LAND1    Type   LFA1-LAND1,
                    End       of      WA.

*declaring  internal table.
     
      DATA   IT   Like  Table  Of   WA.

*fetching  data  from  data base  table.
  
   SELECT   LIFNR  NAME1  LAND1  FROM  LFA1   INTO             TABLE   IT.

*retreving  data  from  internal  table
  
   Loop  At  IT  Into  WA
    
    WRITE  :  /   WA-LIFNR,
                          WA-NAME1,
                          WA-LAND1.
    ENDLOOP. 

>>Save  ,  check  , activate  and  test  it  you  will get  output  .

NOTE:
              The  order  of  the   fields   in  the  work area   as  well  as 
  the  order  of  the   the  fields  in   SELECT  Query   must  be            SAME.

             
          


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