BAPI_BUPA_CENTRAL_CHANGE
Hi Friends,
please help me out!!!!
am changing the search terms of a BP using FM
BAPI_BUPA_CENTRAL_CHANGE
and also i've used BAPI_TRANSACTION_COMMIT....
But still the DB is not updating and it is not throwing any error......
here is the piece of code....
WA_CENTRALDATA-SEARCHTERM1 = 'S1'.
WA_CENTRALDATA-SEARCHTERM2 = 'S2'.
WA_CENTRALDATA-CENTRALBLOCK = C_X.
*WA_CENTRALDATA-CENTRALARCHIVINGFLAG = 'X'.
WA_CENTRALDATA_X-SEARCHTERM1 = 'S1'.
WA_CENTRALDATA_X-SEARCHTERM2 = 'S2'.
WA_CENTRALDATA_X-CENTRALBLOCK = C_X.
WA_CENTRALDATA_X-CENTRALARCHIVINGFLAG = C_X.
V_BP = '515'.
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
BUSINESSPARTNER = V_BP
CENTRALDATA = WA_CENTRALDATA
CENTRALDATAPERSON =
CENTRALDATAORGANIZATION =
CENTRALDATAGROUP =
CENTRALDATA_X = WA_CENTRALDATA_X
CENTRALDATAPERSON_X =
CENTRALDATAORGANIZATION_X =
CENTRALDATAGROUP_X =
DUPLICATE_MESSAGE_TYPE = 'E'
TABLES
TELEFONDATANONADDRESS =
FAXDATANONADDRESS =
TELETEXDATANONADDRESS =
TELEXDATANONADDRESS =
E_MAILDATANONADDRESS =
RMLADDRESSDATANONADDRESS =
X400ADDRESSDATANONADDRESS =
RFCADDRESSDATANONADDRESS =
PRTADDRESSDATANONADDRESS =
SSFADDRESSDATANONADDRESS =
URIADDRESSDATANONADDRESS =
PAGADDRESSDATANONADDRESS =
COMMUNICATIONNOTESNONADDRESS =
COMMUNICATIONUSAGENONADDRESS =
TELEFONDATANONADDRESSX =
FAXDATANONADDRESSX =
TELETEXDATANONADDRESSX =
TELEXDATANONADDRESSX =
E_MAILDATANONADDRESSX =
RMLADDRESSDATANONADDRESSX =
X400ADDRESSDATANONADDRESSX =
RFCADDRESSDATANONADDRESSX =
PRTADDRESSDATANONADDRESSX =
SSFADDRESSDATANONADDRESSX =
URIADDRESSDATANONADDRESSX =
PAGADDRESSDATANONADDRESSX =
COMMUNICATIONNOTESNONADDRESSX =
COMMUNICATIONUSAGENONADDRESSX =
RETURN = IT_RETURN.
ADDRESSDUPLICATES =
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
RETURN =
Hi
Try giving
WA_CENTRALDATA_X-SEARCHTERM1 = 'X'.
WA_CENTRALDATA_X-SEARCHTERM2 = 'X'.
WA_CENTRALDATA_X-CENTRALBLOCK = 'X'.
WA_CENTRALDATA_X-CENTRALARCHIVINGFLAG ='X'.
It will solve your problem
Similar Messages
-
Data getting reverted back to old,BP transaction BAPI_BUPA_CENTRAL_CHANGE
Hi all,
I have written a piece of code which changes the BP transaction record say example i'm trying to change the last name of the BP I'm using BAPI_BUPA_CENTRAL_CHANGE function module and then commit statement which works fine, when i go to the BP transaction i can see the last name changed to the new name(which i gave in the program) but after few minutes the values are getting reverted back , the last name which i have changed is getting reverted to the old name.
When i check the change history then i can see the new value getting change to old value and i can see other user in created by field , can anyone help me out in this .
Thanks
BhavanaYes friend,
i do commit and i have seen the change in the change history and i see the changes are made, but after few mins i can the values getting reverted to old .
Thanks
Bhavana -
BAPI_BUPA_CENTRAL_CHANGE update in FM
Hi all,
I am entering an BP no in FM BAPI_BUPA_CENTRAL_CHANGE . The FM is Running but not showing any result in Return table and the data is not getting changed too.Why is it so? any ideas guys?.
Please reply soon.DATA: LT_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BUPA_ACT_ANALYZE_FOR_BAPI'
EXPORTING
IV_BP_NUMBER = BUSINESSPARTNER
IV_ACTIVITY = 'CHAN'
TABLES
CT_RESULTS = LT_RETURN.
LOOP AT LT_RETURN WHERE TYPE CA 'AE'.
EXIT.
ENDLOOP.
IF LT_RETURN IS INITIAL.
IF NOT ADDRESSDUPLICATES IS REQUESTED.
DUPLICATE_MESSAGE_TYPE = '-'.
endif.
CALL FUNCTION 'BUPA_CENTRAL_CHANGE'
EXPORTING
IV_PARTNER = BUSINESSPARTNER
IS_DATA = CENTRALDATA
IS_DATA_PERSON = CENTRALDATAPERSON
IS_DATA_ORGAN = CENTRALDATAORGANIZATION
IS_DATA_GROUP = CENTRALDATAGROUP
IS_DATA_X = CENTRALDATA_X
IS_DATA_PERSON_X = CENTRALDATAPERSON_X
IS_DATA_ORGAN_X = CENTRALDATAORGANIZATION_X
IS_DATA_GROUP_X = CENTRALDATAGROUP_X
IV_VALID_DATE = VALID_DATE
IV_DUPLICATE_MESSAGE_TYPE = DUPLICATE_MESSAGE_TYPE
TABLES
IT_ADTEL_ADDR_IND = TELEFONDATANONADDRESS
IT_ADFAX_ADDR_IND = FAXDATANONADDRESS
IT_ADTTX_ADDR_IND = TELETEXDATANONADDRESS
IT_ADTLX_ADDR_IND = TELEXDATANONADDRESS
IT_ADSMTP_ADDR_IND = E_MAILDATANONADDRESS
IT_ADRML_ADDR_IND = RMLADDRESSDATANONADDRESS
IT_ADX400_ADDR_IND = X400ADDRESSDATANONADDRESS
IT_ADRFC_ADDR_IND = RFCADDRESSDATANONADDRESS
IT_ADPRT_ADDR_IND = PRTADDRESSDATANONADDRESS
IT_ADSSF_ADDR_IND = SSFADDRESSDATANONADDRESS
IT_ADURI_ADDR_IND = URIADDRESSDATANONADDRESS
IT_ADPAG_ADDR_IND = PAGADDRESSDATANONADDRESS
IT_ADCOMREM_ADDR_IND = COMMUNICATIONNOTESNONADDRESS
IT_ADCOMUSE_ADDR_IND = COMMUNICATIONUSAGENONADDRESS
IT_ADTEL_ADDR_IND_X = TELEFONDATANONADDRESSX
IT_ADFAX_ADDR_IND_X = FAXDATANONADDRESSX
IT_ADTTX_ADDR_IND_X = TELETEXDATANONADDRESSX
IT_ADTLX_ADDR_IND_X = TELEXDATANONADDRESSX
IT_ADSMTP_ADDR_IND_X = E_MAILDATANONADDRESSX
IT_ADRML_ADDR_IND_X = RMLADDRESSDATANONADDRESSX
IT_ADX400_ADDR_IND_X = X400ADDRESSDATANONADDRESSX
IT_ADRFC_ADDR_IND_X = RFCADDRESSDATANONADDRESSX
IT_ADPRT_ADDR_IND_X = PRTADDRESSDATANONADDRESSX
IT_ADSSF_ADDR_IND_X = SSFADDRESSDATANONADDRESSX
IT_ADURI_ADDR_IND_X = URIADDRESSDATANONADDRESSX
IT_ADPAG_ADDR_IND_X = PAGADDRESSDATANONADDRESSX
IT_ADCOMREM_ADDR_IND_X = COMMUNICATIONNOTESNONADDRESSX
IT_ADCOMUSE_ADDR_IND_X = COMMUNICATIONUSAGENONADDRESSX
ET_ADDR_DUPLICATES = ADDRESSDUPLICATES
ET_RETURN = RETURN.
ENDIF.
LOOP AT LT_RETURN.
COLLECT LT_RETURN INTO RETURN.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ''
IMPORTING
RETURN = RETURN.
"COMMIT WORK.
Inputs to Fm:
Business partner: 1000058
Central data: Navin Chettiar
CENTRALDATA_X : X X
Regards,
Navin -
BAPI_BUPA_CENTRAL_CHANGE: Business partner does not exist
Hello,
I'm trying to change a business partner, which I created with BAPI_BUPA_CREATE_FROM_DATA.
But I get the error message "Business partner does not exist"
I do following:
1. create the BP with the BAPI_BUPA_CREATE_FROM_DATA
get the BUSINESSPATNER- number
2. fire BAPI_TRANSACTION_COMMIT.
In the SAP-GUI transaction BUP3 I can see my BP, ok
3. I try to change this BP with BAPI_BUPA_CENTRAL_CHANGE
and I get an error "Business partner does not exist"
Why?
I'm using JCO, I used to set BUSINESSPARTNER with and without leading zero - it doesn't work.
Can some one give me an advice?
Thanks,
Sergej BergHi,
The "VALID_DATE" should be set to the date of execution (at least this is what I'm doing in my system).
If you execute it via SE37 you can give it in the format of DDMMYYYY, but if you are testing an IDOC via WE19 you have to give it in the format of YYYYMMDD.
Enjoy,
Ayal. -
About FM BAPI_BUPA_CENTRAL_CHANGE update
Hi all,
I am entering an BP no in FM BAPI_BUPA_CENTRAL_CHANGE . The FM is Running but not showing any result in Return table and the data is not getting changed too.Why is it so? any ideas guys?.
Please reply soon.Hi,
Please check you are possing correct value in table .....X (end with X)
e.g.
If you are changing TELEFONDATANONADDRESS remember you should have correct values set in TELEFONDATANONADDRESSX.
Also check field in UPDATEFLAG in table TELEFONDATANONADDRESSX.
'U' - Update
'D' - Delete
Where ever you make changes replace with 'X'
suppose u r changing TEL_NO then in TELEFONDATANONADDRESSX-TEL_NO set as 'X'
I hope it will work.
Regards,
Nilesh P. -
Trying to update the business partner using BAPI_BUPA_CENTRAL_CHANGE
Hi all ,
i am tryibg to create a function module which updates the first name, last name, email id of the business partner that i already created. the return table shows zero entries and i dont find any udate being done for the business partner if i go and check in the respective table. can some one tell me what is the problem.
Import paramters for my function module are business partner number, first name, last name, email -d.
FUNCTION Z_CHANGE_BP2.
""Local Interface:
*" IMPORTING
*" VALUE(CUST_NO) TYPE BU_PARTNER
*" VALUE(FIRST_NAME) TYPE BU_NAMEP_F
*" VALUE(LAST_NAME) TYPE BU_NAMEP_L
*" VALUE(EMAIL_ID) TYPE AD_SMTPADR
*" TABLES
*" IT_RETURN2 STRUCTURE ZRETURN1 OPTIONAL
*" IT_RETURN4 STRUCTURE ZRETURN1 OPTIONAL
Defining the internal tables used in BAPI BAPI_BUPA_CENTRAL_CHANGE.
DATA: it_CENTRALDATA TYPE STANDARD TABLE OF BAPIBUS1006_CENTRAL WITH HEADER LINE.
DATA: it_CENTRALDATAPERSON TYPE STANDARD TABLE OF BAPIBUS1006_CENTRAL_PERSON WITH HEADER LINE.
DATA: it_E_MAILDATANONADDRESS TYPE STANDARD TABLE OF BAPIADSMTP WITH HEADER LINE.
DATA: it_RETURN1 TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
DATA: it_RETURN3 TYPE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE.
****Values for seacrh term1, search term2 of it_CENTRALDATA
it_CENTRALDATA-SEARCHTERM1 = FIRST_NAME.
it_CENTRALDATA-SEARCHTERM2 = LAST_NAME.
APPEND it_CENTRALDATA TO it_CENTRALDATA.
first name, last name of it_CENTRALDATAPERSON
it_CENTRALDATAPERSON-FIRSTNAME = FIRST_NAME.
it_CENTRALDATAPERSON-LASTNAME = LAST_NAME.
APPEND it_CENTRALDATAPERSON TO it_CENTRALDATAPERSON.
Value for E_MAIL of it_TELEFONDATANONADDRES-
it_E_MAILDATANONADDRESS-E_MAIL = EMAIL_ID.
APPEND it_E_MAILDATANONADDRESS TO it_E_MAILDATANONADDRESS.
Call the BAPI BAPI_BUPA_CENTRAL_CHANGE
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
BUSINESSPARTNER = CUST_NO
CENTRALDATA = it_CENTRALDATA
CENTRALDATAPERSON = it_CENTRALDATAPERSON
TABLES
E_MAILDATANONADDRESS = it_E_MAILDATANONADDRESS
RETURN = it_RETURN1.
Call Commit work
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = it_RETURN3.
ENDFUNCTION.Hi,
Pass values to the Parameter CENTRALDATA_X in your FM 'BAPI_BUPA_CENTRAL_CHANGE'
Something Like:
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
businesspartner = bpartner
centraldata = centraldatadetail
centraldataperson = centraldataperson
CENTRALDATAORGANIZATION =
CENTRALDATAGROUP =
centraldata_x = centraldata_x
centraldataperson_x = centraldataperson_x
CENTRALDATAORGANIZATION_X =
CENTRALDATAGROUP_X =
TABLES
return = return.
Refer to:
problem with 'BAPI_BUPA_CENTRAL_CHANGE'
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi-bupa_central_change-need-help-549117 -
Prpblem with 'BAPI_BUPA_CENTRAL_CHANGE'
Dear friends
I am updating a field using the bapi_bupa_central_change bapi. I m updating but000 tables xdele archive flag indicator to yes (x). My problem is i am failed to update the table. would you like to tell me where i am making mistakes..
any correstion or suggetion will be great help of mine... thanking you,,,
regards naim
i am giving you the code.
data: wa_bpartner type BAPIBUS1006_HEAD,
wa_arch_flag type BAPIBUS1006_CENTRAL.
loop at i_merge_p into wa_i_merge.
read table i_merge_p into wa_i_merge with key idnumber = wa_i_casep-idnumber.
if sy-subrc = 0.
wa_bpartner-bpartner = wa_i_merge-partner.
wa_arch_flag-CENTRALARCHIVINGFLAG = 'X'.
endif.
data : cdata like BAPIBUS1006_CENTRAL .
cdata = wa_arch_flag-CENTRALARCHIVINGFLAG.
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
BUSINESSPARTNER = wa_bpartner-bpartner
CENTRALDATA = cdata.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = ''
IMPORTING
RETURN = Return_L.
endloop.Hi Naim,
Refer the following piece of code and match it with yours. Here whatever fields of central data you need to update, pass the flag 'X' for those fields in centraldata_x.
*& Form f4116_change_central_data
* Change the Central Data
FORM f4116_change_central_data.
DATA : wa_centraldataorg_x TYPE bapibus1006_central_organ_x,
wa_centraldata_x TYPE bapibus1006_central_x.
CLEAR : wa_return_bp.
REFRESH : git_return_bp.
wa_centraldataorg_x-legalorg = gc_x.
wa_centraldataorg_x-legalform = gc_x.
wa_centraldataorg_x-name1 = gc_x.
wa_centraldata_x-partnertype = gc_x.
wa_centraldata_x-title_key = gc_x.
wa_centraldata_x-partnerexternal = gc_x.
* Update the Central Information for the Business Partner
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
businesspartner = gv_customer
centraldata = wa_central_data
centraldataorganization = wa_centraldataorganization
centraldata_x = wa_centraldata_x
centraldataorganization_x = wa_centraldataorg_x
TABLES
return = git_return_bp.
READ TABLE git_return_bp INTO wa_return_bp
WITH KEY type = gc_error.
IF sy-subrc EQ 0.
* Set IDOC in error(Business Partner Change Failed)
PERFORM fill_err_log USING gc_x gc_space
gc_i gc_146
gv_flag = gc_x.
ENDIF.
ENDFORM. " f4116_change_central_data
<b>Reward points if it helps.</b>
Message was edited by: Amit Mishra -
Mass update of BUT000-Z field, but can't use FM BAPI_BUPA_CENTRAL_CHANGE
After a data load we have realised that one of the Z fields has not been populated with data and so as a result of this I am attempting to write a quick program to update this Z field. The field is located in table BUT000, but of course I need to update this using the appropriate FM rather than direct table update.
There seems to be a few' BUT000' FM's and a number of 'CRM_BUPACHANGE' FM's as well. Has anyone used an FM for such an update before?. I think I need to identify the best FM for the job.
I have also looked at FM BAPI_BUPA_CENTRAL_CHANGE as well, but that does NOT contain the Z field to change.
With regards
J SaporaHi Markus,
I agree with you, but MASS is something very straight forward, plus, don't support paralelization, so if you want to change a smalll amout of data or you really don't care about performance (I mean for the process is the same if the update takes 1 or 4 hours) and the changes doesn't imply a business logic, the user has all the control of which fileds should be changed and for which value, then it's a good option.
But when extra logic is needed, Mass can become a nightmare, I will write a blog about this if I have the time.
Cheers!
Luis -
'BAPI_BUPA_CENTRAL_CHANGE' + UPDATE
Hello Friends,
I am trying to update the data of the SAP BP while using the 'BAPI_BUPA_CENTRAL_CHANGE' BAPI. but its seems not me working, However I am providing all required feilds to the Function!
Here is the code segment!
DATA: businesspartner TYPE bapibus1006_head-bpartner.
DATA: person TYPE bapibus1006_central.
Data: personData type BAPIBUS1006_CENTRAL_PERSON.
persondata-firstname = 'ammar'.
persondata-lastname = 'zaidi'.
data: my_Table type standard table of BAPIRET2 with default key,
wa_myTab like line of my_Table.
move 0000000001 to businesspartner.
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
BUSINESSPARTNER = businesspartner
CENTRALDATA = person
CENTRALDATAPERSON = persondata
TABLES
RETURN = my_Table .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT my_Table INTO wa_myTab.
write my_Table.
ENDLOOP.
Can any one please point out for me that what I am missing!? or any suggestion,
Many thanks
Marek
PS: when I try to print the return table, it gives me error cant convert to character type feild?? how I can write the return table??Hello Friends,
does any one here any idea, what is possibly wronge in the following code segment ??
DATA: businesspartner TYPE bapibus1006_head-bpartner.
DATA: person TYPE bapibus1006_central.
Data: personData type BAPIBUS1006_CENTRAL_PERSON.
data: my_Table type standard table of BAPIRET2 with default key,
wa_myTab like line of my_Table.
move '000000001' to businesspartner.
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
BUSINESSPARTNER = businesspartner
CENTRALDATA = person
CENTRALDATAPERSON = persondata
TABLES
RETURN = my_Table .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
LOOP AT my_Table INTO wa_myTab.
write wa_myTab-type.
write wa_myTab-MESSAGE.
write wa_myTab-ID.
ENDLOOP.
I am trying to change the name of the SAP BP, but its not working ??
Any idea pls
Many thanks
Marek -
How to avoid using bapi_commit inside a loop .
Hi ,
Need a help.
This is a program for uploading business partners in CRM.
The basic logic of the program is as below:
- There are two types of records in the upload file new/ old ones to be updated
- A new record is identified by checking if a BP exits based on the cust id
- In case it is a new record certain BAPIs are called to create a new BP, else the address details, identification etc are updated for the existing one.
- SQL analysis of the program showed that the maximum amount of time is taken in INSERT/UPDTAE/COMMIT processes.
When we raised the issue with SAP , they stated that the problem occurs due to the very high no of BAPI_COMMIT calls which is within the loop.
The standard BAPI available allows passing of one record at a time. Hence passing multiple records at a time and a single commit did not seem feasible.
Also while updating since there are different BAPIs for address and identification it is being called in a sequence and commit issued after each. If commit is excluded it gives a locking error since the first BAPI tends to lock the record and does not allow subsequent BAPI call
kindly suggest me with a solution of using a less commit for updating series of records.
The code is as follows:
*& Report ZBP_BDCP_ACCTRNSDATA_UPLOAD *
*& Created By : Radhu Shankar.G *
*& Purpose : Program to Create Investors with the transaction *
*& data received from the De-dupe Software. *
*& Note : Can be Executed or scheduled only in Background *
REPORT zbp_bdcp_acctrnsdata_upload LINE-SIZE 255 LINE-COUNT 65 NO STANDARD PAGE HEADING
MESSAGE-ID zcrm_upload.
TABLES : bbp_iu01.
Selection Screen
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE string LOWER CASE OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK blk1.
SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
SELECT-OPTIONS:s_email FOR bbp_iu01-email NO INTERVALS.
SELECTION-SCREEN: END OF BLOCK blk2.
SELECTION-SCREEN: BEGIN OF BLOCK blk3 WITH FRAME TITLE text-003.
SELECTION-SCREEN COMMENT /1(72) text-004.
SELECTION-SCREEN COMMENT /1(72) text-006.
SELECTION-SCREEN COMMENT /1(72) text-007.
SELECTION-SCREEN COMMENT /1(72) text-005.
SELECTION-SCREEN: END OF BLOCK blk3.
Data Declaration
Main Upload structure and internal table
DATA : BEGIN OF i_main,
cust_id TYPE bu_bpext, " Customer ID
inv_type_code TYPE crmt_mktpfchr_atvalue, " Investor Type Code
insti_tag TYPE crmt_mktpfchr_atvalue, " Retail/Instituitional Tag
name TYPE char120, " Name
address1 TYPE ad_strspp1, " Address1
address2 TYPE ad_strspp2, " Address2
address3 TYPE ad_street, " Address3
city TYPE ad_city1, " City
state TYPE t005u-bezei, " Region/State
country TYPE landx50, " Country
pin_code TYPE ad_pstcd1, " Pin Code
off_phone1 TYPE ad_tlnmbr, " Office Telephone Number1
off_phone2 TYPE ad_tlnmbr, " Office Telephone Number2
res_phone1 TYPE ad_tlnmbr, " Residence Telephone Number1
res_phone2 TYPE ad_tlnmbr, " Residence Telephone Number1
mobile TYPE ad_mbnmbr1, " Mobile Number
email TYPE ad_smtpadr, " Email ID
birth_date TYPE bu_birthdt, " Birth Date
pan_no TYPE bu_id_number, " Pan Number
lob TYPE crmt_mktpfchr_atvalue, " Line of Business
fam_tag TYPE bu_id_number, " FAM Tag Number
mod_date TYPE sy-datum, " Modified Date
END OF i_main.
DATA : it_main LIKE i_main OCCURS 0 WITH HEADER LINE.
Error file structure and internal table
DATA : BEGIN OF i_error,
cust_id TYPE bu_bpext, " Customer ID
inv_type_code TYPE crmt_mktpfchr_atvalue, " Investor Type Code
insti_tag TYPE crmt_mktpfchr_atvalue, " Retail/Instituitional Tag
name TYPE char120, " Name
address1 TYPE ad_strspp1, " Address1
address2 TYPE ad_strspp2, " Address2
address3 TYPE ad_street, " Address3
city TYPE ad_city1, " City
state TYPE t005u-bezei, " Region/State
country TYPE landx50, " Country
pin_code TYPE ad_pstcd1, " Pin Code
off_phone1 TYPE ad_tlnmbr, " Office Telephone Number1
off_phone2 TYPE ad_tlnmbr, " Office Telephone Number2
res_phone1 TYPE ad_tlnmbr, " Residence Telephone Number1
res_phone2 TYPE ad_tlnmbr, " Residence Telephone Number1
mobile TYPE ad_mbnmbr1, " Mobile Number
email TYPE ad_smtpadr, " Email ID
birth_date TYPE bu_birthdt, " Birth Date
pan_no TYPE bu_id_number, " Pan Number
lob TYPE crmt_mktpfchr_atvalue, " Line of Business
fam_tag TYPE bu_id_number, " FAM Tag Number
mod_date TYPE sy-datum, " Modified Date
bp TYPE bapibus1006_head-bpartner, " BP
recno(4) TYPE c, " Record No
message(255) TYPE c, " Error Message
END OF i_error.
DATA : it_error LIKE i_error OCCURS 0 WITH HEADER LINE.
BP Telephone, Email & Role Details
DATA : w_bp_tel TYPE bapiadtel,
it_bp_tel TYPE bapiadtel OCCURS 0 WITH HEADER LINE,
it_bp_tel1 TYPE bapiadtel OCCURS 0 WITH HEADER LINE,
it_bp_email TYPE bapiadsmtp OCCURS 0 WITH HEADER LINE,
it_bp_email1 TYPE bapiadsmtp OCCURS 0 WITH HEADER LINE,
it_bapicomrem TYPE STANDARD TABLE OF bapicomrem WITH HEADER LINE,
it_bapicomrem_x TYPE STANDARD TABLE OF bapicomrex WITH HEADER LINE,
it_tel_x TYPE STANDARD TABLE OF bapiadtelx WITH HEADER LINE,
it_email_x TYPE STANDARD TABLE OF bapiadsmtx WITH HEADER LINE,
it_role TYPE bapibusisb990_bproles OCCURS 0 WITH HEADER LINE,
it_role_cp TYPE bapibusisb990_bproles OCCURS 0 WITH HEADER LINE.
BP Identication Details
DATA: BEGIN OF it_identification OCCURS 0,
idcategory TYPE bapibus1006_identification_key-identificationcategory,
idnumber TYPE bapibus1006_identification_key-identificationnumber,
END OF it_identification.
DATA : w_identification TYPE bapibus1006_identification.
BP Marketing Attributes
DATA : BEGIN OF it_crmt OCCURS 0,
crmt TYPE crmt_mktprof_keys-profile_template_id,
END OF it_crmt.
DATA : it_crmt1 TYPE STANDARD TABLE OF crmt_mktprof_comw WITH HEADER LINE,
it_crmt2 TYPE STANDARD TABLE OF crmt_mktprof_comw WITH HEADER LINE,
it_crmt3 TYPE STANDARD TABLE OF crmt_mktprof_comw WITH HEADER LINE,
it_crmt4 TYPE STANDARD TABLE OF crmt_mktprof_comw WITH HEADER LINE,
it_crmt5 TYPE STANDARD TABLE OF crmt_mktprof_comw WITH HEADER LINE,
it_bp_ret TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.
BP Basic Details
DATA : v_partn_cat TYPE bapibus1006_head-partn_cat,
w_central TYPE bapibus1006_central,
w_central_x TYPE bapibus1006_central_x,
w_central_org TYPE bapibus1006_central_organ,
w_central_per TYPE bapibus1006_central_person,
w_central_group TYPE bapibus1006_central_group,
w_centralorg_x TYPE bapibus1006_central_organ_x,
w_centralperson_x TYPE bapibus1006_central_person_x,
w_centralgrp_x TYPE bapibus1006_central_group_x,
w_address TYPE bapibus1006_address,
w_addr_x TYPE bapibus1006_address_x,
v_bp TYPE bapibus1006_head-bpartner.
Declaration for Duplication Check
DATA : w_zacc_address TYPE zacc_address,
g_dup_status TYPE i.
DATA : it_dup_bp TYPE STANDARD TABLE OF zbuspartner WITH HEADER LINE.
CONSTANTS: c_pan TYPE bu_id_type VALUE 'ZID003',
c_fam_tag TYPE bu_id_type VALUE 'ZID011',
c_cust TYPE bu_id_type VALUE 'ZID009'.
Other Declarations
DATA : v_inv_type TYPE crmt_mktpfchr_atvalue, " Investor Type Code
v_file TYPE string,
v_firstname TYPE bu_nameor1,
v_filename1(14) TYPE c,
v_filename2(14) TYPE c,
v_lines TYPE int4,
v_cat TYPE bu_type,
recno TYPE int4,
loopno TYPE int4,
it_iden_ret TYPE bapiret2 OCCURS 0,
it_attr_ret TYPE bapiret2 OCCURS 0,
it_role_ret TYPE bapiret2 OCCURS 0,
wa_iden_ret TYPE bapiret2,
wa_attr_ret TYPE bapiret2,
it_iden_flag TYPE c,
it_attr_flag TYPE c,
flag_central TYPE c,
flag_addr TYPE c,
flag_bp TYPE c,
flag_suc TYPE c,
flag_exist TYPE c,
flag_exit TYPE c,
g_bp_msg TYPE string,
g_bp_msg1 TYPE string.
DATA : BEGIN OF i_success,
rec TYPE int4, "Record
name TYPE bu_nameor1, "Name
bp TYPE bapibus1006_head-bpartner, "Business Partner
END OF i_success,
it_success LIKE i_success OCCURS 0 WITH HEADER LINE,
it_upd_success LIKE i_success OCCURS 0 WITH HEADER LINE.
Data Declaration for converting spool request to PDF and to trigger mail
DATA : gd_recsize TYPE i.
Spool IDs
TYPES : BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES : END OF t_tbtcp.
DATA : it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA : gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA : w_recsize TYPE i.
DATA : gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA : gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA : BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA : END OF it_pdf_output.
DATA : v_email1 TYPE somlreci1-receiver,
v_sender TYPE somlreci1-receiver.
CONSTANTS: c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL',
c_delspl TYPE c VALUE 'X'.
DATA : BEGIN OF result OCCURS 0,
line(100) TYPE c,
END OF result.
DATA:i_id_tab TYPE STANDARD TABLE OF bapibus1006_id_details WITH HEADER LINE.
eliminting the error for convt page error
data: g_spl type c value ''.
eliminting the error for convt page error
Initialization
Renaming the target file daily
CONCATENATE '_' sy-datum '.txt' INTO v_filename1.
CONCATENATE '_' sy-datum '.TXT' INTO v_filename2.
START-OF-SELECTION
START-OF-SELECTION.
SELECT COUNT(*) FROM zbp_tax_status.
IF sy-subrc <> 0.
SKIP 2.
WRITE:/ text-011.
STOP.
ENDIF.
REFRESH : it_main.
Uploading the file from either presentatinon layer or application server
PERFORM file_upload.
Creating the BP number and assigning & adding up other attributes
LOOP AT it_main.
PERFORM data_fill. " Filling up global structures & variables
IF v_bp IS INITIAL.
PERFORM duplication_check. " Duplication check
ENDIF.
PERFORM bp_creation. " BP Creation
PERFORM return_fill. " Filling up Return Tables
CLEAR : v_bp, it_main, flag_exit, g_dup_status, it_identification, it_crmt, it_crmt1, it_crmt2, it_crmt3, it_crmt4, it_crmt5,
w_bp_tel,it_bp_tel,it_bp_tel1,it_bp_email,it_bp_email1,it_tel_x,it_email_x,w_addr_x,w_centralorg_x,w_centralperson_x,
w_centralgrp_x,flag_addr,flag_central,it_iden_flag,it_attr_flag,it_bapicomrem,w_central,w_central_x, v_inv_type,it_bapicomrem_x,
w_central_org,w_central_per,w_central_group,flag_bp,flag_suc,flag_exist,it_bp_ret,g_bp_msg,g_bp_msg1,v_cat,wa_attr_ret.
REFRESH :it_identification, it_crmt, it_crmt1, it_crmt2, it_crmt3, it_crmt4, it_crmt5,it_bapicomrem,
it_bp_tel,it_bp_tel1,it_bp_email,it_bp_email1,it_tel_x,it_email_x,it_bp_ret,it_bapicomrem_x.
ENDLOOP.
Downloading the file to be reprocessed to the application server
IF it_error[] IS NOT INITIAL.
PERFORM error_file_download.
ENDIF.
Constructing the Return Messages for the Job
PERFORM return_messages. " Return Message Construction
Converting the return messages into PDF file and trigerring a mail notification
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
PERFORM trigger_email.
ENDIF.
*& Form file_upload
FORM file_upload .
Data declatration
DATA: l_filestr TYPE string.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS: con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
REPLACE '.txt' WITH v_filename1 INTO p_file .
REPLACE '.TXT' WITH v_filename2 INTO p_file .
MOVE p_file TO v_file.
IF sy-batch EQ 'X'.
Uploading the file from application server if the job is scheduled in background
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT
eliminting the error for convt page error
IGNORING CONVERSION ERRORS REPLACEMENT CHARACTER g_spl.
eliminting the error for convt page error
IF sy-subrc = 0.
DO.
READ DATASET p_file INTO l_filestr.
IF sy-subrc <> 0.
EXIT.
ELSE.
CLEAR it_main.
SPLIT l_filestr AT con_tab INTO:
it_main-cust_id it_main-inv_type_code
it_main-insti_tag it_main-name
it_main-address1 it_main-address2
it_main-address3 it_main-city
it_main-state it_main-country
it_main-pin_code it_main-off_phone1
it_main-off_phone2 it_main-res_phone1
it_main-res_phone2 it_main-mobile
it_main-email it_main-birth_date
it_main-pan_no it_main-lob
it_main-fam_tag it_main-mod_date.
APPEND it_main.
ENDIF.
ENDDO.
ELSE.
WRITE : / 'The file',
p_file,
'is not found.'.
STOP.
ENDIF.
CLOSE DATASET p_file.
ELSE.
WRITE : / 'The Program can only be executed in the background.'.
STOP.
ENDIF.
CLEAR : l_filestr, it_main.
ENDFORM. " file_upload
*& Form data_fill
FORM data_fill .
Filling up Partner Category (v_Partn_cat) ,workarea (w_central), workarea (w_central_org) & workarea (w_central_per)
SELECT SINGLE bp_category tax_status FROM zbp_tax_status
INTO (v_partn_cat,v_inv_type)
WHERE inv_code EQ it_main-inv_type_code.
Filling up the Authorization Group
IF it_main-lob EQ 'M' AND it_main-insti_tag EQ 'N'.
w_central-authorizationgroup = 'ZMFR'.
ELSEIF it_main-lob EQ 'M' AND it_main-insti_tag EQ 'Y'.
w_central-authorizationgroup = 'ZMFI'.
ELSEIF it_main-lob EQ 'P' AND it_main-insti_tag EQ 'N'.
w_central-authorizationgroup = 'ZPMR'.
ELSEIF it_main-lob EQ 'P' AND it_main-insti_tag EQ 'Y'.
w_central-authorizationgroup = 'ZPMI'.
ELSEIF it_main-lob EQ 'A' AND it_main-insti_tag EQ 'N'.
w_central-authorizationgroup = 'ZBOR'.
ELSEIF it_main-lob EQ 'A' AND it_main-insti_tag EQ 'Y'.
w_central-authorizationgroup = 'ZBOI'.
ENDIF.
Filling up workarea (w_address)
IF it_main-address1 IS NOT INITIAL.
MOVE : it_main-address1 TO w_address-str_suppl1,
it_main-address1 TO w_zacc_address-address1,
'X' TO w_addr_x-str_suppl1 .
ENDIF.
IF it_main-address2 IS NOT INITIAL.
MOVE : it_main-address2 TO w_address-str_suppl2,
it_main-address2 TO w_zacc_address-address2,
'X' TO w_addr_x-str_suppl2 .
ENDIF.
IF it_main-address3 IS NOT INITIAL.
MOVE : it_main-address3 TO w_address-street,
it_main-address3 TO w_zacc_address-address3,
'X' TO w_addr_x-street.
ENDIF.
IF it_main-city IS NOT INITIAL.
MOVE : it_main-city TO w_address-city,
it_main-city TO w_zacc_address-city,
'X' TO w_addr_x-city.
ENDIF.
IF it_main-pin_code IS NOT INITIAL.
MOVE : it_main-pin_code TO w_address-postl_cod1,
'X' TO w_addr_x-postl_cod1.
TRANSLATE w_address-postl_cod1 TO UPPER CASE.
ENDIF.
IF it_main-country IS NOT INITIAL.
MOVE : 'X' TO w_addr_x-country.
ENDIF.
IF it_main-state IS NOT INITIAL.
MOVE: 'X' TO w_addr_x-region.
ENDIF.
Picking up Country & State Codes
SELECT SINGLE land1 FROM t005t INTO w_address-country
WHERE spras EQ 'E'
AND landx50 EQ it_main-country.
IF sy-subrc EQ 0.
SELECT SINGLE bland FROM t005u INTO w_address-region
WHERE spras EQ 'E'
AND land1 EQ w_address-country
AND bezei EQ it_main-state.
IF sy-subrc NE 0.
w_address-region = 'ZZ'.
ENDIF.
ELSE.
w_address-country = 'ZZ'.
SELECT SINGLE bland FROM t005u INTO w_address-region
WHERE spras EQ 'E'
AND land1 EQ w_address-country
AND bezei EQ it_main-state.
IF sy-subrc NE 0.
w_address-region = 'ZZ'.
ENDIF.
ENDIF.
w_zacc_address-country = w_address-country.
w_zacc_address-state = w_address-region.
Filling up the BP Role Detail
it_role-partnerrole = 'Z1INVS'.
APPEND it_role.
Finding out the BP number from the client ID
IF it_main-cust_id IS NOT INITIAL.
SELECT SINGLE partner FROM but0id INTO v_bp
WHERE type EQ 'ZID009'
AND idnumber EQ it_main-cust_id.
IF sy-subrc = 0.
SELECT SINGLE type FROM but000 INTO v_cat
WHERE partner = v_bp.
PERFORM name_processing USING v_cat.
ENDIF.
ENDIF.
IF v_bp IS INITIAL.
PERFORM name_processing USING v_partn_cat. " Processing the Name & Title depending on partner category
Filling up the Identication Number Details
IF it_main-cust_id IS NOT INITIAL. " Customer ID
it_identification-idcategory = 'ZID009'.
it_identification-idnumber = it_main-cust_id.
APPEND it_identification.
CLEAR it_identification.
ENDIF.
IF it_main-pan_no IS NOT INITIAL. " Pan Number
it_identification-idcategory = 'ZID003'.
it_identification-idnumber = it_main-pan_no.
APPEND it_identification.
CLEAR it_identification.
ENDIF.
IF it_main-fam_tag IS NOT INITIAL. " Family Tag Number
it_identification-idcategory = 'ZID011'.
it_identification-idnumber = it_main-fam_tag.
APPEND it_identification.
CLEAR it_identification.
ENDIF.
Filling up the Marketing Attributes
IF v_inv_type IS NOT INITIAL. " Tax status
it_crmt1-atname = 'TAX_STATUS'.
it_crmt1-atwrt = v_inv_type.
APPEND it_crmt1.
CLEAR : it_crmt1.
ENDIF.
IF it_main-lob IS NOT INITIAL. " Product Tag
it_crmt1-atname = 'LOB'.
IF it_main-lob EQ 'M'.
it_crmt1-atwrt = 'MF'.
ELSEIF it_main-lob EQ 'P'.
it_crmt1-atwrt = 'PMS'.
ELSEIF it_main-lob EQ 'A'.
it_crmt1-atwrt = 'BOTH'.
ENDIF.
APPEND it_crmt1.
CLEAR : it_crmt1.
ENDIF.
IF it_main-insti_tag IS NOT INITIAL. " Retail/Instituitional Tag
it_crmt1-atname = 'ORGANISATION_STRUCTURE'.
IF it_main-insti_tag EQ 'N'.
it_crmt1-atwrt = 'RETAIL'.
ELSEIF it_main-insti_tag EQ 'Y'.
it_crmt1-atwrt = 'INSTITUTIONAL'.
ELSEIF it_main-insti_tag EQ 'F'.
it_crmt1-atwrt = 'INTERNATIONAL'.
ENDIF.
APPEND it_crmt1.
CLEAR : it_crmt1.
ENDIF.
it_crmt2-atname = 'VIP'.
it_crmt2-atwrt = 'NOT CLASSIFIED'.
APPEND it_crmt2.
CLEAR : it_crmt2.
it_crmt3-atname = 'PRIORITY'.
it_crmt3-atwrt = 'NOT CLASSIFIED'.
APPEND it_crmt3.
CLEAR : it_crmt3.
it_crmt4-atname = 'CONTACTBLE'.
it_crmt4-atwrt = 'NOT CLASSIFIED'.
APPEND it_crmt4.
CLEAR : it_crmt4.
it_crmt5-atname = 'SOURCE'.
it_crmt5-atwrt = 'CAMS'.
APPEND it_crmt5.
CLEAR : it_crmt5.
it_crmt-crmt = 'CENTALISED_CLF_INV'.
APPEND it_crmt.
it_crmt-crmt = 'GENERAL_CLF_INV'.
APPEND it_crmt.
it_crmt-crmt = 'MF_CLF_INV'.
APPEND it_crmt.
it_crmt-crmt = 'PMS_CLF_INV'.
APPEND it_crmt.
it_crmt-crmt = 'SOURCE'.
APPEND it_crmt.
CLEAR it_crmt-crmt.
ENDIF.
For Return Message
recno = recno + 1.
ENDFORM. " data_fill
*& Form duplication_check
FORM duplication_check .
DATA : l_lines TYPE i.
IF v_firstname IS NOT INITIAL.
CALL FUNCTION 'ZACC_DUPLICATIONCHECK'
EXPORTING
role = 'Z1INVS'
firstname = v_firstname
pan_no = it_main-pan_no
mobile = it_main-mobile
email = it_main-email
address = w_zacc_address
partnercategory = v_partn_cat
IMPORTING
status = g_dup_status
TABLES
buspartner = it_dup_bp.
DESCRIBE TABLE it_dup_bp LINES l_lines.
IF l_lines EQ 1.
IF g_dup_status EQ 1.
READ TABLE it_dup_bp INDEX 1.
MOVE it_dup_bp-partner TO v_bp.
ELSEIF g_dup_status EQ 2.
flag_exit = 'X'.
ENDIF.
ELSEIF l_lines GT 1.
flag_exit = 'X'.
ENDIF.
ENDIF.
CLEAR : l_lines, v_firstname.
ENDFORM. " duplication_check
*& Form name_processing
FORM name_processing USING uv_cat TYPE bu_type.
IF it_main-name IS NOT INITIAL.
If category is Person
IF uv_cat EQ 1.
CALL FUNCTION 'ZGET_NAME_FROM_STRING'
EXPORTING
name = it_main-name
IMPORTING
first = w_central_per-firstname
middle = w_central_per-middlename
last = w_central_per-lastname.
w_centralperson_x-firstname = 'X'.
w_centralperson_x-middlename = 'X'.
w_centralperson_x-lastname = 'X'.
w_centralperson_x-birthdate = 'X'.
MOVE : it_main-birth_date TO w_central_per-birthdate,
w_central_per-firstname TO v_firstname.
ELSEIF uv_cat EQ 2.
If category is organisation
CALL FUNCTION 'ZGET_NAME_FROM_STRING'
EXPORTING
name = it_main-name
IMPORTING
first = w_central_org-name2
middle = w_central_org-name1
last = w_central_org-name3.
w_centralorg_x-name1 = 'X'.
w_centralorg_x-name2 = 'X'.
w_centralorg_x-name3 = 'X'.
MOVE w_central_org-name2 TO v_firstname.
ELSEIF uv_cat EQ 3.
If category is group
CALL FUNCTION 'ZGET_NAME_FROM_STRING'
EXPORTING
name = it_main-name
IMPORTING
first = w_central_group-namegroup2
middle = w_central_group-namegroup1.
w_centralgrp_x-namegroup1 = 'X'.
w_centralgrp_x-namegroup2 = 'X'.
MOVE w_central_group-namegroup2 TO v_firstname.
ENDIF.
MOVE : it_main-name+0(8) TO w_central-searchterm1,
'X' TO w_central_x-searchterm1.
ENDIF.
ENDFORM. " name_processing
*& Form bp_creation
FORM bp_creation.
DATA:l_identification TYPE bapibus1006_identification_key-identificationnumber.
BP Creation
IF v_bp IS INITIAL.
Filling up the Telephone Details
MOVE : w_address-country TO w_bp_tel-country.
IF it_main-off_phone1 IS NOT INITIAL. " Office Telephone1
w_bp_tel-r_3_user = '1'.
w_bp_tel-telephone = it_main-off_phone1.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-r_3_user, w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'OFFICE PHONE1'.
APPEND it_bapicomrem.
ENDIF.
IF it_main-off_phone2 IS NOT INITIAL. " Office Telephone2
w_bp_tel-telephone = it_main-off_phone2.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'OFFICE PHONE2'.
APPEND it_bapicomrem.
ENDIF.
IF it_main-res_phone1 IS NOT INITIAL. " Residence Telephone1
w_bp_tel-telephone = it_main-res_phone1.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'RESIDENCE PHONE1'.
APPEND it_bapicomrem.
ENDIF.
IF it_main-res_phone2 IS NOT INITIAL. " Residence Telephone2
w_bp_tel-telephone = it_main-res_phone2.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'RESIDENCE PHONE2'.
APPEND it_bapicomrem.
ENDIF.
IF it_main-mobile IS NOT INITIAL. " Mobile Number
w_bp_tel-r_3_user = '3'.
w_bp_tel-telephone = it_main-mobile.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-r_3_user, w_bp_tel-telephone.
ENDIF.
Filling up the E-Mail Details
IF it_main-email IS NOT INITIAL. " E-mail1
it_bp_email-e_mail = it_main-email.
APPEND it_bp_email.
CLEAR it_bp_email.
ENDIF.
BAPI for BP creation
CALL FUNCTION 'BAPI_BUPA_FS_CREATE_FROM_DATA2'
EXPORTING
partnercategory = v_partn_cat
centraldata = w_central
centraldataperson = w_central_per
centraldataorganization = w_central_org
centraldatagroup = w_central_group
addressdata = w_address
IMPORTING
businesspartner = v_bp
TABLES
telefondata = it_bp_tel
communicationnotes = it_bapicomrem
e_maildata = it_bp_email
roles = it_role
return = it_bp_ret.
IF v_bp IS NOT INITIAL.
flag_bp = 'X'.
ENDIF.
Commiting the transaction
PERFORM transaction_commit.
To add Identification details to BP
PERFORM add_details.
CLEAR : v_partn_cat, w_central, w_central_per, w_central_org, it_bp_tel, it_bp_email, it_role.
REFRESH : it_bp_tel, it_bp_email, it_role.
ELSE.
flag_exist = 'X'.
If BP exists,address,communication and ID details will be updated
CALL FUNCTION 'BAPI_BUPA_CENTRAL_CHANGE'
EXPORTING
businesspartner = v_bp
centraldata = w_central
centraldataperson = w_central_per
centraldataorganization = w_central_org
centraldatagroup = w_central_group
centraldata_x = w_central_x
centraldataperson_x = w_centralperson_x
centraldataorganization_x = w_centralorg_x
centraldatagroup_x = w_centralgrp_x
TABLES
return = it_bp_ret.
READ TABLE it_bp_ret WITH KEY type = 'E'.
IF sy-subrc = 0.
flag_central = 'E'.
g_bp_msg = it_bp_ret-message.
CLEAR:it_bp_ret.
REFRESH:it_bp_ret.
ELSE.
flag_suc = 'X'.
ENDIF.
PERFORM transaction_commit.
To get the existing communication details
CALL FUNCTION 'BAPI_BUPA_ADDRESS_GETDETAIL'
EXPORTING
businesspartner = v_bp
TABLES
bapiadtel = it_bp_tel1
bapiadsmtp = it_bp_email1.
LOOP AT it_bp_tel1 WHERE r_3_user = '1' OR r_3_user = ' '.
it_bp_tel-consnumber = it_bp_tel1-consnumber.
it_tel_x-updateflag = 'D'.
APPEND:it_bp_tel,
it_tel_x.
CLEAR: it_bp_tel,
it_tel_x.
ENDLOOP.
IF it_main-mobile IS NOT INITIAL .
LOOP AT it_bp_tel1 WHERE r_3_user = '2' OR r_3_user = '3'.
it_bp_tel-consnumber = it_bp_tel1-consnumber.
it_tel_x-updateflag = 'D'.
APPEND:it_bp_tel,
it_tel_x.
CLEAR: it_bp_tel,
it_tel_x.
ENDLOOP.
ENDIF.
*Updating communication details
IF it_main-off_phone1 IS NOT INITIAL. " Office Telephone1
w_bp_tel-r_3_user = '1'.
w_bp_tel-telephone = it_main-off_phone1.
it_tel_x-telephone = 'I'.
it_tel_x-updateflag = 'I'.
APPEND:it_tel_x.
CLEAR: it_tel_x.
APPEND w_bp_tel TO it_bp_tel.
CLEAR : w_bp_tel-r_3_user, w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'OFFICE PHONE1'.
APPEND it_bapicomrem.
it_bapicomrem_x-comm_type = 'I'.
it_bapicomrem_x-langu = 'I'.
it_bapicomrem_x-comm_notes = 'I'.
it_bapicomrem_x-updateflag = 'I'.
APPEND it_bapicomrem_x.
ENDIF.
IF it_main-off_phone2 IS NOT INITIAL. " Office Telephone2
w_bp_tel-telephone = it_main-off_phone2.
APPEND w_bp_tel TO it_bp_tel.
it_tel_x-telephone = 'I'.
it_tel_x-updateflag = 'I'.
APPEND:it_tel_x.
CLEAR:it_tel_x.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'OFFICE PHONE2'.
APPEND it_bapicomrem.
it_bapicomrem_x-comm_type = 'I'.
it_bapicomrem_x-langu = 'I'.
it_bapicomrem_x-comm_notes = 'I'.
it_bapicomrem_x-updateflag = 'I'.
APPEND it_bapicomrem_x.
ENDIF.
IF it_main-res_phone1 IS NOT INITIAL. " Residence Telephone1
w_bp_tel-telephone = it_main-res_phone1.
APPEND w_bp_tel TO it_bp_tel.
it_tel_x-telephone = 'I'.
it_tel_x-updateflag = 'I'.
APPEND:it_tel_x.
CLEAR:it_tel_x.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'RESIDECE PHONE1'.
APPEND it_bapicomrem.
it_bapicomrem_x-comm_type = 'I'.
it_bapicomrem_x-langu = 'I'.
it_bapicomrem_x-comm_notes = 'I'.
it_bapicomrem_x-updateflag = 'I'.
APPEND it_bapicomrem_x.
ENDIF.
IF it_main-res_phone2 IS NOT INITIAL. " Residence Telephone2
w_bp_tel-telephone = it_main-res_phone2.
APPEND w_bp_tel TO it_bp_tel.
it_tel_x-telephone = 'I'.
it_tel_x-updateflag = 'I'.
APPEND:it_tel_x.
CLEAR:it_tel_x.
CLEAR : w_bp_tel-telephone.
it_bapicomrem-comm_type = 'TEL'.
it_bapicomrem-langu = 'EN'.
it_bapicomrem-comm_notes = 'RESIDECE PHONE2'.
APPEND it_bapicomrem.
it_bapicomrem_x-comm_type = 'I'.
it_bapicomrem_x-langu = 'I'.
it_bapicomrem_x-comm_notes = 'I'.
it_bapicomrem_x-updateflag = 'I'.
APPEND it_bapicomrem_x.
ENDIF.
IF it_main-mobile IS NOT INITIAL. " Mobile Number
w_bp_tel-r_3_user = '3'.
w_bp_tel-telephone = it_main-mobile.
APPEND w_bp_tel TO it_bp_tel.
it_tel_x-telephone = 'I'.
it_tel_x-updateflag = 'I'.
APPEND:it_tel_x.
CLEAR:it_tel_x.
CLEAR : w_bp_tel-r_3_user, w_bp_tel-telephone.
ENDIF.
IF it_main-email IS NOT INITIAL.
LOOP AT it_bp_email1.
it_bp_email-consnumber = it_bp_email1-consnumber.
it_email_x-updateflag = 'D'.
APPEND:it_bp_email,
it_email_x.
ENDLOOP.
it_bp_email-e_mail = it_main-email.
it_email_x-e_mail = 'I'.
it_email_x-updateflag = 'I'.
APPEND:it_bp_email,
it_email_x.
CLEAR:it_bp_email,
it_email_x.
ENDIF.
REFRESH:it_bp_ret.
BP Change
CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
EXPORTING
businesspartner = v_bp
addressdata = w_address
addressdata_x = w_addr_x
TABLES
bapiadtel = it_bp_tel
bapicomrem = it_bapicomrem
bapiadtel_x = it_tel_x
bapiadsmtp = it_bp_email
bapiadsmt_x = it_email_x
bapicomre_x = it_bapicomrem_x
return = it_bp_ret.
READ TABLE it_bp_ret WITH KEY type = 'E'.
IF sy-subrc = 0.
flag_addr = 'E'.
g_bp_msg1 = it_bp_ret-message.
ELSE.
flag_suc = 'X'.
ENDIF.
PERFORM transaction_commit.
REFRESH it_bp_ret.
IF it_main-pan_no IS NOT INITIAL OR it_main-fam_tag IS NOT INITIAL OR it_main-cust_id IS NOT INITIAL.
Retreiving the existing Identification details
PERFORM id_get USING v_bp.
ENDIF.
PAN number addition
IF it_main-pan_no IS NOT INITIAL.
CLEAR l_identification.
MOVE it_main-pan_no TO l_identification.
TRANSLATE l_identification TO UPPER CASE.
READ TABLE i_id_tab WITH KEY identificationtype = c_pan.
IF sy-subrc = 0.
To remove existing PAN number
PERFORM id_remove USING v_bp c_pan i_id_tab-identificationnumber.
READ TABLE it_iden_ret INTO wa_iden_ret WITH KEY type = 'E'.
IF sy-subrc EQ 0.
it_iden_flag = 'E'.
ELSE.
flag_suc = 'X'.
Performing transaction commit
PERFORM transaction_commit.
ENDIF.
ENDIF.
CLEAR:it_iden_ret[],it_iden_ret.
To add new PAN number
PERFORM id_add USING v_bp c_pan l_identification.
READ TABLE it_iden_ret INTO wa_iden_ret WITH KEY type = 'E'.
IF sy-subrc EQ 0.
it_iden_flag = 'E'.
ELSE.
flag_suc = 'X'.
PERFORM transaction_commit.
ENDIF.
ENDIF.
Customer ID addition
IF it_main-cust_id IS NOT INITIAL AND ( g_dup_status = 1 ).
CLEAR l_identification.
MOVE it_main-cust_id TO l_identification.
TRANSLATE l_identification TO UPPER CASE.
READ TABLE i_id_tab WITH KEY identificationtype = c_cust.
IF sy-subrc = 0.
To remove existing Customer ID
PERFORM id_remove USING v_bp c_cust i_id_tab-identificationnumber.
READ TABLE it_iden_ret INTO wa_iden_ret WITH KEY type = 'E'.
IF sy-subrc EQ 0.
it_iden_flag = 'E'.
ELSE.
Performing transaction commit
PERFORM transaction_commit.
ENDIF.
ENDIF.
CLEAR:it_iden_ret[],it_iden_ret.
To add new Customer ID number
PERFORM id_add USING v_bp c_cust l_identification.
READ TABLE it_iden_ret INTO wa_iden_ret WITH KEY type = 'E'.
IF sy-subrc EQ 0.
it_iden_flag = 'E'.
ELSE.
flag_suc ='X'.
PERFORM transaction_commit.
ENDIF.
ENDIF.
To add marketing attributes
IF it_main-insti_tag IS NOT INITIAL AND it_main-lob IS NOT INITIAL.
PERFORM add_makt_attr .
ELSE.
it_attr_flag = 'E'.Guy,i don't regard here is anybody wanna read so much code .For more constructive answers, you would distill core question from your program.
-
Error message when using FM 'BAPI_BUPA_ADDRESS_CHANGE'.
I'm continually getting an error message when using FM 'BAPI_BUPA_ADDRESS_CHANGE'. The message being 'Table BAPIADTEL entry to be changed not found in target system'.
I have looked up this message but all links seem to refer to FM 'BAPI_BUPA_CENTRAL_CHANGE', which I'm not using, and has different parameter settings.
I'm simply trying to update the telephone number and I'm updating strcuture BAPIADTEL and BAPIADTELX but still the message appears. I know that there is a really simple reason for this, but I have been double-checking everything and experimenting with lots of different areas, but with no effect.
Has anyone encountered this problem using the specific FM ''BAPI_BUPA_ADDRESS_CHANGE' ?.
JasonHi Jason,
In case your database tables had already value for field telephone number, then only the flag should be "U".
If the telephone number field was empty, and we will try to change it by using the flag as U, it wont work. In this case, we should be using "I".
I even wrote that before in this post, but somehow I guess the post was locked, and a lot of comments from you and me were not visible apart from the first two. So, I couldnt get any update from you.
Anyway, its good that its working for you. Thank you for the update.
Regards,
Susanta -
BDC recording in transaction BP
Hi,
I am creating a program which needs to update vendors using transaction BP. I am using BDC for this. However, I noticed that the screen of this transaction is dependent on the previous mode done (display or change). To give an example, in transaction BP, we need to click change/display. In the BDC, the ok_code for change/display is always passed. So, when vendor1 is processed with change, the next vendor will switch to display since the ok_code is called. Is there a way to be independent of the previous mode?
Thanks!Hello,
You shouldnt use BDC for this bu use BAPI - BAPI_BUPA_CENTRAL_CHANGE.
You can look into the Business object BUS1006 and get the list of BAPIs available for business partner. Most of the BAPI have name BAPIBUPA.
Rgds,
Prasanna -
Update address-independent telehpone of BP
Hi all,
We need to change address-independent telephone numbers of business partner.
When such record already exists (telephone numbers are maintained), this can be done using function module 'BAPI_BUPA_CENTRAL_CHANGE' with TELEFONDATANONADDRESS.
However, when address-independent telephone record does not exist (all telephone numbers are empty) - BAPI return warning 'BAPIADTEL was not found' and BP is not updated.
We have found out that address-dependent data is updated with two separate functions: 'BAPI_BUPA_ADDRESS_ADD' and 'BAPI_BUPA_ADDRESS_CHANGE', but we have not been able to find out similar ADD function for address-independent records.
Does anyone know how to update address-independent records (telephone, in this case) via ADD method?Hi Ujwal,
I dont have a ready code right now.
Firstly, the module BUPA_CENTRAL_GET_DETAIL can be used to get all the details of the address independent communications.
Later for delete:
BUPA_CENTRAL_CHANGE : For example say telephone data has to be filled.
The corrsponding cons number has to be filled in 'IT_ADTEL_ADDR_IND' and the corresponding flag set in IT_ADTEL_ADDR_IND_X and also the update flag should be set to 'D'. In this way the telephone number can be deleted.
For restricitng the validity, the corresponding valid from and valid to fields can be updated accordingly in the same way.
Regards,
Sudheer. -
CRM BP Create/BADI/FM???
Hi,
When I am creating a BP via CRM SAP GUI, then based on a certain business partner type I need to go to a Z table and populate Legal Entity field on the Identification tab. Once I put in the BP Type, i need to use a BADI that would take this BP type and query my Z-table and populate the Legal Entity field automatically based on a value from the Z-table. Can someone help me with which BADI I need to use and/or which FM I need to call from a BADI. It is working in change mode.
For now,
I am using BADI:BUPA_ADDR_UPDATE~Change_before_update.
It works fine in the change mode when I call FM: 'BAPI_BUPA_CENTRAL_CHANGE' from inside this BADI.
It is the create that is not working for me.I have tried many other FMs, but no luck. Can someone please help.
Thanks
ShahidThank you very much for the reaply. Here is my scenario....Business Partners will be created through EDI as well as through Portal. We have seperated the common development objects from the two and will put them in via BADIs. Could the BDT approach work in this scneraio? I have never used BDT so I am not aware of how. The second aproach that Kiran mentioned here is to use the BADI and a *collect FM. I am going to go with this approach for now. Unless you guys point out that BDT approach will be better.
For the BADI: BUPA_OUTBOUND_IDENT , I did not find it in our CRM system. I was however able to find BADI: BUPA_IDENT_UPDATE. Is this what you meant?This only has the BP GUID as a paramter. Kiran, can you please specify which FMs I need to use to get the partner data from the GUID and the nwhich *collect FM i need to use to update the BUT000-legal_org field with data from my Z-table. My guess is that you meant BUP_BUPA_BUT000_COLLECT. If this is what you meant, then can you please help me on how I can pupulate the parameters. Any sample will help.
Thanks -
How to handle Custom field added in BP : Role Bill Account
Hi Friends,
I am working on an interface which creates Bill Account role for a BP but the problem is there are about 15 Custom fields added to standard BP transaction in BA role.
As I am using BAPI_BUPA_FS_CREATE_FROM_DATA2 for creating the BP and
BAPI_BUPA_CENTRAL_CHANGE for changing the BP role Bill Account?
Can anyone tell me how to handle those custom fields in the existing BAPIs or there is some other way of doing it?
Thanks in advance,
Pradeep
Note : Helpful answers will be rewarded.Hi,
I have seen these BAPIs but are they used with normal BAPIs for BP creation and change.
For example : I create the BP using BAPI_BUPA_FS_CREATE_FROM_DATA2 and for the Custom fields I should use these BAPIs as suggested by you alongwith the create BAPI.
And will it work for Changing the BP also.
Kindly clarify.
Regards,
Pradeep
Maybe you are looking for
-
VALUE IN PO HISTORY OF SERVICE ENTRY SHEET EXIST EVEN AFTER DELETION OF SES
Respected All, My client has prepared a down payment request , prepared a service purchase order against that vendor, created service entry sheet. Later on he came to know that the qty he has entered is wrong ,so he reversed all the goods receipt(do
-
How to do Cancel Inv. Ver. document using MR8M for Back Dated Posting
Dear All, Need your input for configuring MR8M to cancel the back dated posting.
-
Time origin of "Global Start Time" in Output Node of Time Loop
Hi All, Please, do you know how the time returned by Global Time Start (after converting in milliseconds) in the Output Node of a Timed Loop is related to the time returned by "Tick Count (ms)" (if the latter is read at the very start of the loop)? T
-
Unable to set send-as permissions because of hundrets of duplicate permissions
hello, we are unable to set send-as permissons to mailboxes where more than 10 users already habe send-as permissions. when i use get-adpermission -identity "mailbox_abc" i get 4309 lines with permissions. But most are duplicates. every permission is
-
Shpuld I leave time machine on all the time?
I have time machine on all the time. My concern is backing up every hour seems excessive, and I wonder if turning it off and only on once a week is better. Furthermore, my LaCie external hard drive is annoyingly noisy.