cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound delivery: Overdelivery / sending process code I002 by ABAP

Former Member
0 Kudos

Dear experts,

following scenario: We have an ID with 100 PCs of a product. Overdelivery tolerance is 50%. We receive handling units with 30 PCs. We pack the first 3 HUs arriving (that happens via MFS so not via a dialog but by scanning on the conveyor). That makes 90 PCs. We pack the 4th HU with 30PCs. This is within the tolerance. So we are at 120 PCs.

The goods receipt and delivery confirmation to ECC will now go on error with the 4th HU. We can overcome this error by sending I002 in the inbound delivery before the goods receipt posting. This would adjust the inbound delivery to 120 PCs in both systems. Now with a 5th HU we would have 150 PCs and still be in exactly the tolerance limits.

So processing sequence would be: Pack HU, check if overdelivery happened, if so send I002, then GR.

First question: This looks all overly complicated! What we want is receive up to 150 PCs in 5 HUs. Can't this be reached easier?

Second question: In case this is the right process, we need to automate the sending of I002 process code. I ended up deep in the BOPF with the classes /scwm/cl_sp_prd_inb (Method: /scmb/if_sp_action~execute) and /SCMB/CL_BASE. What is the correct way to send a process code from ABAP?


Thanks and regards,

Gunter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear experts I got it solved.

Basically it works as already suspected via sending a process code (not exception code). This can be reached by calling the service provider with the method EXECUTE to perform the action, e.g.

CALL METHOD lo_sp->/scdl/if_sp1_action~execute
     EXPORTING
       aspect       = '/SCDL/S_SP_A_ITEM'
       inkeys       = <lt_keys_work>
       inparam      = <ls_inparam>
       action       = '/SCDL/ACT_EXECUTE_ACTION'
*     relation_inkey     =
*     relation     =
     IMPORTING
       outrecords   = lt_outrecords
*     rejected     = lv_rejected
       return_codes = lt_return_codes
*     relation_outrecord = <ls_rel_outrecord>.


This will trigger an action for the delivery item. The type of action is then specified in the inparam which would look like this for the process code I002:


   ls_inparam-action_code = '028'. "delivery change
   CREATE DATA ls_inparam-action_control TYPE /scdl/bo_action_adjqty_str.
   ASSIGN ls_inparam-action_control->* TO <ls_pcode>.
   <ls_pcode>-prcode = 'I002'. "process code


It should run in this sequence:


  1. Set the warehouse number: /scwm/cl_tm=>set_lgnum( EXPORTING iv_lgnum = l_lgnum ).
  2. Create the service provider (in my case of type /scdl/cl_sp_prd_inb)
  3. Lock the delivery: CALL METHOD lo_sp->/scdl/if_sp1_locking~lock
  4. Select the aspect: CALL METHOD lo_sp->/scdl/if_sp1_aspect~select
  5. Call the method as shown above
  6. Save the transaction: CALL METHOD lo_sp->/scdl/if_sp1_transaction~save
  7. Unlock and clean-up: CALL METHOD lo_sp->/scdl/if_sp1_transaction~cleanup


I hope this might help anyone with a similar topic.


Gunter

Answers (3)

Answers (3)

cervantes_nicols
Participant

The following code is an example of inbound delivery modification on Item Level

***
*1- Create delivery provider and message
***

  CREATE OBJECT lo_message_box.

  CREATE OBJECT lo_sp
    EXPORTING
      io_message_box = lo_message_box
      iv_doccat      = /scdl/if_dl_doc_c=>sc_doccat_inb_prd
      iv_mode        = /scdl/cl_sp=>sc_mode_classic.
