ERP Database - The Unofficial ERP Knowledge Base

Facebook Twitter del.icio.us Digg it
ERP Database contains a huge collection of articles related to ERP System and Software. Many of the articles are specifically related to SAP. All these ERP/SAP articles are freely available to everyone.

If you would like to submit an article or share any document related to ERP or any specific ERP software. Please mail it to support@erpdb.info. Please make sure that the documents are not copyrighted.
Social Bookmarks:

ABAP Programs: Dynamic sort command with several sort criteria

Print This Post Email This Post Written by admin on Jan 18th, 2008 | Filed under: ABAP Programs

REPORT ZSOURCE2302.
* Parameters for the sort criterion, can be modified by the end user
PARAMETERS: COLUMN1(10)          DEFAULT ‘NAME’,
COLUMN2 LIKE COLUMN1 DEFAULT ‘ID’.
* Declarations for later use
TABLES CUSTOMERS.
FIELD-SYMBOLS : <FS> TYPE ANY.

DATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100
WITH HEADER LINE.
* Filling the internal table
SELECT * FROM CUSTOMERS INTO TABLE ALL_CUSTOMERS.
* Dynamic sort with two sort criteria
SORT ALL_CUSTOMERS BY (COLUMN1) (COLUMN2) DESCENDING.
* Displaying the result
LOOP AT ALL_CUSTOMERS.
WRITE: / ALL_CUSTOMERS-ID,
ALL_CUSTOMERS-NAME,
ALL_CUSTOMERS-CITY,
ALL_CUSTOMERS-TELEPHONE.
ENDLOOP.

Share

If you like this post, you may as well like these too:

  1. ABAP Programs: Dynamic read table command REPORT ZSOURCE2303. * Parameters for reading a single line, can be modified by the end user PARAMETERS: KEY1(10) DEFAULT ‘NAME’, VALUE1(25), KEY2 LIKE KEY1 DEFAULT ‘ID’, VALUE2 LIKE VALUE1. *...
  2. ABAP Programs: Sample report with selection criteria REPORT ZSOURCE1801. TABLES: CUSTOMERS, BOOKINGS. PARAMETERS P_DATE TYPE D. SELECT-OPTIONS S_NAME FOR CUSTOMERS-NAME. SELECT * FROM CUSTOMERS WHERE NAME IN S_NAME. WRITE / CUSTOMERS-NAME. SELECT * FROM BOOKINGS WHERE ORDER_DATE...
  3. ABAP Programs: Using Internal Tables for Selection Criteria REPORT ZSOURCE1112.* Work areasTABLES: CUSTOMERS, BOOKINGS.* Internal tablesDATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 500 WITH HEADER LINE.* Reading entries from both database tableSELECT...
  4. ABAP Programs: Using a dynamic table name REPORT ZSOURCE1110.* Variables for later useDATA: TABLENAME(10), COUNT_ROWS TYPE I.* Setting the table name dynamicallyMOVE ‘CUSTOMERS’ TO TABLENAME.* Selecting dataSELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS.WRITE: TABLENAME, COUNT_ROWS. ~...
  5. ABAP Programs:Dynamic subtotals REPORT ZSOURCE2304. TABLES ACTFLI. DATA MY_FLIGHTS LIKE ACTFLI OCCURS 10 WITH HEADER LINE. DATA SUM_OCCUPIED_SEATS LIKE MY_FLIGHTS-SEATSOCC. DATA COLUMN(30). SELECT * FROM ACTFLI INTO TABLE MY_FLIGHTS ORDER BY PRIMARY KEY....
  6. ABAP Programs:Dynamic Open SQL Commands: table name REPORT ZSOURCE2305. PARAMETERS TABLENAME(10) DEFAULT 'CUSTOMERS'. DATA COUNT_ROWS TYPE I. SELECT COUNT( * ) FROM (TABLENAME) INTO COUNT_ROWS. WRITE: TABLENAME, COUNT_ROWS. DATA WHERE_TAB(80) OCCURS 10 WITH HEADER LINE. APPEND 'name...
  7. ABAP Program: Dynamic external perform (call back form) Here the two programs which are calling dynamically. REPORT ZSOURCE2309. PERFORM EXTFORM IN PROGRAM ZSOURCE2310 USING 'CALL_BACK_FORM' SY-CPROG. FORM CALL_BACK_FORM. WRITE / 'I am the call back form in ZSOURCE2309.'....
  8. ABAP: How to create a dynamic internal table and work area FIELD-SYMBOLS:<fs_table> TYPE STANDARD TABLE, <fs_table_wa> TYPE ANY. DATA: table_ref TYPE REF TO data, wa_ref TYPE REF TO data. DATA: l_structure TYPE dd02l-tabname value 'VBAP'.   CREATE DATA table_ref TYPE STANDARD...
  9. ABAP Source Code: Syntax of ABAP/4 Programs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 * Declaration...
  10. Dynamic SQL in SAP Dynamic SQL in SAP – Download here(rapidshare)...
  11. Dynamic ALV Generation Dynamic ALV Generation with data stored in table. Download the Complete Program on Dynamic ALV....
  12. Dynamic Selection Screen ABAP Program using Dynamic Selection Screen ABAP Program with consists of the selection screen, which changes based on the user click on a radio button. The entire selection screen is...
  13. ABAP Programs: Importing from the ABAP/4 Memory REPORT ZSOURCE1402. * Internal tables which will be imported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH HEADER LINE, NEW_BOOKINGS LIKE BOOKINGS OCCURS...
  14. ABAP Programs: Exporting to the ABAP/4 Memory REPORT ZSOURCE1401. * Work areas TABLES: CUSTOMERS, BOOKINGS. * Internal tables which will be exported DATA: ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH HEADER LINE, ALL_BOOKINGS LIKE BOOKINGS OCCURS 10 WITH...
  15. Some Cool Programs in ABAP and the link is :- http://www.kabai.com/abaps/q.htm...



Leave a Reply