Author Topic: RFC CALL: /GUIXT/SELECT  (Read 4421 times)

umang@guixt.com

  • Administrator
  • Newbie
  • *****
  • Posts: 34
    • View Profile
RFC CALL: /GUIXT/SELECT
« on: January 17, 2024, 03:52:03 PM »
This article describes the details on how to call /GUIXT/SELECT , RFC enabled function module in SAP using Liquid UI

Calling /GUIXT/SELECT Function Module

Things to pay attention to:

1. FUNCTION NAME SHOULD BE UPPERCASE IN CALL STATEMENT
2. PARAMETER NAMES SHOULD BE UPPERCASE IN CALL STATEMENT
3. WIDTH FOR OUTPUT IS 2X THE TOTAL CHAR COUNT (DOUBLE BYTE UNICODE)
4. IF TABLE OUTPUT IS CHAR (EXAMPLE: CHAR8000), THEN PASS DEFINED STRUCTURE TO RETRIEVE DATA. 
5. STRUCTURE DETAILS TO BE DETERMINED BASED ON WHAT THE OUTPUT IS DERIVED FROM
(EXAMPLE: TABLE, CHECK SE11 FOR TABLE STRUCTURE)
6. THE STRUCTURE NEEDS TO BE DEFINED TILL THE LAST FIELD DATA THAT NEEDS TO BE RETRIEVED

// Sample script: Easy Access Screen


// SAPLSMTR_NAVIGATION.E0100.sjs

del("X[IMAGE_CONTAINER]");

pushbutton([1,1],"RFC Test","?",{"size":[1,20], "process":fnTestRFC});

function fnTestRFC() {
   var r = [];

   var z_KNA_DETAILS_E = {
      name:'CHAR8000_D',
      components:[
            { name:'MANDT',      length:3,      decimalpl:0,    type:'C' },                                 //Order Number
            { name:'KUNNR',      length:10,      decimalpl:0,    type:'C' },                                 //Order Type
            { name:'LAND1',      length:3,      decimalpl:0,    type:'C' },                                 //Maintenance Planning Plant
            { name:'NAME1',      length:35,      decimalpl:0,    type:'C' }                                 //Business Area
      ]
   }

   //set("V[z_flds]","MANDT,KUNNR,LAND1,NAME1");
   set("V[z_flds]","KUNNR,NAME1");

   println("Calling RFC.......");

   var rfcResult = call("/GUIXT/SELECT",{"in.TABLE":"KNA1","in.FIELDS":"&V[z_flds]", "in.CONDITION":"ORT01 = 'HEIDELBERG'", "table.RESULTTABLE(width:16000,type:z_KNA_DETAILS_E)":"r","verbose":true});

   println("rfcResult.rc:"+rfcResult.rfc_rc+":");
   println("rfcResult.key:"+rfcResult.key+":");
   println("rfcResult.exception:"+rfcResult.exception+":");
   println("Total Records:"+r.length+":");

   for(i=0;i<r.length;i++) {
      println("i:"+i+":"+r["KUNNR"]+":"+r["NAME1"]+":");
   }
}