7/6/2017 5:17:38 PM

This blog will gives How to use Query method in class /SCWM/CL_DLV_MANAGEMENT_PRD. /SCWM/CL_DLV_MANAGEMENT_PRD~QUERY. Reads outbound delivery orders (PDO), inbound delivery orders (PDI), posting changes (SPC), stock transfers (WMR) and expected goods receipt (EGR). Outbound delivery header information can also be read at the same time for the outbound delivery orders that are found.

The deliveries are modeled as ABAP objects. By reading deliveries, these (object) instances represented by the deliveries are generated. You then have write access to these instances to change delivery data, for example. Apart from the database data being read, other automatic processes take place during the read process, or while the instances are created. Business Object Processing Framework (BOPF) determination and validations are also performed on the instances to set dynamic data, such as aggregated quantities and status. This can be performance-intensive. For read accesses in which no dynamically calculated data is required, it may be more appropriate to have no object instances of the deliveries generated. You can control this using the DATA_RETRIVAL_ONLY indicator, as explained as below.


There are three classes used to read outbound delivery, read request documents and read outbound deliveries which is given below.

1) /SCWM/CL_DLV_MANAGEMENT_PRD

Reads outbound delivery orders (PDO), inbound delivery orders (PDI), posting changes (SPC), stock transfers (WMR) and expected goods receipt (EGR). Outbound delivery header information can also be read at the same time for the outbound delivery orders that are found.

2) /SCWM/CL_DLV_MANAGEMENT_DR

Reads request documents, such as outbound delivery requests (ODR), inbound delivery notifications (IDR), or expected goods receipts notification (GRN).

3) /SCWM/CL_DLV_MANAGEMENT_FD

Reads outbound deliveries (FDO).


We will see how to use the class /SCWM/CL_DLV_MANAGEMENT_PRD


Below the importing parameters are used frequently

IT_DOCID

IT_DOCNO

IV_WHNO

IT_SELECTION and IV_DOCCAT.

Declare GINT_SELECTION with the type /SCWM/DLV_SELECTION_TAB, gwa_selection TYPE /scwm/dlv_selection_str.


Below the sample code will be used to fill Party Entitled to Dispose


    gwa_selection-fieldname = /scwm/if_dl_logfname_c=>sc_entitled_pdo_i.

    gwa_selection-sign      = gc_include.

    gwa_selection-option    = gc_equal.

    gwa_selection-low       = 'P0005'.

    APPEND gwa_selection TO gint_selection.


Below the code is used for how to declare and create object

LCL_PRD Type Ref To /SCWM/CL_DLV_MANAGEMENT_PRD

TRY.

        lcl_prd = /scwm/cl_dlv_management_prd=>get_instance( ).

        lcl_prd->query(

          EXPORTING it_selection      = gint_selection

                    iv_doccat         = /scwm/if_dl_c=>sc_doccat_wmpwr

          IMPORTING et_headers        = gint_header

                    et_items          = gint_item_data ).


      CATCH /scdl/cx_delivery.                          "#EC NO_HANDLER

        CALL METHOD me->add_message

          EXPORTING

            im_status = lc_error.

        RAISE no_data_found.

ENDTRY.


Selection Parameters


For a selection, at least one of the following parameters must be populated. Use only one of the parameters when invoking here. Note that if multiple parameters are used simultaneously, an OR operation occurs instead of an AND operation. Note this particularly if you use the parameter IT_SELECTION and a key table, such as IT_DOCID.


IT_DOCID

You can use this parameter to select according to documents with internal keys (GUIDs). If you use this parameter, at least the DOCID field must be populated. If, in addition, the ITEMID field is populated, the system attempts to read the item. For performance reasons, you must also populate the DOCCAT field.

IT_DOCNO

You can use this parameter to select according to documents with external keys. If you use this parameter, at least the DOCNO field must be populated. If the ITEMNO field is also populated, the system attempts to read the item. For performance reasons you must also populate the DOCCAT field.

IT_SELECTION

You can use this parameter to search for delivery documents with complex selection criteria. The selection is made according to logical field names by using the FIELDNAME field. The constants for this can be found in the following interfaces:

/SCDL/IF_DL_LOGFNAME_C

/SCWM/IF_DL_LOGFNAME_C

