Sep 30, 2014

Copying Fields from other Structures or Tables


1.  Create table / structure name. As an example below is table name

















2.  Choose from menu: Edit -> Transfer Fields


3.  Input structure name and press ‘Selection’.

4.  Select the fields and press Copy




5.  Paste the fields from Cipboard:


6.  All fields copied:




Sep 29, 2014

Create and Delete Folder in Frontend system using Class CL_GUI_FRONTEND_SERVICES

Procedure:
  1. Create Selection Screen with two radio buttons “Create Folder” and “Delete Folder”. And parameters to specify path for creating and deleting the folder.
  2. Give path and folder name in the selection screen
  3. Creating folder select the “Create Folder” Radio Button
  4. Deleting folder select the “Delete Folder” Radio Button  

Creation Process:












Deletion Process:









ABAP Codes:

*&----------------------------------------------------------------*
*& Report  Z_TEST001
*&
*&----------------------------------------------------------------*
*&
*&
*&----------------------------------------------------------------*

REPORT z_test001.

* Selection Screen Declarations
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_cr RADIOBUTTON GROUP rgb1 USER-COMMAND uco
                                    MODIF ID mod DEFAULT 'X',
            p_dr RADIOBUTTON GROUP rgb1 MODIF ID mod,
            p_cdir TYPE string,
            p_ddir TYPE string.
SELECTION-SCREEN END OF BLOCK b1.

* Data declarations
DATA: result TYPE char1,
      rc TYPE i,
      stripped_name TYPE string,
      v_string TYPE string.

************************************
* At Selection-Screen Output Event
************************************

AT SELECTION-SCREEN OUTPUT.

* Create Folder Checkbox Checked, Don’t display 
* the “Path to Delete Folder” parameter
  IF p_cr = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'P_DDIR' OR
        screen-name = '%_P_DDIR_%_APP_%-TEXT'.
        screen-input = 0.
        screen-invisible = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.

* Delete Folder Checkbox Checked, Don’t display the 
* “Path to Create Folder” parameter
    LOOP AT SCREEN.
      IF screen-name = 'P_CDIR' OR
        screen-name = '%_P_CDIR_%_APP_%-TEXT'.
        screen-input = 0.
        screen-invisible = 1.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

************************************
* Start of Selection Event
************************************
START-OF-SELECTION.

  IF p_cr = 'X'.
    "create folder radio button is checked.

*   Clear result variable
    CLEAR result.

*     Get the folder name
    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
      EXPORTING
        full_name     = p_cdir
      IMPORTING
        stripped_name = stripped_name
      EXCEPTIONS
        x_error       = 1
        OTHERS        = 2.

*   Check if the folder name exists under the specified
*   directory which you want to create
    CALL METHOD cl_gui_frontend_services=>directory_exist
      EXPORTING
        directory            = p_cdir
      RECEIVING
        result               = result
      EXCEPTIONS
        cntl_error           = 1
        error_no_gui         = 2
        wrong_parameter      = 3
        not_supported_by_gui = 4
        OTHERS               = 5.

*   If the folder name already exists then display a message.
    IF result = 'X'.

      CLEAR v_string.
      CONCATENATE 'ALREADY CONTAINS A FOLDER NAMED'
                  stripped_name
                  INTO v_string SEPARATED BY space.

      MESSAGE v_string TYPE 'I'.
      LEAVE LIST-PROCESSING.

*   If the folder name is not exist in the specified directory
    ELSE.

*     Clear return code
      CLEAR rc.

*     Create a new folder under the specified directory
      CALL METHOD cl_gui_frontend_services=>directory_create
        EXPORTING
          directory                = p_cdir
        CHANGING
          rc                       = rc
        EXCEPTIONS
          directory_create_failed  = 1
          cntl_error               = 2
          error_no_gui             = 3
          directory_access_denied  = 4
          directory_already_exists = 5
          path_not_found           = 6
          unknown_error            = 7
          not_supported_by_gui     = 8
          wrong_parameter          = 9
          OTHERS                   = 10.

      IF rc = 0.
        CLEAR v_string.
        CONCATENATE 'CREATED FOLDER NAMED'
                    stripped_name
                    INTO v_string SEPARATED BY space.

        MESSAGE v_string TYPE 'I'.
      ENDIF.

    ENDIF.

  ELSE.  "Delete folder radio button is checked.