***
*2- Inbound delivery Selection
***

  lt_sp_k_head = VALUE #( ( docid = "MY DOC ID NUMBER" ) ).

  lo_sp->select( EXPORTING  inkeys = lt_sp_k_head
                            aspect = /scdl/if_sp_c=>sc_asp_head
                IMPORTING outrecords = lt_a_head
                          rejected = lv_rejected
                        return_codes = lt_return_codes ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ENDIF.

***
*3- Selection of the positions 
***
  lo_sp->select_by_relation( EXPORTING relation = /scdl/if_sp_c=>sc_rel_head_to_item
                                        inrecords = lt_sp_k_head
                                        aspect = /scdl/if_sp_c=>sc_asp_head
                              IMPORTING outrecords = lt_a_item
                                        rejected = lv_rejected
                                        return_codes = lt_return_codes ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ENDIF.

***
*4- Get ITEM_SAPEXT_PRDI aspect
***
  SELECT  t1~docid
          t1~itemid
   FROM /scdl/db_proci_i AS t1
    INTO TABLE lt_item_keys
    WHERE t1~docno = zmmewm_determ_pto_ctrl_scr_100-docno
    ORDER BY t1~itemno.

  lo_sp->select( EXPORTING inkeys = lt_item_keys
                           aspect = /scdl/if_sp_c=>sc_asp_item_sapext_prdi
                 IMPORTING outrecords = lt_a_item_ext
                           rejected = lv_rejected
                           return_codes = lt_return_codes ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ENDIF.

***
*5- Change with new value
***
  LOOP AT lt_a_item_ext  INTO DATA(le_a_item_ext).
    le_a_item_ext-/scwm/stagarea = new_valuestagarea.
    le_a_item_ext-/scwm/stagareagr = new_stagareagr.
    le_a_item_ext-/scwm/stagarbin = new_stagarbin.
    le_a_item_ext-/scwm/gmbin = new_gmbin.
    MODIFY lt_a_item_ext  FROM le_a_item_ext  INDEX sy-tabix.
  ENDLOOP.

***
*6- Lock data
***
  lo_sp->lock( EXPORTING inkeys = lt_sp_k_head
                          aspect = /scdl/if_sp_c=>sc_asp_head
                          lockmode = /scdl/if_sp1_locking=>sc_exclusive_lock
               IMPORTING rejected = lv_rejected
                          return_codes = lt_return_codes ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ENDIF.
***
*7- Update Data
***
  lo_sp->update( EXPORTING inrecords = lt_a_item_ext
                            aspect =  /scdl/if_sp_c=>sc_asp_item_sapext_prdi
                  IMPORTING outrecords = lt_a_item_ext_out
                             rejected = lv_rejected
                             return_codes = lt_return_codes ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ENDIF.

***
*8- Save Data & Commit
***
  lo_sp->save( IMPORTING rejected = lv_rejected ).
  IF lv_rejected = 'X'.
    PERFORM display_msg USING lo_message_box.
    EXIT.
  ELSE.
    COMMIT WORK AND WAIT .
    lo_sp->/scdl/if_sp1_transaction~cleanup( reason = 'END' ).
    COMMIT WORK AND WAIT .

    MESSAGE s000(0k) WITH 'Delibery' zmmewm_determ_pto_ctrl_scr_100-docno 'Act. con éxito'.

  ENDIF.

paulocsilva
Explorer
0 Kudos

You can also send your declarations, I didn't find any documentation on the input tables for the methods.

petrzak
Active Participant
0 Kudos

Hello Gunter,

the way you described it is correct.

I do not see any other easier way.

I would go with enhancement at MFS packing and putaway, which would add an exception code into warehouse task when there is any overdelivery, so you don't need to enter it manually.

Then you can set the process code in exception code as Sathish suggests.

Petr

Former Member
0 Kudos

Good day Petr,

out of some MFS reasons (conveyor and performance) we don't have a WT but we just create HUs at the scanning point connected to the inbound delivery. So that's why standard exception codes are not an option. I was able to write a test program to send process codes via BOPF framework, keep the thread updated when I have the final result.

Gunter

former_member193471
Active Contributor
0 Kudos

Hello Gunter,

For default process code I002 during WT Confirmation, we can try the below.


We need to apply the Exception code, during WT Confirmation. Inside the Exception Code, we can link Process Code I002. When we use this exception code, Process code will be automatically applied.


here is the Image for reference.


**************************************************************************************************************

Can you try using below to handle Over Delivery Goods Receipt Process.

Try through EGR(Expected Goods Receipt) Process.

Another option is, ERP side, while creating Purchase Orders, Maintain unlimited over delivery tolerance. And, EWM Side, Under the Interfaces->ERP Integration->General Settings->Set Control Parameters for ERP Version Control

Goods Receipt Mode :  2-Send full GR when GR has been posted for all Items.

Regards,

Sathish