Wednesday 21 November 2012

SAP TREX installation with screen shots

TREX installation with screen shots

========================================================================

Download TREX installation master from SAP service market place.

Run sapinst from installation master.









Friday 31 August 2012

Drop down, F4 help, hot spot, editable fields in ALV Grid


This program describes how to include Drop down, F4 help, hot spot, editable fields in ALV Grid.

  • Create report ZALV_EXAMPLE. 
  • Create screen 100 and press layout button for screen painting.
  • Create custom control and adjust according to your screen area. 
  • Create GUI status for screen 100 'STATUS_100'
  • Create message class ZFLIGHT and enter 'Total price for Air line & of plane type & is & &' in message 001 
  • Then paste below code in the report and activate it.
=====================================================================


REPORT  ZALV_EXAMPLE MESSAGE-ID ZFLIGHT.

type-pools: SLIS.

DATA:
  begin of IT_SFLIGHT,
    carrid type sflight-carrid,
    connid type sflight-connid,
    FLDATE type sflight-FLDATE,
    PRICE type sflight-PRICE,
    CURRENCY type sflight-CURRENCY,
    PLANETYPE type sflight-planetype,
    comments TYPE char250,
  end of IT_SFLIGHT.
DATA:
  BEGIN OF PLNTYPEF4,
    PLANETYPE TYPE CHAR10,
  END OF PLNTYPEF4.

DATA :G_CONTAINER TYPE SCRFNAME VALUE 'GRID',
      ALV_GRID  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      WA_SFLIGHT LIKE  TABLE OF IT_SFLIGHT WITH HEADER LINE,
      GT_FIELDCAT TYPE LVC_T_FCAT WITH HEADER LINE,
      WA_PLNTYPEF4 LIKE STANDARD TABLE OF PLNTYPEF4 WITH HEADER LINE.

CALL SCREEN 100.

" create class to handle f4 and hotspot clic events.

CLASS LCL_EVENT_HANDLER DEFINITION.
  PUBLIC SECTION.
    METHODS ON_F4 FOR EVENT ONF4 OF CL_GUI_ALV_GRID
      IMPORTING E_FIELDNAME
                ES_ROW_NO
                ER_EVENT_DATA
                ET_BAD_CELLS
                E_DISPLAY.
    METHODS HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
      IMPORTING ES_ROW_NO
                E_ROW_ID
                E_COLUMN_ID.
ENDCLASS.

CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD ON_F4.
PERFORM ON_F4_HELP USING E_FIELDNAME
                         ES_ROW_NO-ROW_ID
                         ER_EVENT_DATA
                         ET_BAD_CELLS
                         E_DISPLAY.
ER_EVENT_DATA->M_EVENT_HANDLED 'X'.
ENDMETHOD.

METHOD HOTSPOT_CLICK.
PERFORM HOTSPOT_CLICK USING ES_ROW_NO
                            E_ROW_ID
                            E_COLUMN_ID.
ENDMETHOD.
ENDCLASS.

DATA :GO_HANDLE TYPE REF TO LCL_EVENT_HANDLER.

FORM ON_F4_HELP USING P_E_FIELDNAME ROW_ID P_ER_EVENT_DATA TYPE REF TO CL_ALV_EVENT_DATA P_ET_BAD_CELLS P_E_DISPLAY.
  DATA :LINE TYPE CHAR10,
        RETURN_TAB TYPE TABLE OF DDSHRETVAL WITH HEADER LINE.
  REFRESH WA_PLNTYPEF4.
  CLEAR WA_PLNTYPEF4.
  SELECT DISTINCT PLANETYPE FROM SFLIGHT INTO LINE.
    APPEND LINE TO WA_PLNTYPEF4.
    ENDSELECT.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
        RETFIELD        'PLANETYPE'
        VALUE_ORG       'S'
        DYNPPROG        SY-REPID
        DYNPNR          SY-DYNNR
      TABLES
        VALUE_TAB WA_PLNTYPEF4
        RETURN_TAB RETURN_TAB
      EXCEPTIONS
        PARAMETER_ERROR 1
        NO_VALUES_FOUND 2
        OTHERS          3.
    READ TABLE WA_SFLIGHT INDEX ROW_ID.
    IF RETURN_TAB-FIELDVAL IS NOT INITIAL.
      WA_SFLIGHT-PLANETYPE RETURN_TAB-FIELDVAL.
    ENDIF.
    MODIFY WA_SFLIGHT INDEX ROW_ID.
    CALL METHOD ALV_GRID->REFRESH_TABLE_DISPLAY.
