Skip to Content

Screen Personas - Get Domain Texts via Function Module

I've seen several posts where the authors describe using BAPI_USER_GET_DETAIL. Let’s say that I also want the date & number format to show in some labels in my flavor. These are in the DEFAULTS structure as DATFM and DCPFM. When you retrieve these from this function module, they come across as domain values (e.g., 6 = YYYY-MM-DD). Rather than show the domain value, I want to translate these to the text from DD07T.

I have been trying to use RFC_READ_TABLE to read from DD07T but have not been successful getting results. In the code snippet below, dateFmt would be 6.

Any suggestions?

var fmReadTable = session.createRFC("RFC_READ_TABLE",'');
fmReadTable.setParameter("QUERY_TABLE","DD07T");
var readOpt1 = { TEXT: "DOMNAME = 'XUDATFM' AND" };
var readOpt2 = { TEXT: "DDLANGUAGE = 'EN' AND" };
var readOpt3 = { TEXT: "AS4LOCAL = 'A' AND" };
var readOpt4 = { TEXT: "DOMVALUE_L = '" + dateFmt + "'" };
fmReadTable.setParameter("OPTIONS",JSON.stringify([readOpt1,readOpt2,readOpt3,readOpt4]));
var readFld1 = { FIELDNAME: "DDTEXT" };
fmReadTable.setParameter("FIELDS",JSON.stringify([readFld1]));
fmReadTable.requestResults(JSON.stringify(["OPTIONS","FIELDS","DATA"]));
fmReadTable.send();
var fmReadData = JSON.parse(fmReadTable.getResult("DATA"));
var dateTxt = fmReadData.WA;
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 21, 2016 at 04:37 PM

    I found another RFC-enabled function module that provides domain values: DD_DOMA_GET. In this FM, I have to loop through the results to get to the text value that I want, but it is effective. In my code snippet, the variable dateFmt comes from structure and field DEFAULTS-DATFM of BAPI_USER_GET_DETAIL.

    var fmDomain = session.createRFC("DD_DOMA_GET",'');
    fmDomain.setParameter("DOMAIN_NAME","XUDATFM");
    fmDomain.requestResults(JSON.stringify(["DD07V_TAB_A","DD07V_TAB_N"]));
    fmDomain.send();
    var fmResults = JSON.parse(fmDomain.getResult("DD07V_TAB_A"));
    for(var i = 0; i < fmResults.length; i++) {
    	if (dateFmt == fmResults[i].DOMVALUE_L) {
    		var dateTxt = fmResults[i].DDTEXT;
    		break;
    	}
    }
    Add comment
    10|10000 characters needed characters exceeded