Everything You Wanted to Know About ABAP Coding but Were Afraid to Ask

Everything You Wanted to Know About ABAP Coding but Were Afraid to Ask

Q&A with Faisal Altaf, SAP Technical Division Head, Al Yamamah Steel Industries Co.

Published: 17/July/2017

Reading time: 4 mins

Q: Can programmers start practicing ABAP coding without a license for SAP NetWeaver Application Server (SAP NetWeaver AS) for ABAP?

Faisal Altaf (FA): You can download and install a free trial version of SAP NetWeaver AS for ABAP from store.sap.com and start practicing. The initial validity of this trial version lasts for 90 days, but you can always renew the license.

Q: Can SAP NetWeaver AS for ABAP be installed on an operating system other than Windows (for example, Mac OS X, Linux, or Solaris)?

FA: You can use a virtual machine to achieve this goal. Install Windows in a virtual machine on your computer, and then install SAP NetWeaver AS for ABAP within that virtual machine. This process is detailed in my book.

Q: What types of objects can be used to create dashboards in SAP systems?

FA: There are two potential approaches to designing dashboards. Those who do not want to pay a licensing fee can use Microsoft Excel to design a dashboard and then populate SAP data onto this dashboard using object linking and embedding (OLE). The second approach is for those who already have a license for SAP BusinessObjects Dashboards. If you are designing a dashboard in SAP BusinessObjects Dashboards, you have to develop a web service for importing data from your SAP system. You can create a web service by first creating a function module for it. After finalizing your dashboard design, you can use this web service to map data onto your dashboard.

Q: What methods exist for designing a dashboard in a spreadsheet and then populating SAP data to that dashboard using OLE?

FA: When developing a dashboard template in a spreadsheet, there are two ways you can represent the data. The first is to display data as graphs using chart types (for example, column chart, bar chart, pie chart, and line chart). The second method is to represent the data in a simple table format. You can also use both methods on different sheets within the same spreadsheet file.

Q: Is it possible to define secondary indexes for an internal table?

FA: Yes. In the latest version of SAP NetWeaver, it is possible to define secondary indexes for an internal table. The purpose of a secondary index in an internal table is the same as it is in database tables. By using a secondary index in an internal table, you can read data from a sorted internal table more efficiently.

Q: Since report variants cannot be added to a transport request, how are ABAP report variants moved to a quality or production system?

FA: Execute program RSTRANSP using transaction code SA38 or SE38, type the program name into the “Program Name” field, type the variant name in the “Variant Name” field (if you want to transport all the variants, leave this field empty), and click the “Execute” icon in the application toolbar. Select the required variants from the “Transport Variant” pop-up window and click the “Continue” button. After clicking “Continue,” you get a “Prompt for Workbench Request” pop-up window. Now you can either create a new transport request or add these variants to the old request.

Q: What are your recommendations for writing a SELECT query to optimize system performance?

FA: First of all, try to select the data from the database in one go. Don’t use SELECT and ENDSELECT statements and don’t put the SELECT statement inside LOOP and ENDLOOP. Try to provide the full key combination in the WHERE clause. If you are dealing with small text tables, then it’s better to select all the data from the database table and put it into the internal table.

Q: Any tips for designing a Smart Form for sales or return invoice printouts?

FA: Here is a step-by-step overview of creating a Smart Form for sales or return invoices. You can find more details in my book, Introduction to ABAP: A Project-Driven Guide, available at bit.ly/IntrotoABAP:

  1. Use transaction code SMARTFORMS to begin designing a Smart Form.
  2. Create a driver program to select all the data that you want displayed in the Smart Form. In the case of a sales or return invoice, you need to select the data from the “Invoice Header” and “Invoice Details” tables and the site information data in the “Site Master” table. You will need article descriptions from the “Article Master” table as well.
  3. After arranging all your data, design a Smart Form and call this Smart Form from your driver program. You will need to export all the required data while calling the Smart Form.
  4. Select the proper page format for an invoice and select the Smart Style that you would like to use in your Smart Form. You can use a standard Smart Style or create a custom one.
  5. Go to the form interface and add all the data objects you are receiving from the driver program, including the internal table, which is mentioned in the “Tables” tab of the form interface.
  6. In the “Global Definitions” tab, fill in the “Currency” or “Quantity” fields that you are going to use in your Smart Form.
  7. Add a table in the main window of your Smart Form and arrange the table lines as per your requirements.
  8. Finally, add the different nodes to the table lines as per your requirements and map the importing data to these nodes.
Q: What is the future of ABAP as it relates to SAP Fiori? Will ABAP still be the programming language of choice as SAP users move to cloud-based systems?

FA: ABAP will always be there in the background. SAP Fiori only impacts what you see on the front end. We use different OData services to read or write data to or from an SAP system when we are working in SAP Fiori, but these OData services will always use ABAP in the back-end system to read or write data from the database.


More Resources

See All Related Content