ENDFORM.

FORM HOTSPOT_CLICK USING ES_ROW_NO
                         E_ROW_ID
                         E_COLUMN_ID.
READ TABLE WA_SFLIGHT INDEX E_ROW_ID.
MESSAGE S001 WITH WA_SFLIGHT-CONNID WA_SFLIGHT-PLANETYPE  WA_SFLIGHT-PRICE WA_SFLIGHT-CURRENCY.
ENDFORM.

MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'STATUS_100'.
  SELECT FROM SFLIGHT INTO CORRESPONDING FIELDS OF TABLE WA_SFLIGHT.
  REFRESH GT_FIELDCAT.
  PERFORM BUILD_FIELDCAT USING 'CARRID' 'WA_SFLIGHT' 'Airline Code'.
  PERFORM BUILD_FIELDCAT USING 'CONNID' 'WA_SFLIGHT' 'Flight Conn No'.
  PERFORM BUILD_FIELDCAT USING 'FLDATE' 'WA_SFLIGHT' 'Flight date'.
  PERFORM BUILD_FIELDCAT USING 'PRICE' 'WA_SFLIGHT' 'Airfare'.
  PERFORM BUILD_FIELDCAT USING 'CURRENCY' 'WA_SFLIGHT' 'Local currency'.
  PERFORM BUILD_FIELDCAT USING 'PLANETYPE' 'WA_SFLIGHT' 'Aircraft Type'.
  PERFORM BUILD_FIELDCAT USING 'COMMENTS' 'WA_SFLIGHT' 'Comments'.

  IF G_CUSTOM_CONTAINER IS INITIAL.
    CREATE OBJECT G_CUSTOM_CONTAINER
      EXPORTING CONTAINER_NAME G_CONTAINER.
    CREATE OBJECT ALV_GRID
      EXPORTING I_PARENT G_CUSTOM_CONTAINER.
    PERFORM DROPDOWN_TABLE CHANGING ALV_GRID.
    CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      CHANGING  IT_OUTTAB       WA_SFLIGHT[]
                IT_FIELDCATALOG GT_FIELDCAT[].
    CALL METHOD ALV_GRID->REGISTER_EDIT_EVENT
      EXPORTING
      I_EVENT_ID CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
    CREATE OBJECT GO_HANDLE.
    SET HANDLER :GO_HANDLE->ON_F4 FOR ALV_GRID,
                 GO_HANDLE->HOTSPOT_CLICK FOR ALV_GRID.
  ELSE.
    CALL METHOD ALV_GRID->REFRESH_TABLE_DISPLAY.
  ENDIF.
ENDMODULE.

MODULE USER_COMMAND_0100 INPUT.
  IF sy-ucomm 'BACK' OR
     sy-ucomm 'EXIT' OR
     sy-ucomm 'CANCEL'.
    LEAVE PROGRAM.
  ENDIF.
ENDMODULE.

FORM BUILD_FIELDCAT USING POS FIELD TABLE TEXT.
CLEAR GT_FIELDCAT.
GT_FIELDCAT-COL_POS POS.
GT_FIELDCAT-FIELDNAME FIELD.
GT_FIELDCAT-TABNAME TABLE.
GT_FIELDCAT-COL_OPT 'X'.
GT_FIELDCAT-OUTPUTLEN 50.
IF POS OR POS ).
  GT_FIELDCAT-EDIT 'X'.
