SAP CRM Waiting Queues

If you ever run into an issue where you suddenly have a humungous inbound queue on CRM which does not want to process(in my case after a mass upload program ran), this is the post for you.

So SMQ2 takes a bit of time to run and you have a few entries in your inbound queue…

And you can’t start them because they are all waiting for each other…

And the Queue In Scheduler is just waiting….

The problem is all these entries are waiting on each other and it is impossible to find the one entry every inbound queue entry is waiting for. The answer is to write a program which searches for the entry that all the other queues are waiting for and starts those…

Here is the solution…

report zqueue_restart.


parameters: p_test type flag default 'X'.

data: lt_orgtid type table of rfcchar24,
      lv_orgtid type rfcchar24,
      lv_arfc   type arfctid,
      lv_qname  type trfcqnam.

field-symbols: <orgtid> type rfcchar24.


start-of-selection.

  select distinct orgtid into table lt_orgtid
    from trfcqin.

  loop at lt_orgtid assigning <orgtid>.
    lv_arfc = <orgtid>.
    select single orgtid qname into (lv_orgtid, lv_qname)
      from trfcqin
      where arfcipid = lv_arfc-arfcipid
        and arfcpid  = lv_arfc-arfcpid
        and arfctime = lv_arfc-arfctime
        and arfctidcnt = lv_arfc-arfctidcnt.
    if sy-subrc = 0 and lv_arfc = lv_orgtid.

      call function 'TRFC_QIN_EXECUTE_CHECK_LUW'
        exporting
          tid                      = lv_arfc
*         ORGTID                   =
*              IMPORTING
*         DO_NOT_EXECUTE_LUW       =
        exceptions
          notid                    = 1
          luw_no_qin_luw           = 2
          qe_stop_selected         = 3
          qe_stop_generic_selected = 4
          qe_restart_selected      = 5
          qs_registered_queue      = 6
          qs_modify                = 7
          qe_stop                  = 8
          qe_restart               = 9
          qe_predecessor           = 10
          qe_gen_stop              = 11
          qe_single_stop           = 12
          qe_gen_restart           = 13
          others                   = 14.
      if sy-subrc = 0.
        if p_test = 'X'.
          write: / lv_qname, 'will be started'.
        else.
          call function 'TRFC_QIN_EXECUTE'
            exporting
              tid                  = lv_arfc
*            IMPORTING
*             ASTATE               =
            exceptions
              not_found            = 1
              system_failed        = 2
              communication_failed = 3
              others               = 4.
          if sy-subrc = 0.
            write: / lv_qname, 'was started'.
            commit work.
          else.
            write: / 'Error:', sy-subrc, lv_orgtid, lv_qname, sy-msgid, sy-msgno.
          endif.
        endif.
      else.
       write: / 'Error:', sy-subrc, lv_orgtid, lv_qname.
      endif.
    endif.

  endloop.




Advertisements
Posted in ABAP Code, Middleware, SAP CRM | Leave a comment

AL11 Problem

Today I learnt that you cannot display a file in AL11 if the first 4 characters of the name are ‘core’.  Sometimes we run into strange problems….

Capture

Posted in General | Leave a comment

Various quick tips

I am turning this blog into into my quick reference guide of useful commands and tricks pretty much for my own use.

Storing your git credentials(source: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage)

git config --global credential.helper 'store --file ~/.git-credentials'