*   Clear result variable
    CLEAR result.

*   Get the folder name
    CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
      EXPORTING
        full_name     = p_ddir
      IMPORTING
        stripped_name = stripped_name
      EXCEPTIONS
        x_error       = 1
        OTHERS        = 2.

*   Check if the folder name exists under the specified
*   directory which you want to create
    CALL METHOD cl_gui_frontend_services=>directory_exist
      EXPORTING
        directory            = p_ddir
      RECEIVING
        result               = result
      EXCEPTIONS
        cntl_error           = 1
        error_no_gui         = 2
        wrong_parameter      = 3
        not_supported_by_gui = 4
        OTHERS               = 5.

    IF result <> 'X'.

      CLEAR v_string.

      CONCATENATE 'THERE IS NO FOLDER NAMED'
                  stripped_name
                  INTO v_string SEPARATED BY space.

      MESSAGE v_string TYPE 'I'.
      LEAVE LIST-PROCESSING.

*   If the folder name exist, delete that folder from the
*   specified directory
    ELSE.

*     Clear return code
      CLEAR rc.

*      Delete folder from the specified directory
      CALL METHOD cl_gui_frontend_services=>directory_delete
        EXPORTING
          directory               = p_ddir
        CHANGING
          rc                      = rc
        EXCEPTIONS
          directory_delete_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          path_not_found          = 4
          directory_access_denied = 5
          unknown_error           = 6
          not_supported_by_gui    = 7
          wrong_parameter         = 8
          OTHERS                  = 9.
      IF rc = 0.
        CLEAR v_string.

        CONCATENATE 'DELETED FOLDER NAMED'
                    stripped_name
                    INTO v_string SEPARATED BY space.

        MESSAGE v_string TYPE 'I'.
        LEAVE LIST-PROCESSING.

      ENDIF.
    ENDIF.
  ENDIF.

Sep 26, 2014

Creating, Editing, and Deleting Enhancement Implementations

Use
  • If you have explicit enhancement options, you have to create the enhancement implementations for the related enhancement spots.
  • If you have implicit enhancement options, you create the enhancement implementations directly.
Procedure
  1. Start the Object Navigator (SE80).
  2. Open the package in which an enhancement implementation is defined or is to be created.
Create an enhancement implementation
  • If you have an explicit enhancement option, select the enhancement spot in the Object Navigator and in the context menu choose Implement.
  • For an implicit enhancement option, open the Enhancement Builder in the relevant tool (ABAP Editor, Function Builder, Class Builder) for executing an enhancement and continue with the following steps:
    1. Enter a name for the (simple) enhancement implementation.
    2. Enter a short text for the (simple) enhancement implementation.
    3. Select a composite enhancement implementation, or create a new one.
    4. Choose Creation of Enhancement (Enter).
      The subsequent process depends on the enhancement technology of the enhancement spot.
Edit an enhancement implementation
  1. Select the package and expand it.
  2. Expand the Enhancements node.
  3. Expand the Enhancement Implementations node.
  4. Select the desired enhancement implementation.
  5. Select Change from the context menu.
  6. If you only want to display the enhancement implementation, choose Display.
Delete an enhancement implementation
  1. Select the package and expand it.
  2. Expand the Enhancements node.
  3. Expand the Enhancement Implementations node.
  4. Select the desired enhancement implementation.
  5. In the context menu, choose Delete.

Ref: http://help.sap.com/saphelp_nw73ehp1/helpdata/en/5f/103a4280da9923e10000000a155106/content.htm


Creating, Editing, and Deleting Enhancement Spots

Create a composite enhancement spot
  1. Select the package in which you want to create the enhancement spot.
  2. Open the context menu and choose Create Enhancement Composite Enhancement SpotA dialog appears.
  3. Specify a name and a short description. Optionally, you can assign the new spot to an already existing composite enhancement spot.
  4. Activate the new spot.
Create a subordinate composite enhancement spot

  1. Open the desired package.
  2. Select the composite enhancement spot to which your new subordinate composite spot will belong.
  3. Open the context menu and choose Create → Subordinate Composite Enhancement Point. A dialog appears.
  4. Specify a name and a short description.
  5. Choose This graphic is explained in the accompanying text Activate to activate the new subordinate spot.