ENDIF.
IF POS 6.
  GT_FIELDCAT-F4AVAILABL 'X'.
ENDIF.
IF POS 2.
  GT_FIELDCAT-HOTSPOT 'X'.
ENDIF.
GT_FIELDCAT-SELTEXT TEXT.
GT_FIELDCAT-COLTEXT TEXT.
APPEND GT_FIELDCAT.
ENDFORM.

FORM DROPDOWN_TABLE CHANGING ALV_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA :LT_DROPDOWN TYPE LVC_T_DROP WITH HEADER LINE.
DATA: GS_F4 type LVC_S_F4,
      GT_F4 type LVC_T_f4.
LOOP AT GT_FIELDCAT.
  IF GT_FIELDCAT-FIELDNAME 'CURRENCY'.
    GT_FIELDCAT-DRDN_HNDL '1'.
    GT_FIELDCAT-OUTPUTLEN 20.
    MODIFY GT_FIELDCAT.
  ENDIF.
ENDLOOP.
CLEAR GT_F4.
  GS_F4-FIELDNAME  'PLANETYPE'.
  GS_F4-REGISTER   'X'.
  GS_F4-GETBEFORE  'X'.
  GS_F4-CHNGEAFTER 'X'.
  APPEND GS_F4 to GT_F4.
  CALL METHOD ALV_GRID->REGISTER_F4_FOR_FIELDS
    EXPORTING
      IT_F4 GT_F4.
LT_DROPDOWN-HANDLE '1'.
LT_DROPDOWN-VALUE 'CAD'.
APPEND LT_DROPDOWN.
LT_DROPDOWN-HANDLE '1'.
LT_DROPDOWN-VALUE 'EUR'.
APPEND LT_DROPDOWN.
LT_DROPDOWN-HANDLE '1'.
LT_DROPDOWN-VALUE 'DEM'.
APPEND LT_DROPDOWN.
LT_DROPDOWN-HANDLE '1'.
LT_DROPDOWN-VALUE 'USD'.
APPEND LT_DROPDOWN.
LT_DROPDOWN-HANDLE '1'.
LT_DROPDOWN-VALUE 'LIT'.
APPEND LT_DROPDOWN.
CALL METHOD ALV_GRID->SET_DROP_DOWN_TABLE
  EXPORTING
    IT_DROP_DOWN LT_DROPDOWN[].
ENDFORM.

===================================================================
The output will be look like below. In here you can find hot spot in column 2, drop down in column 5, f4 help column 6 and editable fields in column 7.



F4 help can get from clicking f4 help buttun from any of the field from 6th column.
Then popup will diaplay with possible values for that field.

Once you selected required field ALV grid will change accordingly.

And if click on any hotspot from 2nd column status message of the row will be displayed.


Tuesday 7 June 2011

Sort selected columns within ALV grid

Here is the simple program to sort selected columns within ALV grid.

=========================================================================
REPORT  ZSORT_ALV.

type-pools: SLIS.

data:
  begin of wa_SFLIGHT,
    carrid type sflight-carrid,
    connid type sflight-connid,
    FLDATE type sflight-FLDATE,
    PRICE type sflight-PRICE,
    CURRENCY type sflight-CURRENCY,
  end of wa_SFLIGHT,

  it_sflight like STANDARD TABLE OF wa_sflight,

  IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
  it_sort     type  SLIS_T_SORTINFO_ALV WITH HEADER LINE.


perform fill_fieldcat.

select from SFLIGHT into corresponding fields of TABLE it_SFLIGHT.



it_sort-spos = 01.
it_sort-fieldname = 'CARRID'.
it_sort-UP            =  'X'.
it_sort-SUBTOT        = 'X'.
APPEND it_sort.

