Q
Problem solve Get help with specific problems with your technologies, process and projects.

How to add database retrieval logic for use in a Smart Form

Wondering how to add database retrieval logic for use in a Smart Form? SAP expert Mark Smithson will tell you how.

How can I retrieve data in form logic from a database table, if the data from that table is not getting supplied by a print program into a Smart Form?
Thanks for the excellent question!

From a high-level perspective, there are two places to add database retrieval logic for use in a Smart Form: (1)...

The print program (2) The form itself

If you add this logic to the print program, there are two rules:

  • Don't modify standard SAP code (e.g. use a Z-version instead)
  • Make sure the import/export parameters between the form and print program are in sync
  • If you add this logic to the form itself, you can put it either at the top of the form under Global definitions (in 'Initialization' or 'Form routines') or in a 'Program lines' node within the body of the form itself. However, if you go with the second option, there are other rules:

  • Don't put the logic in the MAIN window
  • Don't put the logic in a secondary window which can be hit more than once during form output
  • The reason is that the form will generate an ABAP function module. All of its program logic will become part of this code. So basic ABAP programming standards should apply, including efficient database access (e.g. no SELECT statements in nested loops, no retrieval of irrelevant table columns or rows).

    To put it another way, avoid accessing the database more than necessary. Program nodes which can be hit multiple times as the form is output should only pull from pre-populated tables passed from the top of the form or from the print program -- not from the database.

    This was last published in November 2005

    Dig Deeper on SAPscript and Smart Forms

    PRO+

    Content

    Find more PRO+ content and other member only offers, here.

    Have a question for an expert?

    Please add a title for your question

    Get answers from a TechTarget expert on whatever's puzzling you.

    You will be able to add details on the next page.

    Start the conversation

    Send me notifications when other members comment.

    By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

    Please create a username to comment.

    -ADS BY GOOGLE

    SearchManufacturingERP

    SearchOracle

    SearchDataManagement

    SearchAWS

    SearchBusinessAnalytics

    SearchCRM

    SearchContentManagement

    SearchFinancialApplications

    Close