Tuesday, July 28, 2015

Select Total Field Records

How to select total records from one or more than one fields from database?
We can do that by not using the WHERE condition as simple as that. Below is an example where we have selected PO numbers & items from table EKPO and we haven’t used WHERE condition. The system fetches all records from those two fields and prints the output.

To know the total numbers of rows we have used describe table statement so that we can see the total number records.

REPORT  zabap_gui.

TABLES: ekpo.

* Creating a custom structure of Item Table
TYPES:
      BEGIN OF ty_ekpo,
        ebeln TYPE ekpo-ebeln,
        ebelp TYPE ekpo-ebelp,
      END OF ty_ekpo.

* Creating a line type of predefined structure
DATA:
      wa_ekpo TYPE ty_ekpo,
      it_ekpo TYPE STANDARD TABLE OF ty_ekpo.

* Not using Where condition will fetch all rows from the fields
SELECT ebeln ebelp
  FROM ekpo INTO TABLE it_ekpo.

DESCRIBE TABLE it_ekpo.
WRITE:/  'Total Entries: ', sy-tfill.
SKIP.

WRITE:/    'PO No.', 15 'Item'.
ULINE.

LOOP AT it_ekpo INTO wa_ekpo.
  WRITE:/    wa_ekpo-ebeln, 15 wa_ekpo-ebelp.
ENDLOOP.

Here is the output.


4 comments:

AskMahe.com said...

Good Post

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

kavi kalyan said...

Best SAP Success Factor Training in Chennai

http://thecreatingexperts.com/sap-training-in-chennai/
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
http://thecreatingexperts.com/sap-mm-training-in-chennai/
http://thecreatingexperts.com/sap-fico-training-in-chennai/

Anonymous said...

Informative Blog...For a long time I was craving for a career growth in programming and then I came to know that THE CREATING EXPERTS is the one who provide training with hands on training and real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact 8122241286