Step by step guide to enhance/update Vendor Master and generate idocs – Part3
- Activate change pointers globally – transaction BD61
- Activate change pointers for message type – transaction BD50
- Assign table fields which are relevant for change pointer creation for message type. – transaction BD52
CONSTANTS: c_newseg_name TYPE edilsegtyp VALUE ‘ZE1LFA1A’.
DATA: idoc_data TYPE LINE OF edidd_tt,
wa_e1lfa1m TYPE e1lfa1m,
wa_ze1lfa1a TYPE ze1lfa1a.
DATA: wa_lfa1 TYPE lfa1.
DATA: lr_vendor TYPE REF TO zcl_vendor_base.
FIELD-SYMBOLS: <fs_idoc_data> TYPE LINE OF edidd_tt.
“Only for message type ZESCREMAS and segment name = E1LFA1M
IF i_message_type = ‘ZESCREMAS’ AND i_segment_name = ‘E1LFA1M’.
LOOP AT t_idoc_data ASSIGNING <fs_idoc_data> WHERE segnam = ‘E1LFA1M’.
MOVE <fs_idoc_data>–sdata TO wa_e1lfa1m.
EXIT.
ENDLOOP.
*** get Vendor compliance safe score information for this vendor.
*** assign value to idoc_data-SDATA and append to changing T_IDOC_DATA
CREATE OBJECT lr_vendor
EXPORTING
iv_vendor = wa_e1lfa1m–lifnr.
wa_lfa1 = lr_vendor->get_vendor_master( ).
*** ASSIGN the values from LFA1 (wa_lfa1) to structure of segment ZE1LFA1A ( wa_lfa1fa1a ) ****
wa_ze1lfa1a–CUSTOM_FIELDS = wa_lfa1–zzvscs_CUSTOM_FIELDS.
*** set the idoc extention name in control record.
e_cimtype = ‘ZCREMAS04’.
*** populate segment name in the data record, copy data contents into
*** it, and append the data record to existing data records
idoc_data–mandt = sy–mandt.
idoc_data–hlevel = ’01’.
MOVE c_newseg_name TO idoc_data–segnam.
MOVE wa_ze1lfa1a TO idoc_data–sdata.
APPEND idoc_data TO t_idoc_data.
ENDIF.
ENDMETHOD.
IDOC generation can be tested by one of the methods noted below
- Using transaction BD14. – Provide vendor number and IDOC message type
- Using transaction BD21 – Provide the message type for IDOC generation.
Status of generated IDOC can be checked using transaction WE02 – provide the basic type CREMAS04/05.
Troubleshooting
Below are some pointers to try if IDOCS are not generated/generated without custom segment during testing.
- Ensure change pointers are being generated. this can be verified by checking entries of table BDCP2. following tips could help if change pointer generation is the problem
- Ensure the fields for which change pointers need to be generated have data elements with “change document” field selected ( as noted in part 1).
- Ensure fields for which change pointers are needed are specified in transaction BD52.
- In case BADI- BDCP_BEFORE_WRITE is implemented, ensure logic is not preventing change pointer creation.
- IDOC is generated but no custom segment. Following tips might come in handy.
- Ensure IDOC reduction is not active ( most unlikely, since this is a new segment ) using transaction SALE.
- Check if some sort of segment filter is active ,using transaction SALE.
- Check transaction BD64 to validate if any filters are setup for your segment.
Data: lr_vendor type ref to zcl_vendor_base.
what is the class, could you give the zcl_vendor_base in the blog.thank you.
Hi Jixin,
ZCL_VENODR_BASE is a model custom class. You could use function module
'WY_LFA1_SINGLE_READ' to read LFA1 for the above piece of code.
Regards,
Vivek