SAP MDG · UTILITIES
How do I read vendor master data with VMD_EI_API_EXTRACT=>GET_DATA in SAP MDG or ABAP?
Build a `vmds_ei_main` request, fill `ls_request-vendors` with `vmds_ei_extern` entries, and call `vmd_ei_api_extract=>get_data` to read vendor master data. Check `es_error` first, then read the returned vendor list from `ls_result-vendors`.
Build a `vmds_ei_main` request, fill `ls_request-vendors` with `vmds_ei_extern` entries, and call `vmd_ei_api_extract=>get_data` to read vendor master data. Check `es_error` first, then read the returned vendor list from `ls_result-vendors`.
To read vendor master data, prepare `ls_request` of type `vmds_ei_main`, append one or more `vmds_ei_extern` records to `ls_request-vendors`, and call `vmd_ei_api_extract=>get_data`. The example below shows how to request vendor `0000001234`, handle the extractor response, and read the first returned vendor record.
Process flow
- Declare `ls_request`, `ls_result`, `ls_error`, `lt_vendors`, and `ls_vendor` with the source-supported types.
- Fill `ls_vendor-header-object_instance-lifnr` with the vendor number you want to read.
- Set `ls_vendor-header-object_task` and append the line to `lt_vendors`.
- Assign `lt_vendors` to `ls_request-vendors`.
- Call `vmd_ei_api_extract=>get_data` with `is_master_data = ls_request`.
- Check `ls_error` for extractor messages or errors.
- Read `ls_result-vendors` to access the returned vendor master data.
Referenced tables
| Object | Purpose |
|---|---|
LFA1 | Vendor general data in the BP/CVI knowledge base context. |
CVI_VEND_LINK | Vendor-to-BP link table in the BP/CVI knowledge base context. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1REPORT zvendor_data_extraction_with_vmd_ei.
2
3" ----------------------------------------------------------------------
4" Purpose:
5" Generic example showing how to fetch vendor data with
6" vmd_ei_api_extract=>get_data.
7" ----------------------------------------------------------------------
8
9DATA ls_request TYPE vmds_ei_main.
10DATA ls_result TYPE vmds_ei_main.
11DATA ls_error TYPE mds_ctrls_error_objects.
12DATA lt_vendors TYPE vmds_ei_extern_t.
13DATA ls_vendor TYPE vmds_ei_extern.
14
15" Prepare the vendor request.
16ls_vendor-header-object_instance-lifnr = '0000001234'.
17ls_vendor-header-object_task = 'M'.
18APPEND ls_vendor TO lt_vendors.
19ls_request-vendors = lt_vendors.
20
21" Read the vendor master data from the extractor.
22CALL METHOD vmd_ei_api_extract=>get_data
23 EXPORTING
24 is_master_data = ls_request
25 IMPORTING
26 es_master_data = ls_result
27 es_error = ls_error.
28
29" Basic response handling.
30IF ls_error IS NOT INITIAL.
31 WRITE: / 'Extractor returned messages or errors.'.
32ELSE.
33 WRITE: / 'Vendor data fetched successfully.'.
34ENDIF.
35
36" Example: inspect the first vendor record.
37READ TABLE ls_result-vendors INTO DATA(ls_first_vendor) INDEX 1.
38IF sy-subrc = 0.
39 WRITE: / 'Vendor:', ls_first_vendor-header-object_instance-lifnr.
40ENDIF.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How can I fetch vendor master data using the vendor extractor?
- What is the ABAP example for VMD_EI_API_EXTRACT=>GET_DATA?
- How do I prepare a vendor request and read the extractor response?
Possible questions
- How do I read vendor master data with VMD_EI_API_EXTRACT=>GET_DATA in SAP MDG or ABAP?
- How can I fetch vendor master data using the vendor extractor?
- What is the ABAP example for VMD_EI_API_EXTRACT=>GET_DATA?
- How do I prepare a vendor request and read the extractor response?
- Which structure do I pass to VMD_EI_API_EXTRACT=>GET_DATA?