Result:
  • The selected composite enhancement spot and its newly created subordinate one are displayed in the object list in a list form (not as a tree) on the same level.
  • Choose the composite enhancement spot and select the Spot Composites tab to check whether the new subordinate composite is properly attached.
  • The header of the new subordinate spot has to contain the name of the composite enhancement spot to which this subordinate is attached.
  • Use a forward navigation to Navigate from parent to child and back.



Create a simple enhancement spot
  1. Select the package in which you want to create the simple enhancement spot.
  2. Open the context menu and choose Create Enhancement Enhancement SpotA dialog appears.
  3. Specify a name and a short description. Optionally, you can assign the new spot to an already existing composite enhancement spot.
  4. Select the desired technology from the Technology list. (Currently it is only possible to create enhancement spots of type “BAdI“.)
  5. Source code plug-ins can only be created inside the editor, because they contain points and sections.
  6. Activate the new simple enhancement spot.

Edit an enhancement spot
  1. Select the package and expand it.
  2. Expand the Enhancements node.
  3. Expand the Enhancement Spot node.
  4. Select the desired enhancement spot.
  5. Choose Change from the context menu.
  6. Choose Display if you only want to display the enhancement spot.

Delete an enhancement spot
  1. Select the package and expand it.
  2. Expand the Enhancements node.
  3. Expand the Enhancement Spot node.
  4. Select the desired enhancement spot.
  5. Choose Delete from the context menu.

Ref: https://help.sap.com/saphelp_nw70/helpdata/en/3b/0a39426f79f83ae10000000a1550b0/content.htm

Debugging Web Dynpro ABAP Applications

The ABAP runtime environment contains various tools that you can use for analysis purposes, such as for debugging source code. All source code written for Web Dynpro applications in ABAP can normally be tested using the debugger.
To allow it to test other Web Dynpro-specific program entities too, the debugger has been equipped with a special enhancement. In the phase model in the active application, you can typically see the following information at various points in time:
  • The structure of the content of the current controller,
  • The properties of the UI elements in the layout of the current view
  • The currently instantiated component usages

Starting the Debugger
The functions to debug Web Dynpro units are embedded in the New Debugger. Therefore you must have selected the new Debugger in your workbench settings.
Selecting the New Debugger
  1. In the menu, choose Utilities -> Settings... (return).
  2. Choose the parent tab page ABAP Editor.
    The settings for ABAP Editor open with the content of the child tab page Editor.
  3. Under Editor, select the option Front-End Editor (new).
  4. Switch to the Debugging tab page.
  5. Under ABAP Debugger, select the option New Debugger.
  6. Save your entries.
Starting the Debugging Process
  1. To run an application in debugging mode, you first need to set an external breakpoint in display mode in one of the methods in the component:
    Setting an external breakpoint (Setting an external breakpoint)
    Note Note
    Note that this is an external breakpoint.
    End of the note.
    The method in which you set the breakpoint depends on the purpose of the test run. To debug a view, for example, it is best to set the breakpoint in method WDDOMODIFYVIEW. Provided that the context of the view controller is not filled using a supply method, the view is fully instantiated in the phase model at this point in time.
  2. Now start a test run of the application from ABAP Workbench as usual.
Selecting the Web Dynpro Tool in the New Debugger
When you start the application, another session opens automatically for the debugger. If you have not yet saved any personal settings with regard to the layout of the debugger, the Editor tool will now appear on the left, with the Display Variables tool on the right.
  1. Select one of the three desktops in order to reconfigure it for debugging the Web Dynpro application (refer to Designing Work Areas).
  2. The right-hand edge of the debugger window has a bar of function symbols. Choose the Replace Tools symbol:
    Replace tools (Replace tools)
  3. In the New Tool window, open the lowest node (Special Tools) and choose Web Dynpro.
  4. Save your entries.
On the right of the debugger desktop, you will see that the previous tool has now been replaced by the Web Dynpro debugger. You can save this setting for future debugging activities. To do this, choose Save Layout in the debugger’s general toolbar:
Save layout (Ctrl+Shift+F3) (Save layout (Ctrl+Shift+F3))


Ref: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/74d50bd1431b5ae10000000a42189c/content.htm