Tuesday, December 8, 2015

Problem: If invoice created with wrong price


Problem: If invoice created with wrong price that involved production order

STEPS TO FOLLOW

1.       VF11 Cancel customer invoice

2.       Reverse GI in VL09

3.       Delete the delivery in VL02N

4.       Unbook the production OR in MIGO (102 mov.)

5.       Set the MAP (Moving average price) in MR21 (same value as sum of components)

6.       Update the pricing in the sales OR (cost)

7.       Book the production OR in MIGO (101 mov.)

8.       Do GI again in VL02N

9.       Invoice both lines together in VF01 (online)

10.   Fix the code

11.   Fix the product setup procedure (master data)

12.   Reverse the chargeback CHBK document

Wednesday, December 2, 2015

SAP to Excel is slow

SAP provides the ability to export from Sap in Excel format. However this can be slow to export from Sap to Excel.
Try the following to see if this resolves the issue.
Google Drive \SAP documents\CMS\SAP to Excel slow.
 

Thursday, November 19, 2015

CRM WebUI - Change text in Custom filter

Problem: Change Text description for an element in drop down (in this example:  From ‘Does not equal’ to ‘not equal’ – as user displaying them in alphabetical order, and want ‘equal’ to come first in dropdown)
Transaction SE80 -> BSP Application crm_thtmlb_util:
Method get_possible_operators:
Transaction SOTR_EDIT:

Friday, November 13, 2015

CRM Product status Locked mapped to ECC status

BADI  ‘PRODUCT_CUSTOMER2’ is used in CRM to map material status between ECC and CRM

Status from Material master’s Basic data and Sales data flow to CRM.

SAP Note 497101  

Thursday, November 12, 2015

CRM - Clear buffer for BOL entity

To reset (clear) buffer for BOL entity – use below code.
For eg: This is used in Search on quotes, which was retrieving old data of quote just after save.

    DATA lr_core TYPE REF TO cl_crm_bol_core.
    lr_core 
cl_crm_bol_core=>get_instance( ).
    lr_core
->reset
( ).


Tuesday, October 20, 2015

Problem: Delivery print picking up user default printer - Not shipping point printer

Solution: Smartform function module should be called with blank ‘user_settings’.  By default, it is ‘X’, which means printer is taken from User default parameters.
 

Monday, October 19, 2015

Release Strategy

SPRO -> MM -> Purchasing -> Purchase Order -> Release Procedure for Purchase orders -> Define Release Procedure for PO -> Release strategy
 
 
CL20N tcode: - Set rule
 

SQ01 - SAP Queries / Infosets

Query Area:
 
Select ‘Standard area’ by going to ‘SQ01 - > Environment -> Query Area’
 
Infoset:
 
SQ01 tcode -> Environment -> Infoset
 
Add new field and you can write Field code  - Also you need to add (drag) field to Field group (on right hand side).
 
 
Save and Generate Infoset (Click Okay on warnings if any).
 
Query:
SQ01-> Environment -> Query
 
You can add to Selection screen (You need to select fields from field groups) – or Basic List.

Monday, October 12, 2015

Update content table in SE16N - Debug Edit

Transaction SE16N.
Put /H, press F8 and then change these variables to ‘X’:
 

 

Make a field editable in FBL5N (FB02)

To make a field editable in FBL5N (or FB02)
 
Transaction OB32
 
Click on new entries and add the field you want to make editable. See example.
 
 
Note: If the field is a header field then it is  not possible to limit the change to a particular account type e.g. Vendors, Customers.
The field will be editable for Vendors, Customers, GL Accounts.

 

Regenerate Web services after SAP upgrade

Symptom: Webservices weren’t working after SAP upgrade. They fail with error ‘Virtual Interface not found’.
Solution:
Below Link is quite useful:
SAP notes:  1903490  and 1847901
Program: WS_MANUAL_WEBI_AFTER_IMPORT
Follow below steps and issue will be resolved. (Step 2 is not always required)

1. Run Report Program - WS_MANUAL_WEBI_AFTER_IMPORT by selecting Single Service Definition and by clicking on "Force Generation" check box.
2. Run Report Program - WEBI_CHECK_REPAIR by selecting Single Service Defination to remove inconsistancy in web service.

After this two program run, the web service will be operational again.
To monitor and check the webservice calls, use SRT_UTIL tcode

Friday, October 9, 2015

Thursday, October 8, 2015

Vendor Invoice verification Accounting document gets block 'R'


System sets block 'R'

Check MRBR tcode for blocking reasons

This can be because of Tolerence limit.

