cancel
Showing results for 
Search instead for 
Did you mean: 

How Fill Batch Input Table from Own Segment (ALE Inbound Proc.) ?

amit_upadhye2
Participant

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

IF_EX_VENDOR_ADD_DATA_BI~PASS_NON_STANDARD_SEGMENT

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

IF_EX_VENDOR_ADD_DATA_BI~FILL_BI_TABLE_WITH_OWN_SEGMENT

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.

Accepted Solutions (1)

Accepted Solutions (1)

anirban_pwc
Participant
0 Kudos

I resolved it using BAdI "VENDOR_ADD_DATA_BI". Method PASS_NON_STANDARD_SEGMENT was used to set a parameter with custom segment value, then used FILL_FT_TABLE_USING_DATA_ROWS to update the BDC structure ET_FT.

Hope this helps anyone on the same boat.

Regards,

Anirban

amit_upadhye2
Participant
0 Kudos

amallick Just one question here. The custom fields concerned here are the also added in BP transaction ?

Answers (1)

Answers (1)

anirban_pwc
Participant
0 Kudos

Hi Amit - did you get a resolution to this problem? I'm on the same boat. Would highly appreciate your response.

Thank you,

Anirban

amit_upadhye2
Participant
0 Kudos

In SAP NOTE 580266 following statement can be found

Within the ALE distribution the methods are only provided for the segments or tables that can be edited analog to the standard batch input or whose table enhancement is also supported in the vendor master dialog. Only when these conditions are met, a user can connect himself without modification in order to import own data. The following tables and their ALE segments are supported: LFA1, LFB1, LFM1, LFM2, LFBK, WYT1, WYT1T, WYT3

As I understand the part in bold confirms that one needs to enhance the vendor master dialog also to update the fields via this BAdi.

There is a very useful cookbook attached to following SAP note which helps to add these custom fields to vendor master dialog.

2309153 - BP_CVI: Guideline Version 1.14 for customer enhancements in CVI (customer/vendor integration) in SAP S/4HANA releases