Author Topic: RFC_READ_TABLE required authorizations  (Read 6851 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
RFC_READ_TABLE required authorizations
« on: June 10, 2022, 01:29:51 PM »
Purpose:
Required RFC authorizations for 'RFC_READ_TABLE' function module.

1. S_RFC: RFC_TYPE=FUGR, RFC_NAME=SYST, ACTVT=16
Note: Needed for sapnwrfc which is the newer RFC library from SAP


2. S_TABU_NAM: ACTVT=03, TABLE=SRGBTBREL
Note: Needed to check if attachment exists for work order or not (Table name will change as needed)




Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPLCORU.E3200.sjs       // IW41 Actual Data
----------------------------------------------------------------------------------------------------------------------------------------------
// Load the generic functions
load("stringFunctions.sjs");

// User Interface
pushbutton([TOOLBAR], "@4P@Attachments", '?', {'size':[2,32], 'process':iw41_viewAttachments});


// Related functions
// Function to open attachment list if it exists

function iw41_viewAttachments(){
   println("\n ==== Entered function iw41_viewAttachments ===\n");
   
   set("V[z_iw37n_order]","&F[Order]");
   var result = attachmentListExists(z_iw37n_order,12);
   if(!result){
      return("E: No attachments exists");
   } else {
      setcursor("F[Order]");
      enter('/2');
   }
   
   onscreen 'SAPLCOIH.3000'
      enter({'control':'GOSCONTAINERCTRL.Toolbar','item':'%GOS_TOOLBOX;75;89','event':2});      //Object for services
      
   onscreen 'SAPLSWUG.0100'   
      set("cell[TABLE,0,1]","X")
      enter();
      
   onscreen 'SAPLCOIH.3000'
      enter({'control':'GOSCONTAINERCTRL.Toolbar','item':'%GOS_VIEW_ATTA','event':1});              //Attachment List
   
}


// Function uses RFC call to check if attachment list exists for order
function attachmentListExists(strDocNum, nPadding, strYear){         
   println("\n ==== Entered function attachmentListExists ===\n");
   
   var z_in_query_table = "SRGBTBREL";
   if(hasValue(strYear)){
      var z_options = ["INSTID_A = '" + (padString(strDocNum,nPadding,PADDING_LEFT,"0")) + strYear + "'"];
   } else {
      var z_options = ["INSTID_A = '" + (padString(strDocNum,nPadding,PADDING_LEFT,"0")) + "'"];
   }
   var z_fields = ["INSTID_B"];
   var z_InstanceID = [];
   var bResult = false;

   rfcResult = call("RFC_READ_TABLE", {"in.QUERY_TABLE":"z_in_query_table",
                              "table.OPTIONS":"z_options",
                              "table.FIELDS":"z_fields",
                              "table.DATA(width:3000)":"z_InstanceID"});
   println("=====>> Check RFC_READ_TABLE Exception="+rfcResult.exception+"<==");
   println("=====>> Check z_InstanceID.length="+z_InstanceID.length+"<==");
   //FOL18          4 EXT44000000000134
   
   if(z_InstanceID.length>0){
      bResult = true;
   }
   return bResult;
}


See attachments for code samples!

« Last Edit: June 10, 2022, 01:32:05 PM by Benjamin Dasari »