https://scn.sap.com/thread/959107

https://help.sap.com/saphelp_46c/helpdata/en/2d/1a39516e36d1118b3f0060b03ca329/frameset.htm

https://scn.sap.com/thread/1531803

Payment block R can come for various reasons like delivery schedule,terms of payment,quality reasons etc.
Use
 
You can block an invoice manually. You have two options for doing this when you enter the invoice:
 
You can block an invoice by entering an R in the field Payment block in the document header data.
You can block an item by selecting the M (manual blocking reason) field in the item list. When you post the invoice, the system automatically sets an R in the field Payment block in the vendor line of the accounting document. Manually blocked items are given the blocking reason Manual block (M).
 
the best way to remove the block is to run MRBR transaction


Block can come from Payment terms / Vendor master.

Wednesday, October 7, 2015

FI Substitution rule activation program RGUGBR00

In case, your Substitution rule is not activated in Live after transport movement, you may need to activate ‘main program’.
 
To do that, run below program.
 
Program : RGUGBR00  - Tick all options except last 2 and run for ‘FI’ application area

 
SAP Note: 842318  explains in detail

842318  

Tuesday, September 29, 2015

CRM User status management

To create a user status profile, please go to T-cd: SPRO -> SAP Customizing Implementation Guide -> Customer Relationship Management -> Transactions -> Basic Settings -> Status Management -> Define Status Profile for User Status
 
 

 

Thursday, September 17, 2015

Tuesday, September 15, 2015

Wednesday, September 9, 2015

FB04 - FI Accounting document Change logs

FI Accounting document Change logs
 
Go to FB04 transaction.  Click on Environment -> Multiple display.  Follow as per screenshots below.  Please call me if you find any issues.  Thank you.
 
 
 
 
 
 

Tuesday, September 8, 2015

SLG1 Logging setup


First, we need to crete Object 'ZCMS' and then below code need to be put for Logging


REPORT  ZRKTEST11.
DATA: lc_log TYPE REF TO CL_EZLOG.

CREATE OBJECT LC_LOG
  EXPORTING
    MSGOBJECT = 'ZCMS'
    APPENDMODE = '1'
    INTERNAL = 'X'.

  CALL METHOD LC_LOG->ADDMSG
    EXPORTING
      MSGTY    = 'S'
      MSGID    = 'ZC'
      MSGNO    = '002'
      MSGV1    = 'Test by Rajesh'
      MSGV2    = '2nd var'
      MSGV3    = '3rd'      .

  CALL METHOD LC_LOG->SAVE
    EXCEPTIONS
      EMPTY       = 1
      FAILED      = 2
      others      = 3.
  IF SY-SUBRC <> 0.
  ENDIF.
  FREE lc_log.

USR41_MLD - Multiple Logins details for user

 
Table: USR41_MLD  -  You can see users who logged in multiple times simultaneously (by clicking second option given at Logon screen)
 
 
Table USR41 gives Terminal id details
 

 

Monday, September 7, 2015

Friday, September 4, 2015

CRM - Raise global message in Quote/Order

 Raise error in DO_VALIDATE_INPUT method as shown:
THIS WILL NOT BLOCK SAVING
To block saving use ORDER_SAVE BADI - method CHECK_BEFORE_SAVE

If there are error messages:
RAISE do_not_save.

SCMP - Compare table entries between systems (Dev, Live, QA)

SCMP (tcode) – To compare table entries between Dev and Live systems
 

 

Thursday, August 27, 2015

DO_PREPARE_OUTPUT - CRM Web UI example


Component/View:   BT125H_TASK/TaskDetails
Logic:

typed_context will contain all context nodes in view.


    DATAlr_btstatus        TYPE REF TO cl_crm_bol_entity,
          lr_btadminh        TYPE REF TO cl_crm_bol_entity.
    DATAlv_process_type    TYPE CRMT_PROCESS_TYPE_DB.



    TRY.
    lr_btadminh ?= me->typed_context->btadminh->collection_wrapper->get_current).
    lr_btadminh->get_property_as_value(
                                    EXPORTING iv_attr_name 'PROCESS_TYPE'
                                    IMPORTING ev_result    lv_process_type ).

    lr_btstatus ?= me->typed_context->btstatus->collection_wrapper->get_current).

*   For Attachment tasks (ZATC), set status to 'Completed'
    IF lv_process_type 'ZATC'.
      lr_btstatus->set_property(
        EXPORTING
          iv_attr_name =   'ACT_STATUS'
          iv_value     =    'E0003'
      ).

    ENDIF.
      CATCH cx_root.
   ENDTRY.

