Creating a target group based on the BP email address only in CRM

Hi there,
I am currently trying to create a target group based on the business partner email address only.
I have a list of over 1000 email addresses - these email addresses equate to a BP in our CRM system, however I do not have a list of the equivalent business partner numbers, all I have to work on are the email addresses.  With these 1000 BP email addresses I need to update the marketing attributes of each of these 1000 BP records in CRM.
What I need is a method to find the 1000 BP numbers based on the email addresses and then use the marketing expert tool (tx. CRMD_MKT_TOOLS) to change the marketing attributes on all of the 1000 BPs.
The issue I am having is how can I find the list of BP numbers just based on the BP email address, I tried creating an infoset based on table BUT000, BUT020 and ADR6 but I after creating attribute list & data source for this I am stuck on what to do next. In the attribute list the selection criteria does not allow me to import a file for the selection range.  I can only enter a value but I have 1000 email addresses and cannot possibly email them manually in the filter for the attribute list.   I also looked at imported a file into the target group but I do not have any BP numbers so this will not work.
Does anyone know a method where I can create a target group based on the email addresses only without having to do any code?
Any help would be most appreciated.
Kind regard
JoJo

Hi JoJo ,
The below report will return you BP GUID from emails that is stored in a single column .xls file and assign the BP to a target group.
REPORT  zexcel.
* G L O B A L D A T A D E C L A R A T I O N
TYPE-POOLS : ole2.
TYPES : BEGIN OF typ_xl_line,
email TYPE ad_smtpadr,
END OF typ_xl_line.
TYPES : typ_xl_tab TYPE TABLE OF typ_xl_line.
DATA : t_data TYPE typ_xl_tab,
       lt_bu_guid TYPE TABLE OF bu_partner_guid,
       ls_bu_guid TYPE  bu_partner_guid,
       lt_guids TYPE TABLE OF bapi1185_bp,
       ls_guids TYPE  bapi1185_bp,
       lt_return TYPE bapiret2_t.
* S E L E C T I O N S C R E E N L A Y O U T
PARAMETERS : p_xfile TYPE localfile,
              p_tgguid TYPE bapi1185_key .
* E V E N T - A T S E L E C T I O N S C R E E N
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_xfile.
   CALL FUNCTION 'WS_FILENAME_GET'
     IMPORTING
       filename         = p_xfile
     EXCEPTIONS
       inv_winsys       = 1
       no_batch         = 2
       selection_cancel = 3
       selection_error  = 4
       OTHERS           = 5.
   IF sy-subrc <> 0.
     CLEAR p_xfile.
   ENDIF.
* E V E N T - S T A R T O F S E L E C T I O N
START-OF-SELECTION.
* Get data from Excel File
   PERFORM sub_import_from_excel USING p_xfile
   CHANGING t_data.
   SELECT but000~partner_guid FROM but000 INNER JOIN but020 ON
but000~partner =
   but020~partner
     INNER JOIN adr6 ON but020~addrnumber = adr6~addrnumber INTO TABLE
lt_bu_guid FOR ALL ENTRIES IN t_data WHERE adr6~smtp_addr =
t_data-email.
   CLEAR: lt_guids,ls_guids.
   LOOP AT lt_bu_guid INTO ls_bu_guid.
     ls_guids-bupartnerguid = ls_bu_guid.
     APPEND ls_guids TO lt_guids.
   ENDLOOP.
   CALL FUNCTION 'BAPI_TARGETGROUP_ADD_BP'
     EXPORTING
       targetgroupguid = p_tgguid
     TABLES
       return          = lt_return
       businesspartner = lt_guids.
*&      Form  SUB_IMPORT_FROM_EXCEL
*       text
*      -->U_FILE     text
*      -->C_DATA     text
FORM sub_import_from_excel USING u_file TYPE localfile
CHANGING c_data TYPE typ_xl_tab.
   CONSTANTS : const_max_row TYPE sy-index VALUE '65536'.
   DATA : l_dummy TYPE typ_xl_line,
          cnt_cols TYPE i.
   DATA : h_excel TYPE ole2_object,
          h_wrkbk TYPE ole2_object,
          h_cell TYPE ole2_object.
   DATA : l_row TYPE sy-index,
          l_col TYPE sy-index,
          l_value TYPE string.
   FIELD-SYMBOLS : <fs_dummy> TYPE ANY.
* Count the number of columns in the internal table.
   DO.
     ASSIGN COMPONENT sy-index OF STRUCTURE l_dummy TO <fs_dummy>.
     IF sy-subrc EQ 0.
       cnt_cols = sy-index.
     ELSE.
       EXIT.
     ENDIF.
   ENDDO.
