Dear Community friends ,
I am working on a requirement where I want to enable saving of custom fields from the Inbound Idoc in to the database tables for vendor (LFA1 / LFB1).
Is it possible to process custom fields from inbound IDOC in such way without making any enhancements to BP transaction in S41909. If not can someone please share some useful document for such requirement ?
I am trying to achieve this by implementing the BAdi VENDOR_ADD_DATA_BI
1.I have enhanced the structures BLFA1 and BLFB1 with custom fields
2.I have used method IF_EX_VENDOR_ADD_DATA_BI~PASS_NON_STANDARD_SEGMENT to fetch the custom fields coming from Inbound IDOC in to class attributes.
3.I have used IF_EX_VENDOR_ADD_DATA_BI~FILL_BI_TABLE_WITH_OWN_SEGMENT to fetch the data from class attributes in to the T_BI_DATA (Batch Input Transfer Table (Structured from Segment Data)).
After following these steps my expectation is that data will be populated in to the custom fields which does not happen.
I have already gone through SAP Note 580266 - Enhancements without modification in vendor master Since we have MDG we don't need any Enhancement to BP transaction. We have made necessary adjustments on MDG side to save the fields from MDG UI to Database and fill the outbound IDOCs Code for reference
Code for reference
METHOD if_ex_vendor_add_data_bi~pass_non_standard_segment. FIELD-SYMBOLS : <fs_ymd00_e1lfb1m> TYPE ty_ymd00_e1lfb1m. IF i_segment_name EQ 'YMD00_E1LFA1M'. gs_ymd00_e1lfa1m = i_segment_data. ELSEIF i_segment_name EQ 'YMD00_E1LFB1M'. ASSIGN i_segment_data TO <fs_ymd00_e1lfb1m> CASTING. IF <fs_ymd00_e1lfb1m> IS ASSIGNED. gs_ymd00_e1lfb1m-bukrs = <fs_ymd00_e1lfb1m>-bukrs. gs_ymd00_e1lfb1m-brsch = <fs_ymd00_e1lfb1m>-brsch. gs_ymd00_e1lfb1m-wbrsl = <fs_ymd00_e1lfb1m>-wbrsl. ENDIF. INSERT gs_ymd00_e1lfb1m INTO TABLE gt_ymd00_e1lfb1m. ENDIF. ENDMETHOD
METHOD if_ex_vendor_add_data_bi~fill_bi_table_with_own_segment. FIELD-SYMBOLS : <fs_lfa1> TYPE blfa1. FIELD-SYMBOLS : <fs_lfb1> TYPE blfb1. IF gs_ymd00_e1lfa1m IS NOT INITIAL. LOOP AT t_bi_data ASSIGNING <fs_lfa1> CASTING. IF <fs_lfa1> IS ASSIGNED and <fs_lfa1>-stype = 2 AND <fs_lfa1>-tbnam = 'BLFA1'. <fs_lfa1>-yymulti = gs_ymd00_e1lfa1m. ENDIF. ENDLOOP. ELSEIF gt_ymd00_e1lfb1m IS NOT INITIAL. LOOP AT t_bi_data ASSIGNING <fs_lfb1> CASTING. IF <fs_lfb1> is ASSIGNED and <fs_lfb1>-stype = 2 AND <fs_lfb1>-tbnam = 'BLFB1'. READ TABLE gt_ymd00_e1lfb1m INTO gs_ymd00_e1lfb1m with key bukrs = i_trans_data-bukrs. <fs_lfb1>-brsch = gs_ymd00_e1lfb1m-brsch. <fs_lfb1>-wbrsl = gs_ymd00_e1lfb1m-wbrsl. ENDIF. ENDLOOP. ENDIF. CLEAR: gs_ymd00_e1lfa1m,gs_ymd00_e1lfb1m. ENDMETHOD.