Skip to main content

Posts

Showing posts from 2014

How to write or print data in notepad using append mode?

We can use the below function to print a value in notepad using append mode, it will keep on adding the data in notepad. This function can be used for data filtration from a parameter file. long fd; char buff[100]; web_reg_save_param("cRequest_id","LB=---","RB=---","ORD=1",Last); //Before closing the Action strcpy( buff,lr_eval_string("{cRequest_id}") ); fd=fopen( "C:\\NotepadName.txt","a" ); fprintf( fd,"%s\n",buff ); fclose( fd ); } In this example we are capturing the cRequest_id from correlation and printing in notepad.

SAP GUI Text check (Error Handling)

SAP GUI Text check (Error Handling) sapgui_status_bar_get_text("paramStatusBarText",                    BEGIN_OPTIONAL,                              "Recorded status bar text: Material document 4900089763 posted",                              "AdditionalInfo=sapgui1067",                    END_OPTIONAL);           lr_end_transaction("S31_SAP_Fleet_MIGO_1090_ClkPost", LR_AUTO); i = sapgui_status_bar_get_param("1", "param1", LAST); lr_output_message("Material Document Number is: %s",lr_eval_string("{param1}")); if(i==1)            { lr_output_message("Material Document creation failed and input data used is : %s", lr_eval_string("{pUserName}"));            }  SAP GUI get_text:  //captured during recording: sapgui_status_bar_get_text("paramStatusBarText",                    BEGIN_OPTIONAL,                              "Recorded status bar text: M

Error handling using Text Check

Error handling using if else condition. web_reg_find("Search=All",                      "Text/IC=Home Page",                      "SaveCount=home_count",                       LAST); //then after login block paste this code: if (atoi(lr_eval_string("{home_count}")) > 0)                 {                       lr_output_message("Log on Successful");                 }     else               {                     lr_output_message("Log on failed for the Login ID: %s", lr_eval_string("{pUserName}"));                     lr_exit( LR_EXIT_ACTION_AND_CONTINUE,LR_FAIL );                }

Save a parameter in notepad file

This code will create a notepad file and save the parameter into it. long fd; web_reg_save_param("saveID","LB=---","RB=---","ORD=1",Last); //Capture the value in "saveID" fd=fopen( "C:\\NotepadName.txt","a" ); //Path of notepad fprintf( fd,"%s\n",lr_eval_string("{saveID"})); //It will print the data and go to next line fclose( fd ); // It will close notepad.