Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BADI Implementation for distributing customer master through ALE

Former Member
0 Kudos

Hi,

I have implemented the BADI definition CUSTOMER_ADD_DATA_BI for populating the custom segment Z1KNA1M(contains the additional address fields) of the idoctype Debmas06 in the method FILL_ALE_SEGMENTS_OWN_DATA.

It was working fine till I introduced other filter based on the country of the customer in the segment E1KNA1M - Land1 (US, MX, CA) in the distribution model.

Now it's working fine for the customers with the above countries, but for the other countries where in it shloudn't generate a communication idoc it's giving an error saying 'Internal error: Program read table idoc_structure, command data_select_for_block, argument Z1KNA1M'. when running BD21 or BD12.

Would appreciate for your responses.

Thankyou,

Nalinikalyan.

1 ACCEPTED SOLUTION

Former Member

Hi kalyani,

Could u pls help on this...

I am using badi CUSTOMER_ADD_DATA_BI to post custom segments data to database( here my fm is configured or calling this badi based upon partner profiles)

Here i want to receive custom segment & corresponding sdata then i need to submit this to E_BI_STRUCT (According to my knowledge if we submit to e_bi_struct sap will take care of bdc)

But i see method MODIFY_BI_STRUCT_FROM_STD_SEG not importing custom segments and method PASS_NON_STANDARD_SEGMENT has no exporting or changing parameter.

I want custom segments data to be submitted using this badi itself.

So kindly please suggest to solving this issue.

Your help highly appreciated.

Thanks in advance.

9 REPLIES 9

Former Member
0 Kudos

Got the answer as the Extension need to be passed in the BADI,Which is not passed in at first.

Former Member

Hi kalyani,

Could u pls help on this...

I am using badi CUSTOMER_ADD_DATA_BI to post custom segments data to database( here my fm is configured or calling this badi based upon partner profiles)

Here i want to receive custom segment & corresponding sdata then i need to submit this to E_BI_STRUCT (According to my knowledge if we submit to e_bi_struct sap will take care of bdc)

But i see method MODIFY_BI_STRUCT_FROM_STD_SEG not importing custom segments and method PASS_NON_STANDARD_SEGMENT has no exporting or changing parameter.

I want custom segments data to be submitted using this badi itself.

So kindly please suggest to solving this issue.

Your help highly appreciated.

Thanks in advance.

0 Kudos

Hi Imran,

You need to use method PASS_NON_STANDARD_SEGMENT, if you intend to get the custom segment inbound.

The changing parameters are

VALUE(I_SEGMENT_NAME) TYPE EDILSEGTYP - Name of the customer-defined IDOC segments

I_SEGMENT_DATA TYPE EDI_SDATA - Customer defined IDOC segments data.

Method MODIFY_BI_STRUCT_FROM_STD_SEG should be used when you intend to change any information before posting though BDC. Here you have the current processing segment and all its details.

0 Kudos

Nalini Kalyan is right.

You may capture the custom segment data which exists in I_SEGMENT_DATA in PASS_NON_STANDARD_SEGMENT method to an internal table.

considering the custom segment as 'ZABCDEFGH'

IF I_SEGMENT_NAME = 'ZABCDEFGH'

APPEND I_SEGMENT_DATA TO ITAB.

ENDIF.

i.e read the segment_name and capture the data in an internal table and can be used to populate T_BI_DATA in FILL_BI_TABLE_WITH_OWN_SEGMENT .

Hope this helps.

Former Member
0 Kudos

Hi Kalyani ,

I am getting the same error -

'Internal error: Program read table idoc_structure, command data_select_for_block, argument Zemail .' when running BD21 /BD14

I added a custom segement to the Cremas03 Idoc type.

What did you do to solve this?

What do you mean by adding the extension ?

thanks,

Preeta

Former Member
0 Kudos

Hello Nalini,

I have a similar requirement where i added a new field in KNB1 table and this data is sent through DEBMAS06 to another SAP system. Hence i need to pass this additional data also to the other system.

I have created an extension for DEBMAS06 and added a custom segment to it. Now I want to use CUSTOMER_ADD_DATA_BI to pass the custom segment data also.

How to achieve this i.e in which all methods do I need to include code to send the additional data?

Request you to guide me to do the following.

Regards,

Chandra

Former Member
0 Kudos

Hi kalyani,

Can you tell me How do you have implemented the method FILL_ALE_SEGMENTS_OWN_DATA?

I try to do it but i don't find the solution.

Thanks a lot !!

former_member190178
Participant
0 Kudos

Hi Nalini,

Could you help in populating Z segment (ZTAX) which is added to the ZDEBMAS07 (copied from DEBMAS07).

This segment is added at very last and I only can see sinle method FILL_ALE_SEGMENTS_OWN_DATA in BADI CUSTOMER_ADD_DATA_BI. But not getting logic how can I populate this locating it very last of the tree.

Its easy for me to put it say after E1KNA1M or after E1KNA11. Please show something if you can.

Code what I have written still is:

TYPES: BEGIN OF ty_j_1imocust,

j_1icstno TYPE j_1imocust-j_1icstno,

j_1ilstno TYPE j_1imocust-j_1ilstno,

END OF ty_j_1imocust.

DATA: ls_j_1imocust1 TYPE ty_j_1imocust.

DATA: lv_kunnr TYPE kna1-kunnr,

ls_t_idoc_data TYPE edidd.

DATA: lv_flag TYPE char1.

DATA: lv_j1icstno TYPE j_1imocust-j_1icstno,

lv_j1ilstno TYPE j_1imocust-j_1ilstno.

DATA: ls_edidd TYPE edidd.

DATA: ls_j_1imocust TYPE j_1imocust.

CLEAR ls_t_idoc_data.

READ TABLE t_idoc_data INTO ls_t_idoc_data WITH KEY segnam = 'E1KNA1M'.

IF sy-subrc = 0.

lv_kunnr = ls_t_idoc_data-sdata+3(10).

ENDIF.

CLEAR ls_t_idoc_data.

READ TABLE t_idoc_data INTO ls_t_idoc_data WITH KEY segnam = 'ZTAX'.

IF sy-subrc = 0.

DELETE t_idoc_data INDEX sy-tabix.

ENDIF.

CLEAR ls_j_1imocust.

SELECT SINGLE *

FROM j_1imocust INTO ls_j_1imocust WHERE kunnr = lv_kunnr.

IF sy-subrc = 0.

MOVE ls_j_1imocust-j_1icstno TO ls_j_1imocust1-j_1icstno.

MOVE ls_j_1imocust-j_1ilstno TO ls_j_1imocust1-j_1ilstno.

ls_edidd-mandt = sy-mandt.

ls_edidd-segnam = 'ZTAX'.

ls_edidd-sdata = ls_j_1imocust1.

APPEND ls_edidd TO t_idoc_data.

ENDIF.

0 Kudos

In the FM MASTERIDOC_CREATE_<Message type name>, Enhancement has to be implemented.

Add the the IDoc Extension Name has to be passed to the CIMP field of the structure 'F_IDOC_HEADER'. for eg. if your IDoc Extension name is 'Z_IDOC_EXTEND' the code would be :

F_IDOC_HEADER-CIMP = 'Z_IDOC_EXTEND'.