Table
» See all 8 related threads
Sep 06 14

Custom Fields in BP to be replicated to KNA1  

11:46 // Muraghendra Durgadamath

Hi.

I am working on the SAP CRM 4.0 and SAP r/3 4.6C.

I have extended the BP by custom fields by EEWB and also the KNA1 table in R/3.

ZBSTC000000000C is the structure in the BUT000 with the field ZZSHIPTOSTOR0001.

ZBSTC000000000C is also added in KNA1 table with the field ZZSHIPTOSTOR0001.

We would be creating the BP's in the CRM and have them delta downloaded to R/3.

The data in the field ZZSHIPTOSTOR0001 should also be replicated to the R/3.

<b>IN CRM.</b>

I have created the FM : Z_BANK_MASTER_SMOUTIL2 in the CRM and made entry in the table TPS34 for the Procss SMOUTIL2.

The Code is as below.

FUNCTION Z_BANK_MASTER_SMOUTIL2.

*"----


""Local interface:

*"  IMPORTING

*"     VALUE(I_HEADER) TYPE  SMW3_FHD

*"     VALUE(I_TRANSACTION_HEADER) TYPE  SMO8_TMSG

*"     VALUE(I_TRANSACTION_MESSAGE) TYPE  ANY

*"     VALUE(I_MESSAGE_EXT) TYPE  ANY

*"     VALUE(I_SITE_ID) TYPE  SMOG_SITE

*"     REFERENCE(I_RECIPIENTS) TYPE  SMW_RECTA2

*"     REFERENCE(I_QNAME) TYPE  TRFCQNAM

*"  TABLES

*"      T_BAPIMTCS STRUCTURE  BAPIMTCS

*"      T_BAPICRMSFK STRUCTURE  BAPICRMSFK

*"      T_BAPIPAREX STRUCTURE  BAPIPAREX

*"      TI_QRFCRCV STRUCTURE  QRFCRCV

*"  CHANGING

*"     REFERENCE(E_STATUS) TYPE  SMW3_RECST

*"     REFERENCE(E_SUCCESS_BEHAVIOUR) TYPE  SMOFSUCBEF

*"     REFERENCE(E_NO_STANDARD_UPLOAD) TYPE  XFELD

*"     REFERENCE(ERROR_SEGMENTS) TYPE  SMW_ERRTAB

*"     REFERENCE(E_BAPICRMUH1) TYPE  BAPICRMUH1

*"----


  data : ls_ZZSHIPTOSTOR0001 type ZILGCUSTOMFIELDS.

  data : ls_bapimtcs TYPE bapimtcs,

         lv_partner_guid TYPE bu_partner_guid_32,

         next_free_currdno TYPE currdno VALUE 1.

  CASE i_header-bdoc_type.

  • Extension for Business Transaction

    WHEN 'SALESDOCUMENT'.

  • Extension for Business Partner

    WHEN 'BUPA_MAIN'.

      CALL FUNCTION 'Z_MAP_BUPA_TO_MW'

        EXPORTING

          i_header              = i_header

          i_transaction_header  = i_transaction_header

          i_transaction_message = i_transaction_message

          i_message_ext         = i_message_ext

          i_site_id             = i_site_id

          i_recipients          = i_recipients

        TABLES

          t_bapimtcs            = t_bapimtcs

          t_bapicrmsfk          = t_bapicrmsfk

          t_bapiparex           = t_bapiparex

        CHANGING

          e_status              = e_status

          e_success_behaviour   = e_success_behaviour

          e_no_standard_upload  = e_no_standard_upload

          error_segments        = error_segments

          e_bapicrmuh1          = e_bapicrmuh1.

  ENDCASE.

*Use the following macro definition to get full Unicode support:

  • Macro MOVE_CASTING *************************************

  FIELD-SYMBOLS: <unicode_x1> TYPE x,

  <unicode_x2> TYPE x.

  DEFINE move_casting.

    assign &1 to <unicode_x1> casting.

    assign &2 to <unicode_x2> casting.

    move <unicode_x1> to <unicode_x2>.

  END-OF-DEFINITION.

ENDFUNCTION.

FUNCTION Z_MAP_BUPA_TO_MW.

*"----


""Local interface:

*"  IMPORTING

*"     REFERENCE(I_HEADER) TYPE  SMW3_FHD

