Pages

Friday, June 24, 2016

How to find view name and component from transport request



SAP CRM webui provides this excellent feature to change layout of  view based on our requirement.

When a new screen layout is created a Guid is generated by system (context id), the Screen layout customisation is stored as an XML file,Based on the context system at run time knows which screen layout need to be loaded.

As a developer we are are aware of the change done on screen by us ,while sometime it is difficult to know the views/component name as their might be a lot of views changed or maybe other developers are also working on the same component.      

In Transport request we can only see the guids and and some others node, like in the below picture:




this is not what we are looking for right ?

The solution of our question is BSPC_DL_XMLSTRX2.


"BSPC_DL_XMLSTRX2 is a standard SAP Table which is used to store Storagetable for XML layout descriptions information."

1. Goto Se16/SE11 give the table name as BSPC_DL_XMLSTRX2.



2. In the Context id field paste the guid(or list of guid ) copied from the transport request.



3. Execute. you will get View and component name with  role key and other fields .




If it was useful, you are welcome to leave a comment :-) . 

Wednesday, June 15, 2016

How to create data loss popup in CRM WebUI



When navigating from one custom component to other components or documents using Quick links or Navigation bar links we need to restrain user from accidentally deleting the  unsaved data, to achieve this we prompt data loss popup, which requires user input to proceed further. 

Below are the steps to create a data loss popup: 



STEP 1: Create a method with the name ON_BEFORE_WA_CONTENT_CHANGE in window                    implementation class with following properties:

                                      Level : Instance Method
                                     Visibility: Protected

STEP 2: Click on the method and click on Detail View button which is near parameters and set the                   following settings by clicking on Event handler for checkbox:

                                     Class/Interface: CL_BSP_WD_VIEW_MANAGER
                                      Event: BEFORE_WORKAREA_CONTENT_CHANGE
           and save the settings.
STEP 3:  Set the following settings for parameters:
                                     Parameter: DATA_LOSS_HANDLER
                                     Type: Importing
                                     Typing Method: Type Ref To
                                     Associated Type: IF_BSP_WD_DATA_LOSS_HANDLER


STEP 4: Write the following code into the above method:
  data_loss_handler->set_save_handlerme ).
  data_loss_handler
->set_revert_handlerme ).
  data_loss_handler
->set_cancel_handlerme ).
  data_loss_handler->trigger_data_loss_handling( ).

 

STEP 5: Redefine the method DO_VIEW_INIT_ON_ACTIVATION and write the following line: 
        
            SET HANDLER on_before_wa_content_change ACTIVATION abap_true.

STEP 6: Add interface IF_BSP_WD_EVENT_HANDLER in main your window. Implement the method IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT

CASE iv_event_name.
    WHEN if_bsp_wd_data_loss_handler=>save_event.
    rv_success = abap_true.
    WHEN if_bsp_wd_data_loss_handler=>revert_event.
     rv_success = abap_true.
    WHEN if_bsp_wd_data_loss_handler=>cancel_event.
     ...
 ENDCASE.
 

 
 






And write the logic in these cases and when yes or no button is pressed leaves current component.

Monday, June 13, 2016

How to Modify, Create and Delete table entries from SE11 tcode.


We all come across some situation when a table entry need to be modify or removed, Generally it can be done through tcode SM30 or Maintenance view, However sometimes as table is not maintained through transaction SM30 or no Data maintenance view is not present, its all most impossible to proceed further.

In such case to achieve this we can modify the table entry through se11

1. Goto Tcode SE11, enter the Table name



2. click on the Content(Ctrl+Shift+F10)


3. Then click on execute button.


4.  Click on the record you want to Delete or modify .




5. The entries is displayed now, go to debug mode by typing /H in the command screen , press enter        to switch on Debugging.


6. Again press Enter key or click on Continue to go into Debug Mode.



7. change the value of code to 'DELE' /EDIT, In this example as i want to edit the record,so i change       the value to EDIT.




8. After changing the value press F8. now you will be able to Edit/Delete  the entry  that entry.



9. Now made the change and save.





Apart from this procedure ,depending on the SAP release you can also use transaction SE16N or SE16. Enter the name of the table and then in the command field &sap_edit. Then your maintenance functions will be available.

Wednesday, June 8, 2016

SAP CRM interview Question

These are some Interview Questions i was asked during my interviews . I will keep posting  the new question and answer.


1) CRM BOL Programming 




31. What is business role ?
32. How to create Business Role and what is Business role customizing ?
33. What is Navigation bar customizing ?
34 Have you ever created TBUI ?
35 What is logical link and how to create logical link ?
36 How to create a custom component ?
37 What is the difference between BOL and GENIL ?
38 What is context ?
39 How to handle event ?
40 What is the difference AET and EEWB ?
41 What is the difference between MACRO and SUB-ROUTINE ?
42 Can we debug a MACRO ?
43 What is abstract method ? What is its use ?
43 What is abstract class ?


Tuesday, June 7, 2016

Inline ABAP declarations


Inline Declaration with release 7.4 



Inline ABAP DATA declarations are a new concept introduced in release 7.4 which allows you to declare your internal table variables or work areas within the code that uses them. This is done simply by adding the DATA(wa_data) or @DATA(it_data) statements.
The easiest way to describe this is to show you a very simple before after ABAP code example.
Pre 7.40 you would declare a work area and read data into it something like this


DATA: it_ekko TYPE STANDARD TABLE OF EKKO,
wa_ekko TYPE EKKO.
READ IT_EKKO INTO WA_EKKO.


Using the new method you would simply just using the following code:


READ TABLE it_ekko INDEX 1 INTO DATA(wa_ekko_new).


Hopefully the above example gives you an idea of how this new functionality can streamline your ABAP code and make it more readable. Also gives you the basics so you can have a play yourself. Now onto the @DATA statement....




The @DATA statement- Service Pack 08

The @DATA statement takes this a step further, allowing you to automatically inline declare an internal table to hold values you are selecting from a database table, using the SELECT statement. The only problem with this functionality is that it doesn't come in until Service Pack 08 or SP09. I have tried SP07 and it is definitely not in that and is there by SP09.
If you had a coding example where you declare an internal table to select values into it you would have some code that looked something like this.



TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,  menge TYPE ekpo-menge,
  meins TYPE ekpo-meins,
  netpr TYPE ekpo-netpr,
  peinh TYPE ekpo-peinh,
  CELLCOLOR TYPE LVC_T_SCOL,
 END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_ekko TYPE t_ekko.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
   up to 10 rows
  from ekpo
  into CORRESPONDING FIELDS OF TABLE it_ekko.


Using the new @DATA statement you could essentially replace all this with the following ABAP code, which automatically create an internal table with the correct field structure and drops the selected values into it. AS well as the @DATA note the ,'s after each field in the SELECT.


select ebeln, ebelp, statu, aedat, matnr, menge, meins, netpr, peinh
    up to 10 rows
    from ekpo    into TABLE @DATA(it_ekko_new).

This is more like it and if you combine the two examples together you get quite a neat and efficient looking section of code. It essentially removes all the ABAP declaration lines of code without adding much at all to SELECT and READ statements.

select ebeln, ebelp, statu, aedat, matnr, menge, meins, netpr, peinh    up to 10 rows
    from ekpo    into TABLE @DATA(it_ekko_new).
READ TABLE it_ekko_new INDEX 1 INTO DATA(wa_ekko_new2).
 WRITE:/ wa_ekko_new2.

ABAP Code Snippet

1)  Convert String/char  into Amount/quantity field based on Decimal notation set in the user profile.