Wednesday, 8 August 2012

Correlating SAP Event queue ( SAPEVENTQUEUE) value in SAP Web dynpro portal application using loadrunner.

Correlating SAP Event queue ( SAPEVENTQUEUE) value in SAP Web dynpro portal application using  loadrunner.

In general HTTP correlations, most of the times we capture the value using Web_reg_save_param. One of our  client has having SAP portral with Webdynpro environment.  But in this application the value going to server is having different than the one captured value, below is the example
The challenge here is:
the captured Dynamic value od SAP Ext SID is:
sap-ext-sid=bthS*ed*7aBmxbOyv*kQYw--BOJtGMTw_1wFLGmQve28Gg- -
But it is going to the server in SAP in some other format.
ITEMDATA,
"Name=SAPEVENTQUEUE", "Value=Custom_ClientInfos~E002Id~E004WD01~E005WindowOpenerExists~E004false~E005ClientURL~ ~003Bsap-ext-sid~003dbthS~002Aed~002A7aBmxbOyv~002AkQYw--BOJtGMTw_1wFLGmQve28Gg--~E003~E002ClientAction~E004enqueue~E005ResponseData~E004delta~E003~E002~E003~ Action~""E004submit~E003~E002~E003", ENDITEM,
If you observe here, the *in the value is replaced by ~002A, So we have wrote a piece of code to convert that to desired format. Pleas use the below code.
//declare these variables outside of Action block.
int i;
char myVal[100];
char buffer[];
char newSId[]="";
char separators[] = "*";
char *token;
char * position;
//Insert this function above the Action request from which you are capturing the SAP Sid value. Don’t //forget to converting HTML to Text format.
web_reg_save_param("sId_SAPEVENT", "LB=sap-ext-sid=", "RB=\"  target=\"Search and", "CONVERT=HTML_TO_TEXT",  LAST);
               
//Let’s here you have request
//Http call
//Insert this code after HTTP request from where you are capturing this value
   
        i=100;
sprintf(newSId,lr_eval_string("{sId_SAPEVENT}"));
position = (char *)strstr(lr_eval_string ("{sId_SAPEVENT}"), "*");
if(position != 0){
                i = strcspn (newSId,"*");
                token = (char *)strtok(newSId, "*"); // Get the first token 
                sprintf(myVal, "");
                while (token != NULL ) { // While valid tokens are returned
                                if((i+1) == 1){strcpy(myVal,"~002A"); i=100;}
                                strcat(myVal,token);
                                token = (char *)strtok(NULL, "*"); // Get the next token 
                                if(token != NULL){strcat(myVal,"~002A");}
                }
                lr_save_string (lr_eval_string (myVal),"sId_SAPEVENT");
}
//You can pass this {sId_SAPEVENT} value in your calls, this holds the SAP EXT SID value after replacing * with ~002A
 If you have any questions, Please reach out to me.
The peice of code is written by Shekhar bhole from ScalarUSA.
Thanks for all the readers who are visiting this article, please write your comments.
If this article is useful to you and saves your time, Please like us on facebook https://www.facebook.com/ILoveLoadrunner
Thank you,

14 comments: