Skip to Content

Dynamical Determination of Worklist Items: Select Batches by Shelf Life


This article describes how to add batches with the shelf life date within a certain time frame to a worklist.

GBT 2.0 offers the functionality of worklists which enables you to group tracked objects for further checking, and to trigger actions or run reports. You can share a worklist to solve an issue together with other colleagues.

Worklist items can either be read from the standard database tables (stored manually or using a period report) or they can be selected dynamically when displaying a worklist by executing a specific programmed determination.

To select worklist items dynamically, interface /GBT/IF_WORKLIST_ITEM_READ, which has two methods, needs to be implemented:

  • Method GET_NAME to define a name for the dynamical determination of worklist items
  • Method GET_ITEM_BY_WORKLIST_ID which has the worklist item determination logic

In this example, a worklist is implemented to display all batches which will expire in the next 30 days. This worklist should always display the current result for the date it is displayed.

The implementation of interface /GBT/IF_WORKLIST_ITEM_READ has to be created using transaction SE24.

  1. Double click on method GET_NAME, copy the following coding into this method, and choose Save (Ctrl+S):

    = 'Batches expiring next 30 days'(001).

  2. Go back to the class header (F3), and double click on method GET_ITEM_BY_WORKLIST_ID.
  3. Copy the following coding into this method and choose Save (Ctrl+S):

        lv_expiring_date TYPE /gbt/bat_expiry_date,
    TYPE /gbt/t_obj_guid.

    LIKE LINE OF et_worklist_itm_key,
    LIKE LINE OF lt_bat_itm_guid.

    CLEAR et_worklist_itm_key.

    = sy-datum + 30"Expiring in 30 days

    * Perform selection to return items with real batches
    SELECT obj_guid FROM /gbt/v_bat_itm INTO TABLE lt_bat_itm_guid
    WHERE expiry_date >= sy-datum
    AND expiry_date <= lv_expiring_date.

    LOOP AT lt_bat_itm_guid ASSIGNING <lv_bat_itm_guid>.
    APPEND INITIAL LINE TO et_worklist_itm_key
    ASSIGNING <ls_worklist_itm_key>.
    -worklist_id = iv_worklist_id.
    -obj_guid    = <lv_bat_itm_guid>.
    -obj_type    = 'BAT'.
  4. Activate all objects of the new class (Ctrl+F3).
  5. Add the new class to the GBT customizing Analysis of Global Batch Traceability Network -> Maintain Available Classes for Dynamic Worklist Items.
  6. Create a worklist with dynamic items:
    1. In the SAP NetWeaver Business Client (transaction NWBC) select a role and navigate to the Process Worklists screen.
    2. Choose Create and enter a name and a description for the new dynamic worklist to show all batches which will expire in the next 30 days.
    3. From the dropdown menu for column Item Selection choose the class name created before ('Batches expiring next 30 days').
    4. Choose Save to save your changes.

No comments