* Create Excel Application.
   CREATE OBJECT h_excel 'Excel.Application'.
   CHECK sy-subrc EQ 0.
* Get the Workbook object.
   CALL METHOD OF h_excel 'Workbooks' = h_wrkbk.
   CHECK sy-subrc EQ 0.
* Open the Workbook specified in the filepath.
   CALL METHOD OF h_wrkbk 'Open' EXPORTING #1 = u_file.
   CHECK sy-subrc EQ 0.
* For all the rows - Max upto 65536.
   DO const_max_row TIMES.
     CLEAR l_dummy.
     l_row = l_row + 1.
* For all columns in the Internal table.
     CLEAR l_col.
     DO cnt_cols TIMES.
       l_col = l_col + 1.
* Get the corresponding Cell Object.
       CALL METHOD OF h_excel 'Cells' = h_cell
         EXPORTING #1 = l_row
         #2 = l_col.
       CHECK sy-subrc EQ 0.
* Get the value of the Cell.
       CLEAR l_value.
       GET PROPERTY OF h_cell 'Value' = l_value.
       CHECK sy-subrc EQ 0.
* Value Assigned ? pass to internal table.
       CHECK NOT l_value IS INITIAL.
       ASSIGN COMPONENT l_col OF STRUCTURE l_dummy TO <fs_dummy>.
       <fs_dummy> = l_value.
     ENDDO.
* Check if we have the Work Area populated.
     IF NOT l_dummy IS INITIAL.
       APPEND l_dummy TO c_data.
     ELSE.
       EXIT.
     ENDIF.
   ENDDO.
* Now Free all handles.
   FREE OBJECT h_cell.
   FREE OBJECT h_wrkbk.
   FREE OBJECT h_excel.
ENDFORM. " SUB_IMPORT_FROM_EXCEL
Just copy paste the code and run the report select any local xls file with emails and pass the target group guid.
snap shot of excel file:
Let me know if it was useful.

