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.