*"     REFERENCE(I_TRANSACTION_HEADER) TYPE  SMO8_TMSG

*"     REFERENCE(I_TRANSACTION_MESSAGE) TYPE  ANY

*"     REFERENCE(I_MESSAGE_EXT) TYPE  ANY

*"     REFERENCE(I_SITE_ID) TYPE  SMOG_SITE

*"     REFERENCE(I_RECIPIENTS) TYPE  SMW_RECTA2

*"  TABLES

*"      T_BAPIMTCS STRUCTURE  BAPIMTCS

*"      T_BAPICRMSFK STRUCTURE  BAPICRMSFK

*"      T_BAPIPAREX STRUCTURE  BAPIPAREX

*"  CHANGING

*"     REFERENCE(E_STATUS) TYPE  SMW3_RECST

*"     REFERENCE(E_SUCCESS_BEHAVIOUR) TYPE  SMOFSUCBEF

*"     REFERENCE(E_NO_STANDARD_UPLOAD) TYPE  XFELD

*"     REFERENCE(ERROR_SEGMENTS) TYPE  SMW_ERRTAB

*"     REFERENCE(E_BAPICRMUH1) TYPE  BAPICRMUH1

*"----


  tables : bnka,but000.

  data : int type i.

  data : ls_ZZSHIPTOSTOR0001 type ZILGCUSTOMFIELDS.

  data : ls_ZBSTC000000000C type ZBSTC000000000C.

  data : ls_ZILGCUSTOMFIELDS type ZILGCUSTOMFIELDS.

  data : ls_bapimtcs TYPE bapimtcs,

         lv_partner_guid TYPE bu_partner_guid_32,

         next_free_currdno TYPE currdno VALUE 1.

  data : ls_but000 type but000.

  FIELD-SYMBOLS: <fs_msg_bupa> TYPE bus_ei_main,

  <fs_msg_bpext> TYPE bus_ei_extern.

  DATA lr_cast_illegal TYPE REF TO cx_sy_assign_cast_illegal_cast.

  DATA lr_cast_unknown TYPE REF TO cx_sy_assign_cast_unknown_type.

  DATA : LS_BNKA     TYPE BNKA,

         LS_BNKA_MEM TYPE BNKA,

         LT_BNKA     TYPE TABLE OF BNKA,

         LT_BNITAB   TYPE TABLE OF BNKT,

         UNAME       LIKE SY-UNAME.

  DATA: BEGIN OF PARAMETER_TAB OCCURS 0.

          INCLUDE STRUCTURE ZPARAMETER.

  DATA: END OF PARAMETER_TAB.

  loop at T_BAPIMTCS.

    if T_BAPIMTCS-currdno > next_free_currdno.

      next_free_currdno = T_BAPIMTCS-currdno + 1.

    endif.

  endloop.

  assign i_message_ext to <fs_msg_bupa>.

  if sy-subrc <> 0.

    exit.

  endif.

  LOOP AT <fs_msg_bupa>-partners

  ASSIGNING <fs_msg_bpext> WHERE header-object_instance-bpartnerguid EQ T_BAPIMTCS-OBJKEY.

    select single * from But000 where PARTNER_GUID eq T_BAPIMTCS-OBJKEY.

    • pack data into transfer structure

    CLEAR: ls_bapimtcs.

    ls_bapimtcs-tabname =  'ZBSTC000000000C'.

    ls_bapimtcs-segtype = 'DA'.

    ls_bapimtcs-currdno = next_free_currdno.

    ls_bapimtcs-objkey = lv_partner_guid.

    ls_bapimtcs-relkey = lv_partner_guid.

    move-corresponding But000 to ls_ZBSTC000000000C.

    move_casting ls_ZBSTC000000000C ls_bapimtcs-data.

    APPEND ls_bapimtcs TO t_bapimtcs.

  ENDLOOP.

ENDFUNCTION.

The table t_bapimtcs is populated with the structure ZBSTC000000000C.The data is also populated.

<b>IN R/3 system.</b>

I have created the FM "ZSAMPLE_PROCESS_CRM0_300".

The table TPS34 is added with CRM0_300 as procs and the FM "ZSAMPLE_PROCESS_CRM0_300" is assigned.

FUNCTION ZSAMPLE_PROCESS_CRM0_300.

*"----


""Local interface:

*"  IMPORTING

*"     REFERENCE(I_BAPICRMUH1) LIKE  BAPICRMUH1 STRUCTURE  BAPICRMUH1

*"  EXPORTING

*"     REFERENCE(E_NO_STANDARD_UPLOAD) LIKE  CRM_PARA-XFELD

*"  TABLES

*"      T_BAPIMTCS STRUCTURE  BAPIMTCS

*"      T_BAPIPAREX STRUCTURE  BAPIPAREX

*"      T_BAPICRMSFK STRUCTURE  BAPICRMSFK

*"      T_BAPICRMMSG STRUCTURE  BAPICRMMSG

*"  EXCEPTIONS

*"      EVENT_NOT_CALLED

*"----


  data : int type i.

  data : c_kunnar like kna1-kunnr.

  data : o_kna1 like standard table of kna1,

         n_kna1 like standard table of kna1,

         I_KNA1 like standard table of kna1,

         i_knb1 like standard table of knb1.

  data :   o_but000 like standard table of but000,

           n_but000 like standard table of but000.

  • tables : kna1.

  data : ls_ZBSTC000000000C type ZBSTC000000000C.

  data : ls_ZZSHIPTOSTOR0001 like kna1-ZZSHIPTOSTOR0001.

  case I_BAPICRMUH1-OBJNAME.

    when 'CUSTOMER_MAIN' OR 'BUPA_MAIN'.

  endcase.

 

  field-symbols : <fs_msg_kna1> type kna1,

                  <fs_msg_cuext> type ZBSTC000000000C.

  data : g_kunnr like kna1-kunnr.

  loop at T_BAPIMTCS where tabname eq 'BSC_MAINI'.

    move t_bapimtcs-data+0(10) to g_kunnr.

  endloop.

  loop at T_BAPIMTCS where tabname = 'ZBSTC000000000C'.

 

      move_casting t_bapimtcs-data ls_ZZSHIPTOSTOR0001.

 

  endloop.

  field-symbols : <unicode_x1>  type x,

                  <unicode_x2>  type x.

  define move_casting.

    assign &1 to <unicode_x1>casting.

    assign &2 to <unicode_x2>casting.

    move  <unicode_x1> to <unicode_x2>.

  end-of-definition.

ENDFUNCTION.

The table t_bapimtcs is populated with the data.

But i am not able to have the data in the table KNA1 table of the R/3 system.

How can i unpack the data in t_bapimtcs  and modify the table KNA1.

Could any one pls advise.

Thanks.

Muraghendra D

 
Sep 06 15

Re: Custom Fields in BP to be replicated to KNA1  

07:50 // Muraghendra Durgadamath

Any answers to this pls.

Sep 06 15

Re: Custom Fields in BP to be replicated to KNA1  

15:09 // Alexander Chernykh

Available process interfaces are:

 System     Reg.     Interface     Description R/3     TBE34     00001310     Processing a customer master extension R/3     TBE34     00001320     Updating added customer master tables R/3     TBE34     00001330     Displaying the customer master menu R/3     TBE34     DE_AALE     After Inbound updating of the customer master via ALE R/3     TPS34     CRM0_200     Before sending the data to the Middleware R/3     TBE31     00001321     Calling the R/3 Adapter from the customer mas-ter CRM     TPS34     SMOUTIL2     Outbound from the Middleware to the R/3 Adapter CRM     TPS34     SMOUTIL3     Inbound Middleware from the R/3 Adapter 

You must make the following entries for the extension scenarios on offer:

  Sys.     Interface     Function Module     Extension Scenario R/3     00001310     Z_OPFI1310          Business Partner / Customer Master R/3     00001320     Z_OPFI1320          Business Partner / Customer Master R/3     00001330     Z_OPFI1330          Business Partner / Customer Master R/3     DE_AALE     Z_OPFIDE_AALE       Business Partner / Customer Master R/3     00001321     Z_OPFI1321       Business Partner / Customer Master, remove PI_BP_CUSTOMER_BTE_1321 at all costs! R/3     CRM0_200     Z_OPFICRM0_200         All CRM     SMOUTIL2     Z_OPFI_SMOUTIL2     All CRM     SMOUTIL3     Z_OPFI_SMOUTIL3     All 
Sep 06 15

Re: Custom Fields in BP to be replicated to KNA1  