Similar Messages

  • Can i create additional apple id's using the same email address for using multiple products with iCloud?

    can i create additional apple id's using the same email address for using multiple products with iCloud?

    Hi Anne,
    I'm pretty sure different eMail addies are needed for different Apple IDs.

  • Where does the "Submit Form" button get created and how can I change the associated email address?

    I've created a pdf form using Adobe Live Cycle ES 8.2 and it has been working fine.  Now I need to change the email address it gets sent to when the user clicks on the "Submit Form" button.
    How can I change this email address?
    Thank you in advance

    Yes, that is correct.
    I did not manually add this button, so I am assuming it was somehow automatically created.
    It worked great up until now that I need to change the "To:" email address.
    I've look through the XML code associated this this email address and changed it every where I could find it, but it still hasn't changed my results.  So, I have no idea how to change this and as stated above, if I create a new form it automatically sets it up to be sent to the wrong email address.  Not sure why or how to change it?
    Let me know if you need further info to help me out.
    Thanks again

  • Send emails from a csv file (grouping records with the same email addresses)

    Writing a script to send emails from a csv which contains record details and email addresses using the Send-Mailmessage cmdlet.
    That part is no trouble, however, the csv file contain records that can have the same email address.
    Is there a way/method I could send the records with the same email address once instead of sending individual email messages?
    Thanks
    Data in the csv file
    Record number, description, email
    1234, Test 1, [email protected]
    5678, Test 2, [email protected]
    1245, Test 3, [email protected]
    4578, Test 4, [email protected]
    $data = Import-csv c:\records.csv
    ForEach($address in $data)
    Send-mailmessage -To $address.emails -from [email protected] -subject "List of records" -Body $data -SmtpServer 192.168.1.1

    The following code does what you are looking for:
    $data = Import-csv c:\records.csv$mx = "192.168.1.1"
    $subject = "List of records"
    $from = "[email protected]"
    $data| Group-Object email|Select-Object Name, @{n='msg'; e={$_.Group| Select-Object -Property "record number", description|ConvertTo-Csv -notypeinformation|Out-String}}|
    ForEach-Object {Send-MailMessage -to $_.Name -Body $_.msg -SmtpServer $mx -Subject $subject -From $from}
    I also recommend no forcing everything into one line.  "One-liner" means "one pipeline" not putting all code on one unreadable line.
    Your code should look like this:
    $data|
    Group-Object email|
    Select-Object Name, @{
    n='msg'; e={
    $_.Group| Select-Object -Property "record number", description|
    ConvertTo-Csv -notypeinformation|Out-String
    }|
    ForEach-Object {
    Send-MailMessage -to $_.Name -Body $_.msg -SmtpServer $mx -Subject $subject -From $from
    Now we can see the code and see that you are still unnecessarily converting back and forth.
    To get the group look at how I did it.
    $body=$_.Group | Format-Table |Out-String
    Isn't that much easier?
    Once you master the pipeline these things will become second nature.  In PowerShell it is not necessary to write lots of code most of the time.
    ¯\_(ツ)_/¯

  • SCOM 2012 - Is there a way to create a class/target/group based on the presence of a folder?

    I need to create monitor(s) for an application, but the application services are different on all the servers.  Usually I would find a application service that is common among all the servers I want to monitor to create the target,
    but this does not exist.  There are no common services for this application. However, every server does have a common folder in the Program Files on the C: drive (i.e. "xyz" folder exist on every server for the application). 
    Is there a way to create a target based on a folder in the Programs Folder?

    Please refer to the following, which is quite exactly fit your requirement.
    http://msdn.microsoft.com/en-us/library/bb437613.aspx
    Roger

  • How can I setup auto bcc function based on the sender email address or name in iplant 5.1 and netscape 4.15 sp7 ? If use channel, how can I do so ? thx ..

     

    Doing such a thing in either 4.15 or 5.2 would require some custom code to be written. For 4.15 you would need a smtp plug in, for 5.2 you would need a custom channel.
    Sorry, there is no easy way to do that. But, what is the purpose of this, there might be a better solution.

  • How can I setup auto bcc function based on the sender email address or name in iplant 5.1 and netscape 4.15 sp7 ?

    I am using netscape 4.15 sp7 on linux and iplanet 5.1 on solaris 8 .. I want to setup a filter or something in the server so that when users sent out email. the server will automatically bcc one copy to one particlar account.

    I have a similar request to do bcc mail forwarding on Sun Java System Messaging Server 6.3-6.03 . Is it possible to provide step by step process of how to get the customized channel setup to bcc all mail traffic?
    Thanks

  • Dynamically creating a Record Group based on Previously entered Record Grou

    Forms [32 Bit] Version 10.1.2.3.0 (Production)
    Hi,
    I know how to dynamically create a record group based on a query and putting the code in When new form instance.
    My query is. I have a form which has multiple Record Groups and the user wants to dynamically create subsequent groups based on previous groups.
    For example
    I have a record group with selects a Location,
    when the user selects the Location from a list of values
    the 2nd record group called 'Cost Centres' will have to filter out only those with the locations selected above.
    How can I populate the 2nd record group at run-time when I do not know what site the user will select?
    If I simply populate in when new form instance as in location and just select everything, the list of values populates.
    CC field is a LIST ITEM and the list style is a POP LIST, it is not required.
    I have put the code in the Location field in the when-list-changed trigger.
    I am getting this error:
    frm-41337: cannot populate the list from the record group
    here is the code:
    DECLARE
    v_recsql Varchar2(1000); -- The SQL for creating the Record Group.
    v_recgrp RecordGroup; -- Record Group
    v_status Number; -- Return Value of Populate_Group function.
    c_where VARCHAR2(1000);
    BEGIN
         IF :location = '1' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''02'')';
         ELSIF :location  = '2' THEN
              c_where := ' substr(cost_centre,1,2) in (''02'',''03'')';
         ELSIF :location   = '3' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''11'',''07'')';
                   ELSE
              c_where :=  ' 1=1'; --EVERYTHING
         END IF;
    v_recsql := 'SELECT cost_centre, description  FROM   cost_centres  where '||c_where;
    -- Create the Record Group
    v_recgrp := CREATE_GROUP_FROM_QUERY('v_recgrp', v_recsql);
    IF NOT ID_NULL(v_recgrp)
    THEN -- No Error, record group has been successfully created.
    -- Populate Record Group
    v_status := POPULATE_GROUP('v_recgrp');
    IF v_status = 0
    THEN -- No Error. Record Group has been Populated.
    POPULATE_LIST('block.CC', 'v_recgrp');
    END IF; -- IF v_status = 0
    -- Delete the Record Group as it is no longer needed.
    DELETE_GROUP('v_recgrp');
    END IF; -- IF NOT ID_NULL(v_recgrp)
    END;thanks for your assistance.

    Hi,
    Once record status gets change for block you can not populate/repopulate the list item. Keep those list items as non-database item with different names and create different items as database orignal items. Than assign the values in WHEN-LIST-CHANGE trigger to the actual database items.
    -Ammad

  • TCODE / Menupath for creating a target group

    Hi All,
    What is the transaction code/menupath to create a target group of business partners?
    How to create a target group of the selected business partners using that tcode/menupath?
    Please let me know.
    Thanks in advance.
    --R D

    Hi RD,
    Transaction code:CRMD_MKTSEG
    Menu Path: SAP Menu->marketing>segementation->marketingsegments--->segment bulider
    SAP Help link: <b>http://help.sap.com/saphelp_crm40sr1/helpdata/en/db/58963eac416f01e10000000a114084/frameset.htm</b>
    Regards,
    Arjun
    <b>Don't Forget Rewards points if it helps</b>
    Message was edited by:
            Arjun Pawar

  • Web GUI new feature - creating a new record based on the current record

    Vincent,
    We need new feature in Web GUI:
    creating a new record based on the current record with data
    from Moscow with money

    It is already enabled, in the next release.
    If you joint TAB program, the march preview build contains it. User can select 1 or multiple users and make a copy.

  • I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    I created my Apple ID in Ireland, but would now like to switch to a German Apple ID, keeping the same email address. How do I delete my old Irish Apple ID, so I can create a new German one with the same email?

    Welcome to the Apple Community.
    Click on your account name in the top right corner of the iTunes store in the iTunes application on your computer, enter your password and click the "view account" button. Navigate to the Apple ID summary where you have the option to "change country or region".
    In order to change your location, you will need a credit card registered to an address in the location you are trying to change to.
    You cannot change your location if you have credit on your account, if you are unable to spend your credit and leave a balance of zero, contact Apple, which you can do through iTunes Store Support.

  • Value based on the periodic unit price (only with pr.ctrl S)

    Dear all,
    There is this field in mateial master called "Value based on the periodic unit price (only with pr.ctrl S)" in accounting view 1,
    1 - May I know what is this field about (in between our company using material ledger).
    2 - May I know why the value of this field are different between our company period 6 and period 7 for this year? what contribute to it? and is it something wrong with different value between two different period or absolutely normal?
    Thanks.
    Tuff

    Dear all,
    Does anyone know my question?
    Thanks,
    tuff

  • Value based on the periodic unit price(only with pr.ctrl S) field in MatMas

    Dear all,
    There is this field in mateial master called "Value based on the periodic unit price (only with pr.ctrl S)" in accounting view 1,
    1 - May I know what is this field about (in between our company using material ledger).
    2 - May I know why the value of this field are different between our company period 6 and period 7 for this year? what contribute to it? and is it something wrong with different value between two different period or absolutely normal?
    Thanks.
    Tuff

    Hi Tuffy,
    For your 1st query:
    PUP field in Accounting 1 (if ML is active, Price Determination indicator=3) is the result of Actual Costing Run (CKMLCP) closing entry.
    For your 2nd query:
    In most of the cases the values will be different in Previous Period and Current Period. e.g.Period 6 values are the results of Actual Costing Run (CKMLCP) in 1st week of Period 6 for Previous Period (i.e. Period 5). Period 7 values are the results of Actual Costing Run (CKMLCP) in 1st week of Period 7 for Previous Period (i.e. Period 6).
    The reason for the different values: Price differences, Exchange rate differences, Price/Exchange rate differences from Low lower materials, etc.
    Thanks & Regards,
    ADI

  • Value based on the periodic unit price (only with pr.ctrl S) field in mat.

    Dear all,
    There is this field in mateial master called "Value based on the periodic unit price (only with pr.ctrl S)" in accounting view 1,
    1 - May I know what is this field about (in between our company using material ledger).
    2 - May I know why the value of this field are different between our company period 6 and period 7 for this year? what contribute to it? and is it something wrong with different value between two different period or absolutely normal?
    Thanks.
    Tuff

    Hi Tuffy,
    For your 1st query:
    PUP field in Accounting 1 (if ML is active, Price Determination indicator=3) is the result of Actual Costing Run (CKMLCP) closing entry.
    For your 2nd query:
    In most of the cases the values will be different in Previous Period and Current Period. e.g.Period 6 values are the results of Actual Costing Run (CKMLCP) in 1st week of Period 6 for Previous Period (i.e. Period 5). Period 7 values are the results of Actual Costing Run (CKMLCP) in 1st week of Period 7 for Previous Period (i.e. Period 6).
    The reason for the different values: Price differences, Exchange rate differences, Price/Exchange rate differences from Low lower materials, etc.
    Thanks & Regards,
    ADI

  • Sending email to the work email address of a group in AddressBook

    Is it possible to send an email to a group of users but only to the work email addresses of those users ? Some users have multiple email address (work, home,...) but I don't find any info or logic how Mail is selecting an address from the AddressBook.

    Hi,
    In the new message window, click on the address book tab. In the address book window select the group and then select one person in that group (on the right side of the window). Now press (Apple+a) to select all the people in that group. Now click on the "To", "Cc" or "Bcc" tab as you like.
    By default the selection of email address depends on the way a vCard is formatted in address book. (Look at the Address Book preferences. If the work email address is chosen first in the preferences, then pressing (Apple +a) would select the work emails of that group.

Maybe you are looking for