CRM WebUI Get related entities and Parent entities



If you need to get entities related (child entities), use GET_RELATED_ENTITY, GET_RELATED_ENTITIES methods

Using GET_RELATED_ENTITY:

    lr_erpadminh ?=   me->typed_context->erpadminh->collection_wrapper->get_current).
    CHECK  lr_erpadminh IS BOUND.
    lr_erpadminh->get_property_as_value(  EXPORTING   iv_attr_name =   'VBELN'
                                          IMPORTING   ev_result    =   lv_vbeln .

*    CHECK  lv_vbeln IS NOT INITIAL.
    TRY.
        CALL METHOD lr_erpadminh->get_related_entity
          EXPORTING
            iv_relation_name 'ERPHeaderCondSet'
*           iv_mode          = normal
          RECEIVING
            rv_result        lr_erpcondh.
      CATCH cx_crm_genil_model_error .
    ENDTRY.
    IF lr_erpcondh IS BOUND.
      TRY.
          CALL METHOD lr_erpcondh->get_related_entities
            EXPORTING
              iv_relation_name 'ERPCondHAll'
*             iv_child_name    =
*             iv_mode          = NORMAL
*             iv_owned_only    = ABAP_FALSE
            RECEIVING
              rv_result        lr_condcol.
        CATCH cx_crm_genil_model_error .
      ENDTRY.


      CLEAR  lr_iterator ls_condtype.
      lr_iterator   lr_condcol->get_iterator).

Full code link: http://sapist.blogspot.co.uk/2015/08/crm-web-ui-getrelatedentity.html


If you need parent entities, then use GET_PARENT method

Using GET_PARENT method:

    if iterator is bound.
      current iterator->get_current).
    else.
      current collection_wrapper->get_current).
    endif.

    lr_current ?= current.

    TRY.
      lr_bt_statush ?= lr_current->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.
      lr_bt_adminh ?= lr_bt_statush->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.

    lr_bt_adminh->get_property_as_value(  EXPORTING IV_ATTR_NAME 'PROCESS_TYPE'
                                            IMPORTING EV_RESULT lv_process  ).

      CATCH cx_root.
    ENDTRY.

Full code link: http://sapist.blogspot.co.uk/2015/08/crm-web-ui-getparent-method.html

CRM Web UI GET_PARENT method



If you need parent entities, then use GET_PARENT method

Using GET_PARENT method:

    DATAcurrent TYPE REF TO if_bol_bo_property_access.
    DATAdref    TYPE REF TO data.


    DATAlr_current    TYPE REF TO cl_crm_bol_entity,
          lr_bt_statush TYPE REF TO cl_crm_bol_entity,
          lr_bt_adminh  TYPE REF TO cl_crm_bol_entity.
    DATAlv_process TYPE CRMT_PROCESS_TYPE_DB.


    if iterator is bound.
      current iterator->get_current).
    else.
      current collection_wrapper->get_current).
    endif.

    lr_current ?= current.

    TRY.
      lr_bt_statush ?= lr_current->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.
      lr_bt_adminh ?= lr_bt_statush->get_parent).

      CATCH cx_crm_genil_model_error .
    ENDTRY.

    TRY.

    lr_bt_adminh->get_property_as_value(  EXPORTING IV_ATTR_NAME 'PROCESS_TYPE'
                                            IMPORTING EV_RESULT lv_process  ).

      CATCH cx_root.
    ENDTRY.

CRM Web UI GET_RELATED_ENTITY, GET_RELATED_ENTITIES methods




If you need to get entities related (child entities), use GET_RELATED_ENTITY, GET_RELATED_ENTITIES methods

