Highlighted
Absent Member.
Absent Member.
145 views

Save Parameter to File

I'm able to grab an output value from the screen in SAP which I'd like to save to a file for use in future scripts and I'm having problems.

Can anyone point me in the correct direction?

I've used:

lr_output_message(lr_eval_string("{NOM}"))

which shows the value but I can't figure out how to write it to a file.

Thanks for the help.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Re: Save Parameter to File

Hi Steve,

Here is the code:

long file_stream;
char *filename = "c:\\myfile.txt";


if ((file_stream = fopen(filename, "a")))
{
fprintf(file_stream,"Writing %s\n", lr_eval_string("{NOM}"));
fclose(file_stream);
}
else
{
lr_output_message("File could not be opened");
}
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Save Parameter to File

Thanks just what I was looking for.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.