Friday, January 8, 2016

Get Description from Prompt Table

I created a method on App Package to get the description of most commonly used prompt table in HCM. You need to tweak it to work on your purpose.

method GetPromptTableDescr
/+ &fld as Field +/
/+ Returns String +/

Local string &string_descr, &prompt, &fldtype, &fldCd, &cd;
Local Field &recfld;
Local Record &recpr;
Local Rowset &rs;
Local integer &i, &fldlen;

Local boolean &effdtd;

&recfld = &fld;
&cd = &fld.Value;
&fldlen = &recfld.FieldLength;
&fldtype = &recfld.Type;
&prompt = &recfld.PromptTableName;
&recpr = CreateRecord(@("RECORD." | &prompt));
For &i = 1 To &recpr.FieldCount
If &recpr.GetField(&i).IsKey And
&fldlen = &recpr.GetField(&i).FieldLength And
&fldtype = &recpr.GetField(&i).Type Then
&fldCd = &recpr.GetField(&i).Name;
End-If;
/*Added to accomodate EFFDTed Prompts*/
If &recpr.GetField(&i).Name = "EFFDT" Then
&effdtd = True;
End-If;
/*End */
End-For;
&rs = CreateRowset(@("RECORD." | &recpr.Name));
If &effdtd Then
&rs.Fill("WHERE FILL." | &fldCd | " = :1 AND %EffdtCheck(" | &recpr.Name | " FILL_ED, FILL, %CurrentDateIn)", &cd);
Else
&rs.Fill("WHERE FILL." | &fldCd | " = :1", &cd);
End-If;
&string_descr = &rs(1).GetRecord(@("RECORD." | &recpr.Name)).DESCR.Value;
Return &string_descr;
end-method;



No comments: