on 05-23-2007 9:49 PM
Can someone provide me with the proper keys when calling this function module? I'm running in SRM 4.0 in an extended classic scenario, I am specifying the following in the IT_SELECTION table:
H_OBJECT_T = PO Object type (i.e. BUS2201)
H_GUID = PO header GUID
I_OBJECT_T = PO Item object type (i.e. BUS2201001)
I_GUID = PO Item GUID
OBJECT_ID = PO Number
NUMBER_INT = PO Item number
LOGSYS = Our SRM logical system
H_SRC_OBJT = Blank (not sure what this field is for)
H_SRC_GUID = Blank (not sure what this field is for)
When attempting to test the function module, I receive the following messages in the E_MESSAGES table.
A BBP_PD 002 Interface data contains errors
A BBP_PD 082 Object type of the reference document is not allowed
A BBP_PD 091 The number or object type of the ref.document in MM backend is missing
E BBP_PD 040 Create confirmation with regard to only one purchase order
I BBP_CF 050 Confirmation still contains errors; Check the confirmation
I can create a confirmation manually via BBPCF02, so I know the config should be right, any insight would be greatly appreciated.
Best Regards,
Shawn O.
Hi
Please go through te following Sample Code, which will help you out ->
<u><b>Sample Code I</b></u>
PERFORM sc_itm_auto_conf USING ls_import
CHANGING es_export
cs_document.
*&---------------------------------------------------------------------*
*& Form sc_itm_auto_conf
*&---------------------------------------------------------------------*
FORM sc_itm_auto_conf USING is_import TYPE bbps_sc_app_import
CHANGING es_export TYPE bbps_sc_app_export
es_document TYPE bbps_sc_app_document.
DATA: lt_selection LIKE bbps_object_key OCCURS 0 WITH HEADER LINE.
DATA: lt_messages LIKE bbp_pds_messages OCCURS 0 WITH HEADER LINE.
DATA: wa_messages TYPE bbps_sc_app_messages.
CHECK is_import IS NOT INITIAL.
lt_selection-h_guid = is_import-hdr_guid.
lt_selection-i_guid = is_import-itm_guid.
lt_selection-h_object_type = is_import-objtyp.
lt_selection-object_id = is_import-object_id.
lt_selection-number_int = is_import-number_int_cf_inv.
lt_selection-logsys = is_import-logsys_cf_inv.
APPEND lt_selection.
* automatic confirmation from STATUS transaction
CALL FUNCTION 'BBP_CF_AUTOMATIC'
TABLES
it_selection = lt_selection
e_messages = lt_messages.
LOOP AT lt_messages WHERE msgty = c_msgty_a OR
msgty = c_msgty_e.
EXIT.
ENDLOOP.
CLEAR es_export-inf2stat_srch.
IF sy-subrc NE 0.
es_export-inf2stat_srch = gc_sta_auto_follow_on.
ENDIF.
* Send info-popup to screen.
LOOP AT lt_messages WHERE msgty = c_msgty_i.
MESSAGE ID lt_messages-msgid
TYPE lt_messages-msgty
NUMBER lt_messages-msgno
WITH lt_messages-msgv1.
ENDLOOP.
ENDFORM. " sc_itm_auto_conf
//////////////////////////////////////////////////////////////////////////////
<u><b>Sample Code II</b></u>
DATA:
ls_events TYPE bbps_event,
lt_events TYPE bbpt_events,
ls_item_form TYPE bbp_ims_item_iv_ads,
lv_guid TYPE bbp_guid,
lt_messages TYPE bbpt_pds_messages,
ls_messages TYPE bbp_pds_messages,
ls_header_d TYPE bbp_pds_inv_header_d,
lt_item_d TYPE TABLE OF bbp_pds_inv_item_d,
ls_item_d TYPE bbp_pds_inv_item_d,
ls_header_u TYPE bbp_pds_inv_header_u,
lt_item_u TYPE TABLE OF bbp_pds_inv_item_icu,
ls_item_u TYPE bbp_pds_inv_item_icu,
lv_rcode TYPE sysubrc,
lv_item_changed_flag TYPE xfeld,
lt_send_ctr TYPE bbpt_ims_send_ctr,
ls_send_ctr LIKE LINE OF lt_send_ctr.
PERFORM auto_conf_create USING ls_events
ls_item_d
ls_item_form
ls_header_d
is_ext_partner.
*&---------------------------------------------------------------------*
*& Form auto_conf_create
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->IS_EVENTS text
* -->IS_ITEM_D text
* -->IS_ITEM_FORM text
*----------------------------------------------------------------------*
FORM auto_conf_create USING is_events TYPE bbps_event
is_item_d TYPE bbp_pds_inv_item_d
is_item_form TYPE bbp_ims_item_iv_ads
is_header_d TYPE bbp_pds_inv_header_d
is_ext_partner TYPE bbp_pds_partner.
DATA:
lt_selection TYPE bbpt_object_key,
ls_selection TYPE bbps_object_key,
lt_confirm TYPE TABLE OF bbp_cf_item_app,
ls_confirm TYPE bbp_cf_item_app,
ls_user_info TYPE bbps_sel_user_info,
lt_messages TYPE bbpt_pds_messages,
ls_messages TYPE bbp_pds_messages,
lv_guid TYPE bbp_guid,
lv_item_guid TYPE bbp_guid,
ls_po_header TYPE bbp_pds_po_header_d,
lt_po_item TYPE TABLE OF bbp_pds_po_item_d,
ls_po_item TYPE bbp_pds_po_item_d,
lv_bp TYPE bu_partner,
lv_object_id TYPE crmt_object_id_db,
lv_partner_guid TYPE bu_partner_guid,
lt_return TYPE TABLE OF bapiret2.
CALL FUNCTION 'BBP_IMS_GET_CONTACT_FROM_EVENT'
EXPORTING
is_exception = is_events
IMPORTING
ev_bp = lv_bp.
IF lv_bp CN '0 '.
* Partner available - read data
CALL FUNCTION 'BUPA_NUMBERS_GET'
EXPORTING
iv_partner = lv_bp
IMPORTING
ev_partner_guid = lv_partner_guid
TABLES
et_return = lt_return.
IF NOT lt_return[] IS INITIAL.
PERFORM msg_add USING 'E' is_events '028' space.
IF 1 = 2. MESSAGE e028. ENDIF.
RAISE error.
ENDIF.
CALL FUNCTION 'BP_CENTRALPERSON_GET'
EXPORTING
iv_bu_partner_guid = lv_partner_guid
IMPORTING
ev_username = ls_user_info-user_name
EXCEPTIONS
no_central_person = 1
no_business_partner = 2
no_id = 3
OTHERS = 4.
IF sy-subrc <> 0 OR ls_user_info-user_name IS INITIAL.
PERFORM msg_add USING 'E' is_events '028' space.
IF 1 = 2. MESSAGE e028. ENDIF.
RAISE error.
ENDIF.
ELSE.
* Partner is not available - mail was sent to E-Mail address
ENDIF.
ls_user_info-user_type = c_user_type_profi.
CLEAR ls_selection.
CLEAR ls_confirm.
* fill PO data to create the confirmation automatically
IF is_item_d-be_refobj_type EQ c_b_po.
ls_selection-h_object_type = c_b_po.
ls_selection-i_object_type = c_b_po_item.
ls_selection-object_id = is_item_d-be_refobj.
ls_selection-number_int = is_item_d-be_refobj_item.
ls_selection-logsys = is_header_d-be_log_system.
APPEND ls_selection TO lt_selection.
ls_confirm-be_refobj_type = c_b_po_item.
ls_confirm-be_refobj = is_item_d-be_refobj.
ls_confirm-be_refobj_item = is_item_d-be_refobj_item.
ELSEIF is_item_d-be_refobj_type EQ c_po.
IF is_item_d-src_object_type EQ c_po_item AND
NOT is_item_d-src_guid IS INITIAL.
lv_item_guid = is_item_d-src_guid.
CALL FUNCTION 'BBP_PD_ALL_GET_HDR_FROM_ITM'
EXPORTING
iv_itm_guid = lv_item_guid
iv_itm_obj_type = c_po_item
IMPORTING
ev_hdr_guid = lv_guid.
ls_selection-h_object_type = c_po.
ls_selection-i_object_type = c_po_item.
ls_selection-h_guid = lv_guid.
ls_selection-i_guid = lv_item_guid.
APPEND ls_selection TO lt_selection.
ls_confirm-guid = lv_item_guid.
ELSEIF NOT is_item_d-be_refobj IS INITIAL AND
NOT is_item_d-be_refobj_item IS INITIAL.
MOVE is_item_d-be_refobj TO lv_object_id.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = lv_object_id
IMPORTING
e_header = ls_po_header
TABLES
e_item = lt_po_item
e_messages = lt_messages.
LOOP AT lt_messages INTO ls_messages WHERE msgty EQ 'A' OR
msgty EQ 'E'.
CALL FUNCTION 'BBP_IMS_LOG_FILL'
EXPORTING
iv_log_event = 'MESSAGE'
is_exception = is_events
is_msg = ls_messages.
ENDLOOP.
IF sy-subrc EQ 0.
RAISE error.
ENDIF.
READ TABLE lt_po_item INTO ls_po_item
WITH KEY number_int = is_item_d-be_refobj_item.
IF sy-subrc NE 0.
PERFORM msg_add USING 'E' is_events '043' space.
IF 1 = 2. MESSAGE e043. ENDIF.
RAISE error.
ENDIF.
ls_selection-h_object_type = c_po.
ls_selection-i_object_type = c_po_item.
ls_selection-h_guid = ls_po_header-guid.
ls_selection-i_guid = ls_po_item-guid.
APPEND ls_selection TO lt_selection.
ls_confirm-guid = ls_po_item-guid.
ENDIF.
ELSE.
* no PO
PERFORM msg_add USING 'E' is_events '043' space.
IF 1 = 2. MESSAGE e043. ENDIF.
RAISE error.
ENDIF.
IF NOT lt_selection[] IS INITIAL.
* READ TABLE it_item_form INTO ls_item_form
* WITH KEY guid = ls_events-object_node_key.
IF is_item_form-quantity > 0.
* quantity changed in the form
ls_confirm-quantity = is_item_form-quantity.
ls_confirm-unit = is_item_form-unit.
APPEND ls_confirm TO lt_confirm.
ENDIF.
CALL FUNCTION 'BBP_CF_AUTOMATIC'
EXPORTING
is_user_info = ls_user_info
is_ext_partner = is_ext_partner
TABLES
it_selection = lt_selection
it_confirm = lt_confirm
e_messages = lt_messages
EXCEPTIONS
doc_lock = 1
other_error = 2
OTHERS = 3.
IF sy-subrc EQ 1.
PERFORM msg_add USING 'E' is_events '026' space.
IF 1 = 2. MESSAGE e026. ENDIF.
RAISE document_locked.
ELSE.
LOOP AT lt_messages INTO ls_messages WHERE msgty EQ 'A' OR
msgty EQ 'E'.
CALL FUNCTION 'BBP_IMS_LOG_FILL'
EXPORTING
iv_log_event = 'MESSAGE'
is_exception = is_events
is_msg = ls_messages.
ENDLOOP.
IF sy-subrc = 0.
RAISE error.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " auto_conf_create
*&---------------------------------------------------------------------*
*& Form missing_gr_exception_process
*&---------------------------------------------------------------------*
FORM missing_gr_exception_process
USING is_header_form TYPE bbp_ims_hdr_iv_ads_basic
is_header_prop TYPE bbp_ims_hdr_iv_ads_prop
it_events TYPE bbpt_events
it_item_form TYPE bbpt_ims_item_iv1_ads
is_feedback TYPE bbp_ims_iv_ads_feedback
is_excp_property TYPE bbps_ims_prop
is_ext_partner TYPE bbp_pds_partner.
DATA:
ls_events TYPE bbps_event,
lt_events TYPE bbpt_events,
ls_item_form TYPE bbp_ims_item_iv_ads,
lv_guid TYPE bbp_guid,
lt_messages TYPE bbpt_pds_messages,
ls_messages TYPE bbp_pds_messages,
ls_header_d TYPE bbp_pds_inv_header_d,
lt_item_d TYPE TABLE OF bbp_pds_inv_item_d,
ls_item_d TYPE bbp_pds_inv_item_d,
ls_header_u TYPE bbp_pds_inv_header_u,
lt_item_u TYPE TABLE OF bbp_pds_inv_item_icu,
ls_item_u TYPE bbp_pds_inv_item_icu,
lv_rcode TYPE sysubrc,
lv_item_changed_flag TYPE xfeld,
lt_send_ctr TYPE bbpt_ims_send_ctr,
ls_send_ctr LIKE LINE OF lt_send_ctr.
CONSTANTS:
lc_answer_yes TYPE char1 VALUE 'Y',
lc_answer_no TYPE char1 VALUE 'N'.
lt_events[] = it_events[].
READ TABLE lt_events INTO ls_events INDEX 1.
CALL FUNCTION 'BBP_PD_INV_GETDETAIL'
EXPORTING
i_guid = ls_events-object_key
IMPORTING
e_header = ls_header_d
TABLES
e_item = lt_item_d.
IF ls_events-event_status_app EQ gc_excp_blocked_int.
* internal processor
IF is_feedback-ims_status EQ lc_answer_yes.
* 'Yes' -> create confirmation or wait
IF is_excp_property-gr_create = 'A'.
* "automatically": create confirmation
READ TABLE lt_item_d INTO ls_item_d
WITH KEY guid = ls_events-object_node_key.
IF sy-subrc EQ 0.
READ TABLE it_item_form INTO ls_item_form
WITH KEY guid = ls_events-object_node_key.
PERFORM auto_conf_create USING ls_events
ls_item_d
ls_item_form
ls_header_d
is_ext_partner.
ENDIF.
ELSE.
* "yes": set status "waiting"
ls_events-event_status_app = gc_excp_waiting.
MODIFY lt_events FROM ls_events INDEX 1.
CALL FUNCTION 'BBP_IMS_EXCP_UPDATE'
EXPORTING
it_events = lt_events.
ENDIF.
ELSEIF is_feedback-ims_status EQ lc_answer_no.
* "no": read customizing
IF is_excp_property-forwarding EQ 'M' OR
is_excp_property-forwarding IS INITIAL.
* set status "new"
ls_events-event_status_app = gc_excp_new.
MODIFY lt_events FROM ls_events INDEX 1.
CALL FUNCTION 'BBP_IMS_EXCP_UPDATE'
EXPORTING
it_events = lt_events.
ELSEIF is_excp_property-forwarding EQ 'A'.
* forward to vendor
CALL FUNCTION 'BBP_IMS_EXCP_SEND'
EXPORTING
is_exception = ls_events
iv_recip_role = gc_contact_vendor
iv_autom_sending = gc_yes.
ENDIF.
ENDIF.
ELSEIF ls_events-event_status_app EQ gc_excp_blocked_ext.
* processed by vendor
IF is_feedback-ims_status EQ lc_answer_yes.
* Set exception status to Waiting
ls_events-event_status_app = gc_excp_waiting.
MODIFY lt_events FROM ls_events INDEX 1.
CALL FUNCTION 'BBP_IMS_EXCP_UPDATE'
EXPORTING
it_events = lt_events.
ELSEIF is_feedback-ims_status EQ lc_answer_no.
ls_events-event_status_app = gc_excp_dispute.
MODIFY lt_events FROM ls_events INDEX 1.
CALL FUNCTION 'BBP_IMS_EXCP_UPDATE'
EXPORTING
it_events = lt_events.
* Update delivery date if necessary
READ TABLE it_item_form INTO ls_item_form
WITH KEY guid = ls_events-object_node_key.
IF sy-subrc = 0.
CALL FUNCTION 'BBP_IMS_SEND_CTR_GETLIST'
EXPORTING
iv_inv_itm_guid = ls_events-object_node_key
IMPORTING
et_send_ctr = lt_send_ctr.
READ TABLE lt_send_ctr INTO ls_send_ctr INDEX 1.
IF sy-subrc = 0.
ls_send_ctr-deliv_date_new = ls_item_form-deliv_date.
MODIFY lt_send_ctr FROM ls_send_ctr INDEX 1.
ELSE.
ls_send_ctr-deliv_date_new = ls_item_form-deliv_date.
ls_send_ctr-inv_itm_guid = ls_events-object_node_key.
ls_send_ctr-inv_hdr_guid = ls_events-object_key.
APPEND ls_send_ctr TO lt_send_ctr.
ENDIF.
CALL FUNCTION 'BBP_IMS_SEND_CTR_UPDATE'
EXPORTING
it_update_send_ctr = lt_send_ctr.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " missing_gr_exception_process
//////////////////////////////////////////////////////////////////////////////
Hope this will help.
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
<u>See the code carefully. We are using a perform to pass all the required data...</u>
<b>E.g., is_import is using the following fields -></b>
lt_selection-h_guid = is_import-hdr_guid. " Header GUID
lt_selection-i_guid = is_import-itm_guid. " Item GUID
lt_selection-h_object_type = is_import-objtyp. " Object Type (BUS2201)
lt_selection-object_id = is_import-object_id. " Object No (PO#)
lt_selection-number_int = is_import-number_int_cf_inv. " Internal Number
lt_selection-logsys = is_import-logsys_cf_inv. " Logical System
APPEND lt_selection.
Hope this will help.
Regards
- Atul
Thank you for the clarification Atul. I'm now successfully running the code but I am still receiving the same error messages that I received when I tried to do a single test with the BBP_CF_AUTOMATIC function module. The error messages are as follows:
A BBP_PD 002 Interface data contains errors
A BBP_PD 082 Object type of the reference document is not allowed
A BBP_PD 091 The number or object type of the ref.document in MM backend is missing
E BBP_PD 040 Create confirmation with regard to only one purchase order
I BBP_CF 050 Confirmation still contains errors; Check the confirmation
Any ideas on where to look? Am I missing something on the backend (R/3)? I can sucessfully execute BBPCF02 or BBPCF03 and get a confirmation created, so I am at a loss as to why I can't get this function module to work.
Best regards,
Shawn O.
I finally got this to work. If you are running extended classic scenario you must specify the following fields as input to the function module.
H_GUID = The SRM Purchase Orders Header GUID
I_GUID = The SRM Purchase Orders Item GUID
I_OBJECT_TYPE = The R/3 business object for purchase orders (i.e. BUS2012)
OBJECT_ID = The R/3 purchase order number
NUMBER_INTERNAL = Item number of R/3 purchase order
LOGSYS = Backend R/3 logical system.
Regards,
Shawn O.
Hi Shawn!
In my opinion it seems to be
H_SRC_OBJT = Object type of source (BUS2121)
H_SRC_GUID = GUID of the Shopping cart source of the purchase order.
I hope this helps you.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
<b>Don't pass any values for all optional parameters in this case.</b>
That is, incase it helps - try this ->
I_OBJECT_T = space
I_GUID = space
OBJECT_ID = PO Number
NUMBER_INT = space
LOGSYS = Our SRM logical system
After passing data in the function module, save it in the SE37 - Test Data Directory and then try debugging to get more insights of this issue.
Please paste your code, if possible, in the next reply.
Do let me know.
Regards
- Atul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.