on 04-09-2014 7:55 AM
Hi ,
We have a requirement in SRM for PO item to set the flag indicators for GR/IR/GRIV depending on the PO type.
For example if po type is ZA then we need to set GR, if PO type is ZB we need to set GR and IR etc...
Please share ideas if any.
Attaching screen shot for PO Item where flag indicators are displayed.
By,
Kalpana
Hi,
There is an include with name SAPLBBP_PDIGP.
In this find for the implicit enhancement and implement the code as given below.
You can refer to the below code for your reference.
ENHANCEMENT 1 ZPO_GRIRFLAG. "active version
DATA: lt_doc TYPE TABLE OF zts_related_docs.
DATA: ls_doc TYPE zts_related_docs.
DATA: ls_order TYPE crmd_orderadm_h.
DATA: ls_po_header TYPE bbp_pds_po_header_d.
DATA: lt_item TYPE BBPT_PO_ITEM_BADI.
DATA: ls_item TYPE BBP_PO_ITEM_BADI.
CLEAR: ls_order.
REFRESH: lt_item.
DATA: lv_x(1) TYPE c.
DATA: lv_ind(1) TYPE c.
DATA: lt_crmdh TYPE TABLE OF crmd_orderadm_h.
DATA: ls_crmdh TYPE crmd_orderadm_h.
DATA: lt_crmdi TYPE TABLE OF crmd_orderadm_i.
DATA: ls_crmdi TYPE crmd_orderadm_i.
IF IV_OBJECT_TYPE = 'BUS2201'.
IF IS_IGP_ICOM-HEADER IS NOT INITIAL AND IS_IGP_ICOM-number_int IS NOT INITIAL.
CLEAR: lv_ind, ls_crmdi, ls_crmdh.
REFRESH: lt_crmdh, lt_crmdi.
SELECT * FROM crmd_orderadm_h INTO TABLE lt_crmdh WHERE object_id = IS_IGP_ICOM-BE_OBJECT_ID.
IF lt_crmdh IS NOT INITIAL.
SELECT * FROM crmd_orderadm_i INTO TABLE lt_crmdi FOR ALL ENTRIES IN lt_crmdh
WHERE header = lt_crmdh-guid AND NUMBER_INT = IS_IGP_ICOM-number_int.
ENDIF.
IF lt_crmdi IS INITIAL.
SELECT SINGLE * FROM zts_related_docs INTO ls_doc WHERE zzdoc_type = IS_IGP_ICOM-ITEM_PROCESS_TYP.
IF sy-subrc EQ 0.
CALL METHOD zcl_po_partner=>po_item_out
IMPORTING
item_out = lt_item .
CLEAR: ls_item.
READ TABLE lt_item INTO ls_item WITH KEY number_int = IS_IGP_ICOM-number_int del_ind = ' '.
IF sy-subrc EQ 0 AND IS_IGP_ICOM-ITEM_PROCESS_TYP EQ 'ZC' AND ls_item-ordered_prod IS NOT INITIAL AND ls_item-subtype EQ 'DP'.
lv_ind = 'X'.
ENDIF.
IF lv_ind EQ ' '.
cs_new_itmpset-gr_ind = ls_doc-zzgr_ind.
cs_new_itmpset-gr_basediv = ls_doc-zzir_ind.
cs_new_itmpset-ir_ind = ls_doc-zzgr_basediv.
ENDIF.
ELSEIF is_igp_icom-header IS NOT INITIAL.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_guid = is_igp_icom-header
IMPORTING
e_header = ls_po_header.
CALL METHOD zcl_po_partner=>po_item_out
IMPORTING
item_out = lt_item .
IF lt_item IS INITIAL.
lv_ind = 'X'.
ELSE.
CLEAR: ls_item.
IF ls_po_header-process_type EQ 'ZC'.
LOOP AT lt_item INTO ls_item WHERE del_ind = ' ' AND ordered_prod IS NOT INITIAL
AND subtype EQ 'DP' AND number_int = IS_IGP_ICOM-number_int.
lv_ind = 'X'.
ENDLOOP.
ENDIF.
* REFRESH: lt_item.
* CALL METHOD zcl_po_partner=>po_item_in
* EXPORTING
* item_in = lt_item.
* READ TABLE lt_item INTO ls_item WITH KEY number_int = IS_IGP_ICOM-number_int del_ind = ' '.
* IF sy-subrc EQ 0 AND ls_po_header-process_type EQ 'ZC' AND ls_item-ordered_prod IS NOT INITIAL AND ls_item-subtype EQ 'DP'.
* lv_ind = 'X'.
* ENDIF.
******* End of Correction
ENDIF.
IF ls_po_header-process_type IS NOT INITIAL AND lv_ind EQ ' '.
SELECT SINGLE * FROM zts_related_docs
INTO ls_doc
WHERE zzdoc_type = ls_po_header-process_type.
IF sy-subrc EQ 0.
cs_new_itmpset-gr_ind = ls_doc-zzgr_ind.
cs_new_itmpset-ir_ind = ls_doc-zzir_ind.
cs_new_itmpset-gr_basediv = ls_doc-zzgr_basediv.
* READ TABLE lt_item INTO ls_item WITH KEY number_int = IS_IGP_ICOM-number_int del_ind = ' '.
* IF sy-subrc EQ 0 AND ls_po_header-process_type EQ 'ZC' AND ls_item-ordered_prod IS NOT INITIAL.
* cs_new_itmpset-gr_ind = 'X'.
* cs_new_itmpset-gr_basediv = 'X'.
* ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDENHANCEMENT
Regards,
Rafi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am able to achieve the functionality upto 90%.
But some times while testing for few scenarios the flag indicators are set and for few flag indicators or unset.
IF x_po_header-process_type IS NOT INITIAL AND l_ind EQ ' '.
SELECT SINGLE * FROM ztb_documents
INTO x_doc
WHERE zdo_typ = x_po_header-process_type.
IF sy-subrc EQ 0.
cs_new_itmpset-gr_ind = x_doc-zgr_ind.
cs_new_itmpset-ir_ind = x_doc-zir_ind.
cs_new_itmpset-gr_basediv = x_doc-zgr_basediv.
ENDIF.
ENDIF.
In this code I am getting all the documents type in ZTB_DOCUMENTS Internal Table for the respective Header Process Type.
I am not sure where I am going wrong. Please share your ideas.
BR,
Kalpana
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.