it_sort-spos = 02.
it_sort-fieldname = 'CONNID'.
it_sort-UP            =  'X'.
it_sort-SUBTOT        = 'X'.
APPEND it_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
    IT_FIELDCAT                       = IT_FIELDCAT[]
    IT_SORT                           = IT_SORT[]
  TABLES
    t_outtab                          = it_SFLIGHT
  EXCEPTIONS
   PROGRAM_ERROR                     = 1
   OTHERS                            2
          .
IF sy-subrc <> 0.
ENDIF.
FORM FILL_FIELDCAT .

  IT_FIELDCAT-col_pos   = 1.
  IT_FIELDCAT-fieldname = 'CARRID'.
  IT_FIELDCAT-tabname   = 'IT_SFLIGHT'.
  IT_FIELDCAT-seltext_m = ' Carrid '.
  APPEND IT_FIELDCAT.

  IT_FIELDCAT-col_pos   = 2.
  IT_FIELDCAT-fieldname = 'CONNID'.
  IT_FIELDCAT-tabname   = 'IT_SFLIGHT'.
  IT_FIELDCAT-seltext_m = ' Connid '.
  APPEND IT_FIELDCAT.

  IT_FIELDCAT-col_pos   = 3.
  IT_FIELDCAT-fieldname = 'FLDATE'.
  IT_FIELDCAT-tabname   = 'IT_SFLIGHT'.
  IT_FIELDCAT-seltext_m = ' Date '.
  APPEND IT_FIELDCAT.

  IT_FIELDCAT-col_pos   = 4.
  IT_FIELDCAT-fieldname = 'PRICE'.
  IT_FIELDCAT-tabname   = 'IT_SFLIGHT'.
  IT_FIELDCAT-seltext_m = ' Price '.
  APPEND IT_FIELDCAT.

  IT_FIELDCAT-col_pos   = 5.
  IT_FIELDCAT-fieldname = 'CURRENCY'.
  IT_FIELDCAT-tabname   = 'IT_SFLIGHT'.
  IT_FIELDCAT-seltext_m = ' Currency '.
  APPEND IT_FIELDCAT.
ENDFORM.

=========================================================================
And the output is :














Saturday 28 May 2011

Trusted RFC creation (step by step procedure)

Trusted RFC cab be used to connect with other SAP without password.
To connect one SAP system with another SAP system without password, calling SAP system is known to the called system as a trusted system.
The calling SAP system must be registered with the called SAP system as a trusted system. The called system is called the trusting system. 

Step by step procedure to create trusted RFC with screen shots:

Now we will establish trusted connection from ABC system to XYZ system
Here ABC is trusted system and XYZ is trusting system. 

Now create normal RFC connection to ABC in XYZ system.

Now create authorization role to access XYZ system. this should be created in XYZ system.


Generate profile.


 Once profile generated change authorization data.


Add authorization object S_RFCACL manually


Now mention from which system and user connection should accept. Then save and generate profile.

 
Then add your user to role and do user comparison.



Now go to smt1 transaction XYZ system and create trusted connection.


Now mention RFC destination which you created in first step.

Once RFC destination provided it will login to ABC system and create trusted relationship from ABC to XYZ. Here you can also mention validity period so that connection will be valid till particular time.

Now login  to ABC system with same user as we added role in XYZ system.
Go to smt2 transaction and test the connection by double clicking on connection.
mention transaction to which it should go.

Now it will go to XYZ system to that particular transaction.





Sunday 22 May 2011

Content server installation in SAP

SAP Content Server is delivered as part of SAP Netweaver Version 2004 and higher.
So mount SAP Netweaver installation master and start sapinst from CD.

This post will give step by step procedure to install content server with screen shots.

Go to SAP netweaver -> standalone engines -> content server -> content server and/or cache server.

Select install content server and install database instance. Enter database ID and data size for instance (by default 2000MB)

Change default values if you want.
Mention database destination drive

Password for database system administrator and database manager operator.

Enter number of CPUs to be used by content server. select mirror log if you want to use.

Enter location for log and log size. default 1000 MB.

