Search code examples
abapopensqlsap-erp

How to create Selection and connecting output of deliveries and positions of delivery


How can I create a selection criteria and get the output fields?

Example: I need the selection to be delivery number and the output field would be delivery number, material number, quantity etc.

How can I write the select statement to get the result from the fields ?


Solution

  • First of all, a PARAMETER is necessary (or SELECT-OPTIONS, depending on what you need):

    PARAMETERS: p_delnr TYPE <delivery_number>.
    

    Then make a select statement:

    SELECT <delivery_number> <material_number> <quantity>
    FROM <DATABASE TABLE>
    INTO CORRESPONDING FIELDS OF <local_structure> "(or local table, with the TABLE addition)
    WHERE <delivery_number> = p_delnr.
    

    Then, after you have the data selected, you can output it with a WRITE statement or any way you want.

    You should also check out following documentations, for more information:

    1. SELECT STATEMENT
    2. PARAMETERS
    3. SELECT-OPTIONS