37073 - Selection in loop continuation lines is not allowed


SAP Error Message - Details

  • Message type: E = Error

  • Message class: 37 - Screen Painter

  • Message number: 073

  • Message text: Selection in loop continuation lines is not allowed

  • Show details Hide details
  • What causes this issue?

    You cannot select screen elements for moving or copying to lines in
    subsequent loop blocks.

    The system issues an error message and will not allow you to continue with this transaction until the error is resolved.

    How to fix this error?

    You can only move elements within a loop block.

    Error message extract from SAP system. Copyright SAP SE.


Smart SAP Assistant

  • What is the cause and solution for SAP error message 37073 - Selection in loop continuation lines is not allowed ?

    The SAP error message 37073, "Selection in loop continuation lines is not allowed," typically occurs in ABAP programming when there is an attempt to use a selection statement (like SELECT, SELECT-OPTIONS, or PARAMETERS) within a loop that is not allowed. This error is often related to the structure of the code and how the loops and selection statements are organized.

    Cause:

    1. Improper Placement of Selection Statements: The error usually arises when a selection statement is placed inside a loop that is not designed to handle it. For example, if you have a LOOP AT statement and you try to perform a SELECT query inside that loop, it can lead to this error.
    2. Nested Loops: If you have nested loops and the inner loop contains a selection statement, it may also trigger this error.
    3. Incorrect Use of Control Structures: Using control structures incorrectly can lead to this error, especially if the logic is not properly structured.

    Solution:

    1. Reorganize Your Code: Move the selection statement outside of the loop. Perform the selection before entering the loop, and then process the results within the loop.

      DATA: lt_data TYPE TABLE OF your_table_type.
      
      SELECT * FROM your_table INTO TABLE lt_data WHERE your_conditions.
      
      LOOP AT lt_data INTO DATA(ls_data).
          " Process each entry in lt_data
      ENDLOOP.
    2. Use Temporary Tables: If you need to filter or process data based on certain conditions, consider using temporary tables or internal tables to store the results of your selection before looping through them.

    3. Check Logic: Ensure that the logic of your program does not require a selection statement within a loop. If it does, consider restructuring your approach.

    Related Information:

    • ABAP Documentation: Refer to the official SAP ABAP documentation for best practices on using loops and selection statements.
    • Performance Considerations: Be mindful of performance implications when moving selection statements outside of loops, especially if the dataset is large. Fetching data in bulk before processing can often be more efficient.
    • Debugging: Use the ABAP debugger to step through your code and identify where the error occurs. This can help you understand the flow of your program and where adjustments are needed.

    By following these guidelines, you should be able to resolve the error message 37073 and improve the structure of your ABAP code.

    Artificial intelligence solution provided by tomco.ai.
    Disclaimer
    • Do you have any question about this error?


      Upgrade now to chat with this error.


Instant HelpGet instant SAP help. Start your 7-day free trial now.


Feature Free Access Free Trial
Basic SAP error explanation T-Code Explanation T-Code Explanation 2
Step-by-Step Usage Guide Step-by-Step Step-by-Step 2
Interactive SAP Coach Assistance Interactive SAP Interactive SAP 2
AI Troubleshooting for T-Code Errors AI Troubleshooting AI Troubleshooting 2

Related SAP Error Messages

Click the links below to see the following related messages:


SAP messages fall into 3 different categories: Error messages (message type = E), Warnings (W) or Informational (I) messages.

An error message will prevent you from continuing your work - it is a hard stop and you need to fix the error before you can proceed. A warning message will stop your work, however, you can then bypass the warning by pressing the Enter key on your keyboard. That said, it is still good practice to investigate the cause of the warning message and address it. An information message will not stop your work and is truly just for informational purposes.

Click on this link to search all SAP messages.


Rating
ERPlingo simplifies finding the accurate answers to SAP message errors. I now use every week. A must have tool for anyone working with SAP! Highly recommended!
Rate 1
Kent Bettisworth
Executive SAP Consultant