Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BBP_PROCDOC_UPDATE do not Update Position

Hi Experts,

with this function module, only the distribution data from the head of a Contract where updated.

How can we achieve this, the position data will be considered.

data: li_header type BBP_PDS_HEADER,
ls_header
type BBP_PDS_HEADER,
lt_upd_dis
type TABLE OF BBP_PDS_DIS,
wa_dis
like line of lt_upd_dis,
lti_dep_attr
TYPE TABLE OF BBP_PDS_DEP,
wa_dep
like line of lti_dep_attr,
e_messages
type TABLE OF BBP_PDS_MESSAGES,
r_guid
TYPE sysuuid_c32,
head
type BBP_PDS_HEADER,
items
type BBPT_PD_ITEM,
waitem
like line of items.

*****************BBP_PDS_HEADER
*
CALL FUNCTION 'BBP_PROCDOC_GETDETAIL'
EXPORTING
I_OBJECT_ID                  
= '5600003612'
I_OBJECT_TYPE                
= 'BUS2000113'
IMPORTING
E_HEADER                     
= head
TABLES
E_ITEM                       
= items
.
*
*
***************


CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c32
RECEIVING
uuid
= r_guid.

li_header
-guid = head-guid.
li_header
-currency = 'EUR'.
li_header
-object_type = 'BUS2000113'.
*
wa_dis
-guid = r_guid.
wa_dis
-purchase_org = '504880BA5A7D099CE100000002886807'.
wa_Dis
-location = '4755935973E05287E100000020800163'.
wa_dis
-currency = 'EUR'.
wa_dis
-p_guid = head-guid.
wa_dis
-target_object = 'C'.
wa_dis
-value = '5'.
wa_dis
-quantity = '0'.
"wa_dis-distr_ind = 'X'.
"wa_dis-target_object_id = '5600003587'.
wa_dis
-pmnttrms = head-pmnttrms.

Append wa_dis to lt_upd_dis.


clear r_guid.
clear wa_dis.

Sort items DESCENDING by value.
loop at items into waitem.
CALL METHOD cl_system_uuid=>if_system_uuid_static~create_uuid_c32
RECEIVING
uuid
= r_guid.

"wa_dis-p_guid = head-guid.
wa_dis
-guid = r_guid.
"wa_dis-p_guid = r_guid.
wa_dis
-purchase_org = '504880BA5A7D099CE100000002886807'.
wa_dis
-location = '4755935973E05287E100000020800163'.
wa_dis
-target_object = 'C'.
wa_dis
-value = waitem-value.
wa_dis
-currency = 'EUR'.
""wa_dis-distr_ind = 'X'.
wa_dis
-pmnttrms = head-pmnttrms.
"wa_dis-quantity = waitem-quantity.

CLEAR r_guid.
append wa_dis to lt_upd_dis.


ENDLOOP.


CALL FUNCTION 'BBP_PDDEP_MAP_DIS_TO_DEP'
TABLES
it_dis     
= lt_upd_dis
et_dep_attr
= lti_dep_attr.

* Update document in the buffer layer
CALL FUNCTION 'BBP_PROCDOC_UPDATE'
EXPORTING
"i_park                  = lv_park
i_save                 
= 'X'
"iv_reject               = iv_reject
i_header               
= li_header
" IV_UPDATE_FROM_CHANGE_VERSION = 'X'
" IV_WITH_CHANGE_APPROVAL = 'X'
"it_attach               = lt_upd_attach
"it_conditions           = lit_pd_conditions
"iv_with_change_approval = iv_with_change_approval
IMPORTING
es_header              
= ls_header
TABLES
*      i_item                  = li_item
*      i_account               = lt_acc
*      i_partner               = lt_upd_partner
*      i_longtext              = lt_upd_longtext
*      i_orgdata               = lt_upd_orgdata
*      i_hcf                   = li_hcf
*      i_icf                   = li_icf
*      i_tol                   = lt_upd_tol
i_dep                  
= lti_dep_attr
"    it_exchrate             = i_exchrate
e_messages             
= e_messages.



CALL FUNCTION 'BBP_PROCDOC_SAVE'
EXPORTING
iv_workitem_id
= '000000000000'
iv_header_guid
= ls_header-guid
iv_object_type
= ls_header-object_type.


COMMIT WORK AND WAIT.

THX

Former Member
Not what you were looking for? View more on this topic or Ask a question