18:43 // Vikash Krishna

Hi Muraghendra D,

Give me your mail id, I will send you the CRM MW extension guide which might be helpful in your case.

<b>Allot points if my post helps!!</b>

Best regards,

Vikash.

Sep 06 18

Re: Custom Fields in BP to be replicated to KNA1  

08:52 // Muraghendra Durgadamath

Vikas,

Pls send the Document to durgadmath@hotmail.com

Thanks.

Points are awarded.

Feb 12 29

Re: Custom Fields in BP to be replicated to KNA1  

09:49 // Anders Mørk

Hello Muraghendra, I had a very similar requirement in my project and ran in to similar problems. The idea of packing data on the CRM side and unpacking on the R/3 side was relatively straight forward, but how to update KNA1 or KNVV in my particular case, was a bit tricky. It turned out that one needs to manipulate an IDOC. In our correspondence with SAP on the matter they said the following:

+"In R/3 the processing(in both cases replication and updation) is done in the following manner.

1.The BAPIMTCS structures are converted to complex structures.

2.The complex structures are converted to Idocs.

3.The checks for required fields is made.

4.The data is saved to the data base via a batch input transaction.

Note: Unlike in CRM, R/3 does not use BAPIs for saving to data base.

The function module PI_BP_DE_BALE_VTBER in the R/3 system(this is present in the UD1 system) can be used as a template for converting the BAPIMTCS to complex structure and to Idocs. Once the data is present in

the Idocs, the batch input would take care of saving the data. The flow would be the same in both the cases (replication and updation).

You may register your function module with the event DE_BALE. This function module would be called just before the system executes Step 3.

Note: The Idocs that are used are mapped directly to the underlying tables table(for example KNA1, KNVV etc.) and will have the necessary field(in this case KNVV-PERFK)."+

In my particular example I had to enhance the business partner on the CRM side with the field PERFK. This field already exist on the R/3 side and the task was then to allow CRM to be the master of all customer updates and consequently transfer any changes of the field PERFK in CRM to KNVV-PERFK in R/3. I think you will find that this requirement is similar to your own requirement.

In the end my code looked like this in R/3:

  DATA: LV_FOUND   TYPE C,         LS_E1KNVVM LIKE E1KNVVM,         LS_E1KNA1M LIKE E1KNA1M,         LS_IDOC_DATA LIKE EDIDD,         LS_PERFK type BSS_CENTI.   constants: c_vkorg_6002 type VKORG value '6002',              c_vtweg_60 type VTWEG value '60',              c_spart_60 type SPART value '60',              c_msgfn_004 type msgfn value '004'.   FIELD-SYMBOLS <unicode_x1> type c.   FIELD-SYMBOLS <unicode_x2> type c.   DEFINE move_casting.     assign &1 to <unicode_x1> casting.     assign &2 to <unicode_x2> casting.     move <unicode_x1> to <unicode_x2>.   END-OF-DEFINITION.   CHECK NOT is_complex_structure IS INITIAL.   LOOP AT it_bapimtcs WHERE tabname = 'BSS_CENTI'       AND relkey(32) =       is_complex_structure-header-object_instance-bpartnerguid.     CLEAR LV_FOUND.     CLEAR LS_E1KNVVM.     move_casting IT_BAPIMTCS-DATA LS_perfk.     LOOP AT CT_IDOC_DATA WHERE SEGNAM = 'E1KNVVM'. "Hvis E1KNVVM       LS_E1KNVVM = CT_IDOC_DATA-SDATA.             "segmentet allerede       LV_FOUND = 'X'.                              "eksisterer       MOVe LS_perfk-zzperfk TO LS_E1KNVVM-perfk.       CT_IDOC_DATA-SDATA = LS_E1KNVVM.       MODIFY CT_IDOC_DATA.       EXIT.     ENDLOOP.     IF NOT LV_FOUND = 'X'.       CALL FUNCTION 'PI_BP_INIT_IDOC_STRUCTURES'            IMPORTING                 ES_E1KNVVM = LS_E1KNVVM            EXCEPTIONS                 OTHERS     = 0.       MOVe LS_perfk-zzperfk TO LS_E1KNVVM-perfk.       LS_E1KNVVM-MSGFN = c_msgfn_004. "Beskeden indeholder ændringer       LS_E1KNVVM-VKORG = c_vkorg_6002.       LS_E1KNVVM-VTWEG = c_vtweg_60.       LS_E1KNVVM-SPART = c_spart_60.       CT_IDOC_DATA-SEGNAM = 'E1KNVVM'.       CT_IDOC_DATA-SDATA  = LS_E1KNVVM.       APPEND CT_IDOC_DATA.     ENDIF.   ENDLOOP. 

