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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |