Skip to Content

BAPI_PRODORD_GET_DETAIL in sq02

Hi

Working on a query in SQ02 and have to make use of BAPI_PRODORD_GET_DETAIL

The infoset starts from table aufk and use aufk-aufnr to read components via this bapi. Syntax check is fine and generating infoset is also fine. But there is nothing output from lt_component. What can be wrong here? Thanks in advance.

Here is the codes.

data: lt_BAPI_PP_ORDER_OBJECTS like BAPI_PP_ORDER_OBJECTS.

lt_BAPI_PP_ORDER_OBJECTS-COMPONENTS = 'X'.



TYPES: BEGIN OF l_component.

INCLUDE STRUCTURE  BAPI_ORDER_COMPONENT.

TYPES: END OF l_component.


data: lt_component type l_component OCCURS 0 WITH HEADER LINE.


CALL FUNCTION 'BAPI_PRODORD_GET_DETAIL'

  EXPORTING

    NUMBER                 = aufk-aufnr

*   COLLECTIVE_ORDER       =

    ORDER_OBJECTS          = lt_BAPI_PP_ORDER_OBJECTS

* IMPORTING

*   RETURN                 =

 TABLES

*   HEADER                 =

*   POSITION               =

*   SEQUENCE               =

*   OPERATION              =

*   TRIGGER_POINT          =

   COMPONENT              = lt_COMPONENT

*   PROD_REL_TOOL          =

          .

COMPONENT = lt_COMPONENT-MATERIAL.

REQ_QUAN = lt_COMPONENT-REQ_QUAN.

WITHDRAWN_QUANTITY = lt_COMPONENT-WITHDRAWN_QUANTITY.
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 04, 2016 at 01:06 PM

    From a pure ABAP point of view, this is an internal table; you have to LOOP AT it to build the output fields. And with a basic Extras/structure and code you can only add some supplementary fields not add multiple records, so I suppose you get only one record per order if Infoset based on table AUFK (or similar AFKO, etc.)

    So did you read Using Programs to Retrieve Data in SAP Query online documentation more suitable for your supposed requirement.

    Regards,
    Raymond

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 07, 2016 at 06:50 PM

    As Raymond already explained, it is not feasible to add more lines to the query using additional coding. This has been explained on SCN many times (there are many very good blogs on Query on SCN, make sure to search and read them).

    If you want to report on the components in the production orders then you'd need to start the query from the component table (RESB) and then JOIN the higher level PO tables. But this may not be very efficient, depending on your selection criteria, data volume and other factors.

    What exactly are you trying to achieve and why can't you use standard reports like COOIS?

    Add comment
    10|10000 characters needed characters exceeded