Using GET_RELATED_ENTITY, GET_RELATED_ENTITIES :


    DATA  :  lr_erpadminh     TYPE REF TO cl_crm_bol_entity,
             lr_erpcondh     TYPE REF TO cl_crm_bol_entity,
             lr_condh     TYPE REF TO if_bol_bo_property_access,
             lr_condcol TYPE REF TO if_bol_entity_col,
             lr_iterator TYPE REF TO if_bol_entity_col_iterator,
             lr_rate     TYPE REF TO if_bol_bo_property_access,
             lv_vbeln TYPE string ,
             lv_cond_value TYPE kwert,
             lv_curr TYPE waerk.

    DATA  :  lv_changeable TYPE boolean.

    TYPESBEGIN OF ty_condtype,
              znet_gp TYPE kwert,
              znet_gp_p TYPE kbetr,
              zgp TYPE kwert,
              zgp_p TYPE kbetr,
              zfrc TYPE kwert,
              zd01 TYPE kwert,
              znet_gp_cur TYPE waerk,
              znet_gp_p_cur TYPE waerk,
              zgp_cur TYPE waerk,
              zgp_p_cur TYPE waerk,
              zfrc_cur TYPE waerk,
              zd01_cur TYPE waerk,
              zdel_route TYPE route,
              zccs TYPE kschl,
              zoppt_desp TYPE descr_40,
              zsam_descp TYPE descr_40,
          END OF ty_condtype.

    DATA ls_condtype TYPE ty_condtype.



    lr_erpadminh ?=   me->typed_context->erpadminh->collection_wrapper->get_current).
    CHECK  lr_erpadminh IS BOUND.
    lr_erpadminh->get_property_as_value(  EXPORTING   iv_attr_name =   'VBELN'
                                          IMPORTING   ev_result    =   lv_vbeln .

*    CHECK  lv_vbeln IS NOT INITIAL.
    TRY.
        CALL METHOD lr_erpadminh->get_related_entity
          EXPORTING
            iv_relation_name 'ERPHeaderCondSet'
*           iv_mode          = normal
          RECEIVING
            rv_result        lr_erpcondh.
      CATCH cx_crm_genil_model_error .
    ENDTRY.
    IF lr_erpcondh IS BOUND.
      TRY.
          CALL METHOD lr_erpcondh->get_related_entities
            EXPORTING
              iv_relation_name 'ERPCondHAll'
*             iv_child_name    =
*             iv_mode          = NORMAL
*             iv_owned_only    = ABAP_FALSE
            RECEIVING
              rv_result        lr_condcol.
        CATCH cx_crm_genil_model_error .
      ENDTRY.


      CLEAR  lr_iterator ls_condtype.
      lr_iterator   lr_condcol->get_iterator).

      IF lr_iterator IS BOUND.
*      Reading the Net gross profit values ..
        CLEAR lr_rate.
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL_T'
            iv_value     text-004  "'Net Gross Profit'(004)
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KWERT'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).

          ls_condtype-znet_gp lv_cond_value.
          ls_condtype-znet_gp_cur lv_curr.
        ENDIF.

*      Reading the Net Margin%  values ..
        CLEAR lr_rate ,lv_curr,  lv_cond_value.
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL_T'
            iv_value     text-005   "'Net Margin %'(005)
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KBETR'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).
          ls_condtype-znet_gp_p lv_cond_value.
          ls_condtype-znet_gp_p_cur lv_curr.
        ENDIF.
*      Reading the Gross Profit values ..
        CLEAR lr_rate ,lv_curr,  lv_cond_value.
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL_T'
            iv_value     text-003 " 'Gross Profit'
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KWERT'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).
          ls_condtype-zgp lv_cond_value.
          ls_condtype-zgp_cur lv_curr.
        ENDIF.
*      Reading the Margin% Values ..
        CLEAR lr_rate ,lv_curr,  lv_cond_value..
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL_T'
            iv_value     text-001   "'Margin %'(001)
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KBETR'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).
          ls_condtype-zgp_p lv_cond_value.
          ls_condtype-zgp_p_cur lv_curr.
        ENDIF.

*       Reading the ZFRC Values ..
        CLEAR lr_rate ,lv_curr,  lv_cond_value..
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL'
            iv_value     text-002    "'ZFRC'
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KWERT'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).
          ls_condtype-zfrc lv_cond_value.
          ls_condtype-zfrc_cur lv_curr.
        ENDIF.


*       Reading the ZD01 Values ..
        CLEAR lr_rate ,lv_curr,  lv_cond_value.
        CALL METHOD lr_iterator->find_by_property
          EXPORTING
            iv_attr_name 'KSCHL'
            iv_value     'ZD01'
          RECEIVING
            rv_result    lr_rate.

        IF lr_rate IS BOUND.
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'KWERT'
                                          IMPORTING ev_result  lv_cond_value ).
          lr_rate->get_property_as_valueEXPORTING iv_attr_name 'WAERK'
                                                    IMPORTING ev_result  lv_curr ).
          ls_condtype-zd01 lv_cond_value.
          ls_condtype-zd01_cur lv_curr.
        ENDIF.

        lr_condh ?=   me->typed_context->condtype->collection_wrapper->get_current).
        IF lr_condh IS BOUND.

          CALL METHOD lr_condh->set_properties
            EXPORTING
              is_attributes ls_condtype.
        ENDIF.
      ENDIF.
    ENDIF.