Supply Chain Management Blogs by Members
Learn about SAP SCM software from firsthand experiences of community members. Share your own post and join the conversation about supply chain management.
cancel
Showing results for 
Search instead for 
Did you mean: 
k_sood
Active Participant
Introduction

Adding a new field to the Handling unit field catalog in customizing is just not enough to make it work. Here are the details , what all has to be done.

Customizing

At the following path, new field has to be added.

 


Customizing path


 

Added field as follows:


Added Field


Maintain condition records

In the transaction /SCWM/PRHU6 , the newly added field should now be available in order to maintain the condition records.


Condition records


 

While attempting to generate the action through /SCWM/VASEXEC , would still not create any action in SPPFP. The reason is, newly added field has to be filled with the value .

Badi Implementation

Badi /SCWM/ES_PRNT_CCAT , method CHANGE has to be implemented , in order to provide value to the newly added field.  Here is the code sample from this scenario.
    DATA: lo_context         TYPE REF TO /scwm/cl_hu_cxt_ppf.
DATA: lo_ao_hu TYPE REF TO /scwm/cl_hu_ppf.
DATA: lv_huident TYPE /scwm/de_huident.
DATA: lv_ttype TYPE ppfdtt.
DATA : lv_vsbed TYPE /scwm/vsbed.
FIELD-SYMBOLS : <request> TYPE /sapcnd/det_request .
FIELD-SYMBOLS : <item_attr> TYPE /sapcnd/det_attrib_value .
DATA: ls_item_attr TYPE /sapcnd/det_attrib_value .
DATA: ls_attribute TYPE /sapcnd/det_attrib_value.
DATA: lt_huref TYPE /scwm/tt_huref_int.
DATA: ls_item TYPE /scdl/db_proci_o.
DATA : ls_vbfa TYPE vbfa,
ls_likp TYPE likp.
DATA : lf_vsbed TYPE vsbed.

DATA: lt_ordim_int TYPE /scwm/tt_ltap_vb,
ls_starea TYPE /scwm/tstarea.


* Get context class (/SCWM/CL_HU_CXT_PPF)
lo_context ?= io_context_hu.

* Get persistent data
lo_ao_hu ?= io_context_hu->appl. "ref to object -> /scwm/cl_hu_ppf
lv_huident = lo_ao_hu->get_huident( ).

"read the HU and the content
CALL FUNCTION '/SCWM/HU_READ'
EXPORTING
iv_appl = wmegc_huappl_wme " Constant value WME
iv_lgnum = iv_lgnum
iv_huident = lv_huident
IMPORTING
et_huref = lt_huref
EXCEPTIONS
deleted = 1
not_found = 2
error = 3
OTHERS = 4.

IF sy-subrc EQ 0.
* Obtaining the HU reference
LOOP AT lt_huref ASSIGNING FIELD-SYMBOL(<ls_huref>).
EXIT.
ENDLOOP.

IF <ls_huref> IS ASSIGNED.
* read the ref document number and item number from the table /scdl/db_proci_o using the huref docid.
SELECT SINGLE * FROM /scdl/db_proci_o INTO ls_item
WHERE docid = <ls_huref>-docid AND itemcat = 'DLV'.
IF sy-subrc EQ 0 AND ls_item-refitemno_so IS NOT INITIAL AND ls_item-refdocno_so IS NOT INITIAL.
* read follow on document from vbfa.
SELECT SINGLE * FROM vbfa INTO ls_vbfa WHERE vbelv = ls_item-refdocno_so AND posnv = ls_item-refitemno_so AND vbtyp_n = 'J' .
IF ls_vbfa IS NOT INITIAL.
* read vsbed from likp using the follow on document.
SELECT SINGLE * FROM likp INTO ls_likp WHERE vbeln = ls_vbfa-vbeln.
IF ls_likp-vsart IS NOT INITIAL.
lf_vsbed = ls_likp-vsart.
ELSE.
lf_vsbed = ls_likp-vsbed.
ENDIF.
* If vsbed is available fill the search attribute with vsbed.
IF lf_vsbed IS NOT INITIAL.
LOOP AT ct_request ASSIGNING <request>.
LOOP AT <request>-item_attributes ASSIGNING <item_attr>.
IF <item_attr>-fieldname EQ 'PHU_VSBED'.
DELETE TABLE <request>-item_attributes FROM <item_attr>.
ls_attribute-fieldname = 'PHU_VSBED'.
ls_attribute-value = lf_vsbed.
INSERT ls_attribute INTO TABLE <request>-item_attributes .
EXIT .
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

 

After Implementing this Badi, action should be generated .

Conclusion

There may be some additional steps needed depending on the scenario, the above given steps were sufficient to make shipping conditions work.

If there are any Questions or additional information related to this, please comment below.

 

Br,

Ketan
5 Comments
Labels in this area