Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQ02 CS_BOM_EXPL_MAT_V2

former_member858887
Discoverer
309

Hello,

I've tried to create an infoset calling the function module CS_BOM_EXPL_MAT_V2.

During the creation of the infoset I have chosen the "data retrieval by program option"-->data structure STPOX

I've populated the data reading program as follows:

REPORT zq_bom_item_detail_currdate.
*
*---------------------------------------------------------------------*
* declarations
* (insert your declarations in this section)
*---------------------------------------------------------------------*
*
TABLES: mast.

TYPES: BEGIN OF y_mast,
matnr TYPE matnr,
werks TYPE werks_d,
stlan TYPE stlan,
stlal TYPE stalt,
END OF y_mast.

DATA: i_mast TYPE TABLE OF y_mast,
w_mast TYPE y_mast.

DATA: stpox TYPE stpox,
i_stpox TYPE STANDARD TABLE OF stpox,
t_stpox TYPE STANDARD TABLE OF stpox,
w_stpox TYPE stpox.

FIELD-SYMBOLS: <struc> TYPE stpox.
*-------------------------------------------------------------------*
* selection screen statements
*-------------------------------------------------------------------*
* (define your selection-screen here)
SELECTION-SCREEN BEGIN OF BLOCK blk0.
SELECT-OPTIONS: s_matnr FOR mast-matnr
OBLIGATORY,
s_werks FOR stpox-werks
OBLIGATORY.

SELECTION-SCREEN END OF BLOCK blk0.

* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_HEAD>



*-------------------------------------------------------------------*
* read data into IT_DATA
*-------------------------------------------------------------------*
* (select your data here into internal table IT_DATA)
clear: i_mast. refresh: i_mast.
SELECT *
FROM mast
INTO CORRESPONDING FIELDS OF TABLE i_mast
WHERE matnr IN s_matnr
AND werks IN s_werks.
LOOP AT i_mast INTO w_mast.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
capid = 'PP01'
mtnrv = w_mast-matnr
stlal = w_mast-stlal
stlan = w_mast-stlan
werks = w_mast-werks
TABLES
stb = t_stpox.

IF sy-subrc EQ 0.

LOOP AT t_stpox INTO w_stpox.

APPEND w_stpox TO i_stpox.

ENDLOOP.

ENDIF.
ENDLOOP.

*------------------------------------------------------------*
* output of the data
* (this section can be left unchanged)
*------------------------------------------------------------*
LOOP AT i_stpox ASSIGNING <struc>.
MOVE-CORRESPONDING <struc> TO stpox .
* !! the following comment MUST NOT BE CHANGED !!
*<QUERY_BODY>
endloop.

I have added a custom field to replicate the parent material in a further query as follows:

and in the coding section I have written this:

The infoset is getting generated properly.

However when I try to create a query from it in SQ01 I always get this error message:

I am very new to ABAP.

Can you advice about how to correct?

Any help would be much appreciated

0 REPLIES 0