SAP CS_WHERE_USED_DOC_ANY Function Module for Bills of material; direct and (indirectly) document use via classes
CS_WHERE_USED_DOC_ANY is a standard cs where used doc any SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Bills of material; direct and (indirectly) document use via classes processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for cs where used doc any FM, simply by entering the name CS_WHERE_USED_DOC_ANY into the relevant SAP transaction such as SE37 or SE38.
Function Group: CSS5
Program Name: SAPLCSS5
Main Program: SAPLCSS5
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function CS_WHERE_USED_DOC_ANY pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'CS_WHERE_USED_DOC_ANY'"Bills of material; direct and (indirectly) document use via classes.
EXPORTING
DATUB = "Date 'valid to'
* STLTP = ' ' "
* NEWSI = ' ' "
DATUV = "Date 'valid from'
DOCAR = "Document type
DOCNR = "Document number
DOCTL = "Part document
DOCVR = "Document version
* POSTP = ' ' "Item category
* STLAN = ' ' "BOM usage
* WERKS = ' ' "Plant
IMPORTING
TOPDOC = "Data on the initial material
TABLES
WULTB = "WHERE-USED list table (items)
DOCCAT = "Assembly table: documents
EQUICAT = "Assembly table: equipments
KNDCAT = "Assembly table: sales orders
MATCAT = "Assembly table: materials
* PRJCAT = "
STDCAT = "Assembly table: standard objects
TPLCAT = "Assembly table: functional locations
EXCEPTIONS
CALL_INVALID = 1 DOCUMENT_NOT_FOUND = 2 NO_WHERE_USED_REC_FOUND = 3 NO_WHERE_USED_REC_SELECTED = 4 NO_WHERE_USED_REC_VALID = 5
IMPORTING Parameters details for CS_WHERE_USED_DOC_ANY
DATUB - Date 'valid to'
Data type: RC29L-DATUBOptional: No
Call by Reference: No ( called with pass by value option)
STLTP -
Data type: RC29A-ATABRDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
NEWSI -
Data type: CSDATA-XFELDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATUV - Date 'valid from'
Data type: RC29L-DATUVOptional: No
Call by Reference: No ( called with pass by value option)
DOCAR - Document type
Data type: DRAW-DOKAROptional: No
Call by Reference: No ( called with pass by value option)
DOCNR - Document number
Data type: DRAW-DOKNROptional: No
Call by Reference: No ( called with pass by value option)
DOCTL - Part document
Data type: DRAW-DOKTLOptional: No
Call by Reference: No ( called with pass by value option)
DOCVR - Document version
Data type: DRAW-DOKVROptional: No
Call by Reference: No ( called with pass by value option)
POSTP - Item category
Data type: RC29L-POSTPDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
STLAN - BOM usage
Data type: RC29L-STLANDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
WERKS - Plant
Data type: RC29L-WERKSDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for CS_WHERE_USED_DOC_ANY
TOPDOC - Data on the initial material
Data type: CSXDOCOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for CS_WHERE_USED_DOC_ANY
WULTB - WHERE-USED list table (items)
Data type: STPOVOptional: No
Call by Reference: No ( called with pass by value option)
DOCCAT - Assembly table: documents
Data type: CSCDOCOptional: No
Call by Reference: No ( called with pass by value option)
EQUICAT - Assembly table: equipments
Data type: CSCEQUIOptional: No
Call by Reference: No ( called with pass by value option)
KNDCAT - Assembly table: sales orders
Data type: CSCKNDOptional: No
Call by Reference: No ( called with pass by value option)
MATCAT - Assembly table: materials
Data type: CSCMATOptional: No
Call by Reference: No ( called with pass by value option)
PRJCAT -
Data type: CSCPRJOptional: Yes
Call by Reference: No ( called with pass by value option)
STDCAT - Assembly table: standard objects
Data type: CSCSTDOptional: No
Call by Reference: No ( called with pass by value option)
TPLCAT - Assembly table: functional locations
Data type: CSCTPLOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
CALL_INVALID - Function module call incomplete or invalid
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DOCUMENT_NOT_FOUND - Document not available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_WHERE_USED_REC_FOUND - no where used record available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_WHERE_USED_REC_SELECTED - no where used record selected
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_WHERE_USED_REC_VALID - no valid where used record available
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for CS_WHERE_USED_DOC_ANY Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_datub | TYPE RC29L-DATUB, " | |||
| lt_wultb | TYPE STANDARD TABLE OF STPOV, " | |||
| lv_topdoc | TYPE CSXDOC, " | |||
| lv_call_invalid | TYPE CSXDOC, " | |||
| lv_stltp | TYPE RC29A-ATABR, " SPACE | |||
| lv_newsi | TYPE CSDATA-XFELD, " SPACE | |||
| lv_datuv | TYPE RC29L-DATUV, " | |||
| lt_doccat | TYPE STANDARD TABLE OF CSCDOC, " | |||
| lv_document_not_found | TYPE CSCDOC, " | |||
| lv_docar | TYPE DRAW-DOKAR, " | |||
| lt_equicat | TYPE STANDARD TABLE OF CSCEQUI, " | |||
| lv_no_where_used_rec_found | TYPE CSCEQUI, " | |||
| lv_docnr | TYPE DRAW-DOKNR, " | |||
| lt_kndcat | TYPE STANDARD TABLE OF CSCKND, " | |||
| lv_no_where_used_rec_selected | TYPE CSCKND, " | |||
| lv_doctl | TYPE DRAW-DOKTL, " | |||
| lt_matcat | TYPE STANDARD TABLE OF CSCMAT, " | |||
| lv_no_where_used_rec_valid | TYPE CSCMAT, " | |||
| lv_docvr | TYPE DRAW-DOKVR, " | |||
| lt_prjcat | TYPE STANDARD TABLE OF CSCPRJ, " | |||
| lv_postp | TYPE RC29L-POSTP, " SPACE | |||
| lt_stdcat | TYPE STANDARD TABLE OF CSCSTD, " | |||
| lv_stlan | TYPE RC29L-STLAN, " SPACE | |||
| lt_tplcat | TYPE STANDARD TABLE OF CSCTPL, " | |||
| lv_werks | TYPE RC29L-WERKS. " SPACE |
|   CALL FUNCTION 'CS_WHERE_USED_DOC_ANY' "Bills of material; direct and (indirectly) document use via classes |
| EXPORTING | ||
| DATUB | = lv_datub | |
| STLTP | = lv_stltp | |
| NEWSI | = lv_newsi | |
| DATUV | = lv_datuv | |
| DOCAR | = lv_docar | |
| DOCNR | = lv_docnr | |
| DOCTL | = lv_doctl | |
| DOCVR | = lv_docvr | |
| POSTP | = lv_postp | |
| STLAN | = lv_stlan | |
| WERKS | = lv_werks | |
| IMPORTING | ||
| TOPDOC | = lv_topdoc | |
| TABLES | ||
| WULTB | = lt_wultb | |
| DOCCAT | = lt_doccat | |
| EQUICAT | = lt_equicat | |
| KNDCAT | = lt_kndcat | |
| MATCAT | = lt_matcat | |
| PRJCAT | = lt_prjcat | |
| STDCAT | = lt_stdcat | |
| TPLCAT | = lt_tplcat | |
| EXCEPTIONS | ||
| CALL_INVALID = 1 | ||
| DOCUMENT_NOT_FOUND = 2 | ||
| NO_WHERE_USED_REC_FOUND = 3 | ||
| NO_WHERE_USED_REC_SELECTED = 4 | ||
| NO_WHERE_USED_REC_VALID = 5 | ||
| . " CS_WHERE_USED_DOC_ANY | ||
ABAP code using 7.40 inline data declarations to call FM CS_WHERE_USED_DOC_ANY
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single DATUB FROM RC29L INTO @DATA(ld_datub). | ||||
| "SELECT single ATABR FROM RC29A INTO @DATA(ld_stltp). | ||||
| DATA(ld_stltp) | = ' '. | |||
| "SELECT single XFELD FROM CSDATA INTO @DATA(ld_newsi). | ||||
| DATA(ld_newsi) | = ' '. | |||
| "SELECT single DATUV FROM RC29L INTO @DATA(ld_datuv). | ||||
| "SELECT single DOKAR FROM DRAW INTO @DATA(ld_docar). | ||||
| "SELECT single DOKNR FROM DRAW INTO @DATA(ld_docnr). | ||||
| "SELECT single DOKTL FROM DRAW INTO @DATA(ld_doctl). | ||||
| "SELECT single DOKVR FROM DRAW INTO @DATA(ld_docvr). | ||||
| "SELECT single POSTP FROM RC29L INTO @DATA(ld_postp). | ||||
| DATA(ld_postp) | = ' '. | |||
| "SELECT single STLAN FROM RC29L INTO @DATA(ld_stlan). | ||||
| DATA(ld_stlan) | = ' '. | |||
| "SELECT single WERKS FROM RC29L INTO @DATA(ld_werks). | ||||
| DATA(ld_werks) | = ' '. | |||
Search for further information about these or an SAP related objects