Function SET007A: Using a text Area

LANSA

Function SET007A: Using a text Area

********** COMMENT(=======================================================);
********** COMMENT(Process ........: SET_007);
********** COMMENT(Function .......: SET007A);
********** COMMENT(Created on .....: 15/02/00 at 14:43:32);
********** COMMENT(Description ....: Function Skeleton);
********** COMMENT(Version.........: 1);
********** COMMENT();
********** COMMENT(Full Description: The purpose of this function is to);
********** COMMENT(show how to use a TEXT AREA. In our example, the text);
********** COMMENT(entered on the screen will be used to send an email.);
********** COMMENT();
********** COMMENT(Disclaimer: The following material is supplied as an);
********** COMMENT(example only. No warranty is expressed or implied.);
********** COMMENT();
********** COMMENT(=======================================================);
********** COMMENT(Function control options);
FUNCTION OPTIONS(*DIRECT *WEBEVENT);
********** COMMENT();
********** COMMENT(Group and field definitions);
********** COMMENT();
********** COMMENT(Fields to receive the text typed in the TEXT AREA (TA).);
DEFINE FIELD(#S_007TX01) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX02) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX03) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX04) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX05) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX06) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX07) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX08) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX09) REFFLD(#S_007TX);
DEFINE FIELD(#S_007TX10) REFFLD(#S_007TX);
********** COMMENT();
********** COMMENT(Maximum number of characters that can be typed in the);
********** COMMENT(TA. It will be equal to the number of lines);
********** COMMENT(times the length of the field.);
DEFINE FIELD(#MAXCHAR) TYPE(*DEC) LENGTH(005) DECIMALS(0);
DEFINE FIELD(#TXTLENGTH) TYPE(*DEC) LENGTH(003) DECIMALS(0) DEFAULT(75);
DEFINE FIELD(#NUM_LINES) TYPE(*DEC) LENGTH(005) DECIMALS(0) DEFAULT(11);
********** COMMENT(It is easier to handle the text entered in the TA by);
********** COMMENT(defining an array of its fields.);
DEF_ARRAY NAME(#TXT) INDEXES(#II) OF_FIELDS(#S_007TX #S_007TX01 #S_007TX02 #S_007TX03 #S_007TX04 #S_007TX05 #S_007TX06 #S_007TX07 #S_007TX08 #S_007TX09 #S_007TX10);
GROUP_BY NAME(#PANELDATA) FIELDS((#STDRENTRY *HIDDEN)(#S_EMORG)(#S_EMRCP)(#S_EMSBJ)(#S_007TX)(#MAXCHAR *HIDDEN)(#S_007SNDE));
********** COMMENT();
CHANGE FIELD(#MAXCHAR) TO('#txtlength * #num_lines');
********** COMMENT();
********** COMMENT(Mainline);
********** COMMENT();
IF COND('#stdrentry *ne Y');
CHANGE FIELD(#STDRENTRY) TO(Y);
CHANGE FIELD(#MAXCHAR) TO('#txtlength * #num_lines');
GOTO LABEL(REQ);
ENDIF;
********** COMMENT();
********** COMMENT(Prepare to send email.);
USE BUILTIN(MAIL_START) TO_GET(#S_RETCDA2);
USE BUILTIN(MAIL_ADD_ORIGINATOR) WITH_ARGS(#S_EMORG) TO_GET(#S_RETCDA2);
USE BUILTIN(MAIL_ADD_RECIPIENT) WITH_ARGS(TO #S_EMRCP) TO_GET(#S_RETCDA2);
USE BUILTIN(MAIL_SET_SUBJECT) WITH_ARGS(#S_EMSBJ) TO_GET(#S_RETCDA2);
********** COMMENT(Add the email text by processing the array. Each field);
********** COMMENT(is one array element.);
BEGIN_LOOP USING(#II) TO(#NUM_LINES);
CONTINUE IF('#txt#ii = *blank');
USE BUILTIN(MAIL_ADD_TEXT) WITH_ARGS(#TXT#II N) TO_GET(#S_RETCDA2);
END_LOOP;
********** COMMENT(Send email.);
USE BUILTIN(MAIL_SEND) TO_GET(#S_RETCDA2);
********** COMMENT();
REQ: REQUEST FIELDS(#PANELDATA) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);