I hope this helps. Otherwise, please ask again.

Rgds.

Anders

Feb 12 29

Re: Custom Fields in BP to be replicated to KNA1  

09:49 // Muraghendra Durgadamath

Thanks a lot Anders Mørk.

I will work in the direction you have shown and let you know.

Thanks once again.

Muraghendra D

Feb 12 29

Re: Custom Fields in BP to be replicated to KNA1  

09:49 // Muraghendra Durgadamath

Hi Anders Mørk,

I have created a FM : ZPI_BP_DE_BALE_VTBER like the one PI_BP_DE_BALE_VTBER.

In the table TBE34 i have this FM for the event DE_BALE.

when i loop at the CT_IDOC_DATA i am not getting the SEGNAM  for which the z fileds are present.

I have added the z fields in the transaction BP by using the EEWB and in the KNA1 table by append structure.

I have the z filed data comming from CRM in the internal table it_bapimtcs .

Pls guide me how can i update the z fields in the table KNA1.

Thanks in advance.

Muraghendra D

Sep 06 18

Re: Custom Fields in BP to be replicated to KNA1  

17:07 // Vikash Krishna

Hi Muraghendra D,

I have sent you a MW extension guide which will help you acheiving the task.

Best regards,

Vikash.

Feb 12 29

Re: Custom Fields in BP to be replicated to KNA1  

09:50 // Muraghendra Durgadamath

Hi Anders Mørk,

I have all the z fileds in the table KNA1.I have used append structure and added the fileds.

But in the FM :ZPI_BP_DE_BALE_VTBER when i check the internal table CT_IDOC_DATA none of the segments have the z fileds created.

I have the z filed data caomming in the table it_bapimtcs.How can i update the KNA1.

Pls advise.

Thanks.

Muraghendra D

Feb 12 29

Re: Custom Fields in BP to be replicated to KNA1  

09:50 // Muraghendra Durgadamath

Anders Mørk,

Could you pls guide me on this?

Sorry to bother you time and again.

Thanks.

Muraghendra D

Sep 06 21

Re: Custom Fields in BP to be replicated to KNA1  

07:52 // Muraghendra Durgadamath

Any clues on this pls.

Thanks.

Muraghendra D

Apr 07 02

Re: Custom Fields in BP to be replicated to KNA1  

08:40 // Rahul Jagani

Hi Muraghendra,

     Can you please help me with how did you get rid of the problems that you were facing as even i have the same issue that you had.

     I have enhanced the Z field on R/3 side using append structure and Z field on CRM using EEWB. Hence idoc segement does not have the Z field on R/3 side. So how to map the Z field value from CRM to R/3 for Business Partner in R/3 table KNA1. Please help as it is urgent.

Regards,

Rahul

Sep 07 27

Re: Custom Fields in BP to be replicated to KNA1  

22:55 // Bin Wu

HI Vikash,

Can you please send me the extension guide to kcerpconsulting@gmail.com?

Thank you very much,

Bin

Sep 07 27

Re: Custom Fields in BP to be replicated to KNA1  

22:56 // Bin Wu

Hi Muraghendra,

I have the same issue that I can not unpack data and update KNA1.

If you have solved the issue, can you guide me through?

Thank you very much,

Bin

00

 

 
00

 

 
Date Views Headline Answers
22.01.2013 381 Data Transfer from ECC TO CRM & CRM TO ECC for ZFIELDS & Debug the Interface 6
23.10.2010 1709 ASSIGN_TYPE_CONFLICT runtime error in CRM in progr 4
13.01.2010 3549 System copy using SAPInst(Export Import database I 3
05.08.2009 1177 Replication filter on material not taken into acco 5
31.08.2007 453 CRM Sales Document EEWB 4
13.04.2007 1206 replication of CUSTOMER fields (Z fields) for a ma 4
14.09.2006 3855 Custom Fields in BP to be replicated to KNA1 17

Feedback