Copying SSH keys to remote machine(source: https://askubuntu.com/questions/4830/easiest-way-to-copy-ssh-keys-to-another-machine)

cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'umask 0077; mkdir -p .ssh; cat >> .ssh/authorized_keys && echo "Key copied"'

Make a Hana Password not expire

ALTER USER <USER> DISABLE PASSWORD LIFETIME;

Find the HANA PORT & SQL Port

SELECT * FROM SYS_DATABASES.M_SERVICES;
Posted in Basis, HANA, Linux | Leave a comment

Change Win10 Network Zone

Copied from here for quick reference:  https://www.itechtics.com/change-network-type-windows-10/

3- Change network type using Local Security Policy

  1. Go to Run –> secpol.msc
  2. Select Network List Manager Policies. This will list all the networks in the right hand pane.
  3. Double click your desired network, go to Network Location tab.
  4. Change the Network location type to either Not configured, private or public.
  5. If you want to do this for all the connected networks, you can double click All Networks instead of your desired network.
    Security settings for setting up network type
Posted in General, Windows | Leave a comment

15 Years of SMS and SAP CRM still does not support it

This marks the 15th year of Democracy and Commercial Mobile Phone Networks in South Africa. It seems that SAP has been oblivious to the development of the mobile phone and the proliferation of the humble SMS as a means of communication with customers.

SAP CRM has been around for about 10 years now, and is marketed as a best of breed CRM solution. Why then is there no support for sending or receiving of SMS’s in the Interaction Centre?

Atleast they still support Letters…

Posted in Interaction Centre, SAP CRM | Tagged , , , | 3 Comments

Vendors in the Sales Document

I recently had a requirement were a vendor had to be replicated as partner function from a CRM Sales Order to an SD Sales Order.

At first I thought there wasn’t going to be any problem as it seems this is fully supported by customizing. The mapping between partner functions in ERP and CRM can be maintained respectively as shown below. In my case I wanted to replicate a Carrier(Partner function SP in German…it displays as CR in English). Also, note that partner function SP does not exist as standard in CRM so this needed to be created as a custom partner function ZR in CRM.

IMG: Customer Relationship Management -> Basic Functions -> Partner Processing -> Data Transfer -> Distribution of Partner Functions from SAP ECC into CRM

erp2crm

The above setting will cause partner function SP to be remapped to my new partner function ZR in CRM.

Next you must maintain the mapping from CRM, back to ERP. This table you must always maintain even if you only want to download partner functions as the download from ERP reads the upload table as well(…makes sense right?).

IMG: Customer Relationship Management -> Basic Functions -> Partner Processing -> Data Transfer -> Distribution of Partner Functions from CRM into SAP ECC

crm2erp

What is important to note is the last column which indicates that this is a vendor mapping, and you would think the system would take that into account when uploading/downloading the Sales Order.

Unfortunately this didn’t work, which then prompted a Notes Search which produced Note 1303575. The gist of the note is:

Symptom: Partners of the type “LI” are not supported in the CRM sales document.

Solution: There is none.

Now, lets recap a couple of things:

1. Vendors can be downloaded to CRM using Middleware as described in Note 883162.

2. BP Relationships for Vendors can be downloaded as per Note 975195.

3. Customizing indicates the partner function is a vendor, so why not just map to a vendor instead of a customer?

Lets just say I will reserve my opinion of on the above note.

Anyway the fix is relatively simple. You create an implementation of CRM_DATAEXCHG_BADI in SE19.

To upload the Vendor Partner Function to ERP implement the code below method crm_dataexch_after_bapi_fill.

crm-to-erp

Next to download the partner function implement the following code in method crm_dataexch_r3d_mbdoc_fill.

erp-to-crm

The text of the code is available here…hope it helps.

<-Updated 05.09.2009 – Corrected some errors in published code->

method if_ex_crm_dataexchg_badi~crm_dataexch_after_bapi_fill.field-symbols: <fs_parnr3> type bapiparnr3.data: lv_partner_guid      type bu_partner_guid,
lv_vendno            type crmt_bu_map_vendor_number.
**  make sure plant info is not return to ERP as a Partner
delete ct_bapiparnr3 where partn_role = ‘ZP’.read table ct_bapiparnr3 assigning <fs_parnr3>
with key partn_role = ‘SP’.
if sy-subrc = 0.
lv_partner_guid  = <fs_parnr3>-partn_guid.
select single vendor_no into lv_vendno
from crmm_but_vendno
where partner_guid = lv_partner_guid.
if sy-subrc = 0.
<fs_parnr3>-partn_numb = lv_vendno.
clear <fs_parnr3>-partn_guid.
endif.
endif.

endmethod.

Posted in ABAP Code, Middleware, Sales Documents, SAP CRM | 2 Comments

The Stapler Interface

Despite the multitude of options available for loading data into SAP, it seems the stapler still remains popular…

stapler

Posted in General, SAP | Tagged | 3 Comments