To link existing QPPD objects to ECC documents, the APPBUS can be used. The QPPD currently supports links to the following ECC documents:
AFKO: PP - Order header
EKKO: ME - Purchasing document
EKPO: ME - Items for the purchasing document
LIPS: SD - Deliveries for the order
MARA: MM - Materials
MARC: MM - Plant dependent settings for the material
MKAL: MM - Production versions for the material
VBAK: SD - Order header
VBAP: SD - Order item
VBEP: SD - schedule lines for the item
TRY. "Get instance DATA(lo_appbus) = /sct/qp_cl_appbus=>get_instance( ). "Create structure with DOCKEY and DOCTYPE DATA(ls_ecc_doc_afko) = lo_appbus->get_ecc_doc_for_afko( iv_aufnr = '1234' ). DATA(ls_ecc_doc_ekko) = lo_appbus->get_ecc_doc_for_ekko( iv_ebeln = '1234' ). DATA(ls_ecc_doc_ekpo) = lo_appbus->get_ecc_doc_for_ekpo( iv_ebeln = '1234' iv_ebelp = '0001' ). DATA(ls_ecc_doc_lips) = lo_appbus->get_ecc_doc_for_lips( iv_vbeln = '1234' iv_posnr = '0001' ). DATA(ls_ecc_doc_mara) = lo_appbus->get_ecc_doc_for_mara( iv_matnr = '1234' ). DATA(ls_ecc_doc_marc) = lo_appbus->get_ecc_doc_for_marc( iv_matnr = '1234' iv_werks = '1000' ). DATA(ls_ecc_doc_mkal) = lo_appbus->get_ecc_doc_for_mkal( iv_matnr = '1234' iv_werks = '1000' iv_verid = '0001' ). DATA(ls_ecc_doc_vbak) = lo_appbus->get_ecc_doc_for_vbak( iv_vbeln = '1234' ). DATA(ls_ecc_doc_vbap) = lo_appbus->get_ecc_doc_for_vbap( iv_vbeln = '1234' iv_posnr = '0001' ). DATA(ls_ecc_doc_vbep) = lo_appbus->get_ecc_doc_for_vbep( iv_vbeln = '1234' iv_posnr = '0001' iv_etenr = '0001' ). "Link object with ECC document CALL METHOD lo_appbus->link EXPORTING iv_dockey = ls_ecc_doc_mara-dockey "Oder andere DOCTYPEs iv_doctype = ls_ecc_doc_mara-doctype "Oder andere DOCTYPEs iv_link_guid = '05012345678901234567890123456789' IMPORTING es_node_doc = DATA(ls_node_doc) es_node_link = DATA(ls_node_link). CATCH /sct/qp_cx_error INTO DATA(lo_error). "Do somethingENDTRY.