Enter data volumes location and each data volume size. Total data volume size must be 2000 MB.

Start installation.




Installation of content server completed.










Wednesday 27 April 2011

UME connection in Add-In and R3 connected systems


APPLICABLE ONLY TO NW04s(700) and lower releases


1. To find out if the system is r/3 connected or j2ee addin
Scenario A :
J2EE Addin : File structure will be
/usr/sap/<SID>/DVEBMGS<nr>/j2ee/
Scenario  B :
R/3 Connected : File Structure will be
/usr/sap/<SID>/JC<nr>/j2ee


Scenario  A :

1. Create users(ADMIN,GUEST) on the new R/3 Client on the same system.
ADMIN : Dialog User, Role : SAP_J2EE_ADMIN, Passwd : ******

GUEST : Dialog User, Role : SAP_J2EE_GUEST, Passwd : **********
SAPJSF : Communication User, Role : SAP_BC_JSF_COMMUNICATION, SAP_BC_JSF_COMMUNICATION_RO, Passwd : ************

2. Open the offline config tool (D:\usr\sap\<SID>\DVEBMGS<nr>\j2ee\configtool)
run the offlinecfgeditor.bat, navigate Configurations -> cluster_data -> server -> cfg -> services -> Propertysheet com.sap.security.core.ume.service
   ume.login.guest_user.uniqueids : GUEST
   ume.persistence.data_source_configuration : dataSourceConfiguration_r3_rw.xml
   ume.r3.connection.master.client : < Backend client to which the j2ee has to be connected >
   ume.r3.connection.master.msghost : < R/3 host, since this will be j2ee addin hence not necessary to change>
   ume.r3.connection.master.r3name : < R/3 name, since this will be j2ee addin hence not necessary to change>
   ume.r3.connection.master.user :  SAPJSF (Default)
   ume.r3.connection.master.passwd : <passwd of the sapjsf user>


NOTE : R/3 msghost and r3name remains same as it is a j2ee addin.
For the dialog users, make sure to assign an arbitrary password and login to the system, change the password to the standard passwords.


3. In the configtool secure store, go to secure store, modify is necessary /admin/user/<SID>/ : < give the right administrator user> ,  /admin/password/<SID>/ : <give the password the administrator user>
this user should be admin in this case.


3. Restart the j2ee from the SAP System (TCODE : SMICM).


Scenario  B :

Before you connect the j2ee systems to r/3, on the j2ee end

1. J2EE has Administrators(Administrator, ADMIN) on the j2ee standalone.
2. J2EE has Guest(Guest User) as well on the j2ee standalone.
3. On the R/3 end, make sure that none of these users(Administrator, ADMIN and Guest) exist. This is to avoid the duplication of users.
If it is already available then delete it on the j2ee side.


NOTE : If there are duplicate users on the j2ee and the r/3 client under consideration the j2ee will not come up.

4. Open the offline config tool (D:\usr\sap\<SID>\JC<nr>\j2ee\configtool),run the offlinecfgeditor.bat, navigate Configurations -> cluster_data -> server -> cfg -> services -> Propertysheet com.sap.security.core.ume.service
   ume.login.guest_user.uniqueids : Guest
   ume.persistence.data_source_configuration : dataSourceConfiguration_r3_rw.xml
   ume.r3.connection.master.client : <client of the r/3 system>
   ume.r3.connection.master.msghost : <msg server host of the r/3 system>
   ume.r3.connection.master.r3name : <r/3 name>
   ume.r3.connection.master.user :  SAPJSF (Default)
   ume.r3.connection.master.passwd : <passwd of the sapjsf      user>


ume.r3.connection.master.sysnr : System number of the R/3 instance

5. In the configtool, go to secure store, modify is necessary /admin/user/<SID>/ : < give the right administrator user> ,  /admin/password/<SID>/ : give the password the administrator user.
This user should be admin in this case.

 
6. Restart the J2EE instance.