You can assign a particular field to a logical field name in Customizing for Extended Warehouse Management under Cross-Process Settings -> Delivery Processing -> Extend Delivery Processing -> Define Logical Field Names.

Note: You are not allowed to select according to logical field names for dynamic fields, for example, if the picking status at header level is aggregated dynamically from the items. This means that you cannot select by header status in this case, since it does not exist in the database. Instead, you can only select by item status.

As is the case for all selection parameters, here you must also take into account that the selection is translated into an SQL statement that must be of a certain size. In other words, you must not exceed 50 entries for the parameter. To select by ID, use either IT_DOCNO or IT_DOCID.

The following example shows a selection by items that have not yet been posted goods issue:

fieldname = /scdl/if_dl_logfname_c=>sc_status_value_dgi_i

sign      = 'I'

option    = 'EQ'

low       = /scdl/if_dl_status_c=>sc_v_no_goods_issue_booked.

If you use IT_SELECTION, the number of hits is always determined based on the database state. That means, if a delivery was created as transient, it is not considered when you use IT_SELECTION, since the object has not yet been saved to the database. However, IT_DOCID and IT_DOCNO are able to consider transient objects.


Return Parameters:


ET_HEADERS

Contains delivery header data. This mainly corresponds to the data that also exists in the corresponding maintenance transaction of the delivery. Special fields include the following:

CHANGEABLE

States whether the delivery was locked or whether it can be changed.

OBJECTSTATE

Shows the object state. This field only contains useful data if the respective object instance has been loaded.

OBJCHG

Shows the change state (for example, object was just created or changed). This field only contains useful data if the respective object instance has been loaded.

ET_ITEMS

Contains delivery item data. This mainly corresponds to the data that also exists in the corresponding maintenance transaction of the delivery. In /SCWM/CL_DLV_MANAGEMENT_FD, the parameter only contains the reference to the PRD items. The application data is contained in ET_ITEMS_PRD and ET_ITEMS_PRD_TO.

Special fields include the following:

CHANGEABLE

States whether the delivery was locked or whether it can be changed.

OBJECTSTATE

Shows the object state.

OBJCHG

Shows the change state (for example, object was just created or changed).

OD_DOCCAT + OD_DOCID

If an outbound delivery item already exists for an item, this contains links to the outbound delivery. When using IS_INCLUDE_DATA, note that the ITEM_OD indicator must be selected.

ET_ITEMS_TO or ET_ITEMS_PRD_TO

Contains information about target data for stock transfers or posting changes, for example.

ET_OD_HEADERS

In /SCWM/CL_DLV_MANAGEMENT_PRD, this parameter contains outbound delivery header data. Note that if an outbound delivery already exists for an outbound delivery order item, the outbound delivery header (here ET_OD_HEADERS) and not the outbound delivery order header (here ET_HEADERS) must be used.

ET_DOCCAT_TEXTS, ET_DOCTYPE_TEXTS, ET_ITEMTYPE_TEXTS, ET_ITEMCAT_TEXTS, ET_INCO1_TEXTS, ET_SRVLVL_DETAILS, ET_REFCAT_DETAILS, ET_PARTY_ROLE_DETAILS

These parameters contain short texts for the respective fields in the delivery.

ET_HU_TOP,  ET_HU_HEADERS, ET_HU_ITEMS, ET_HU_REF

These parameters contain HU information for the items that were read for the delivery. Their structure matches the standard HU parameters, for example how they are also used by function module /SCWM/DLV_GET_HUS_FOR_DELIVERY.

ET_HU_PRD

This parameter contains a combination of information from the delivery item and HU data. As the information in the parameter has to be calculated, using this parameters is relatively performance-intensive. If no object instances of the delivery exist, or if the application is performance-intensive, use the information from ET_HU_TOP, ET_HU_HEADERS, ET_HU_ITEMS or ET_HU_REF instead of this parameter.

EV_PARALLEL_PROCESSING_DONE

This parameter shows whether parallel processing was used for the read. In IS_READ_OPTIONS-PARALLEL_PROCESSING you can specify that parallel processing can be used in principle, but whether this is actually used depends on Customizing.

If you like this blog, please share (Facebook/LinkedIn/Google+) to click below links so it will reach to others.


COMMENTS