SapGuiGridGetColumnTitles Function

Action

Returns a collection of strings that are used to display the title of a column. The grid control chooses the appropriate title according to the width of the column.

Include file

SapGui.bdh

Syntax

SapGuiGridGetColumnTitles( sControl  : in string allownull,
                           sColumn   : in string,
                           nIterator : out number) : boolean;
Parameter Description
sControl The unique ID of the grid control
sColumn The column's identifier for which to retrieve the titles
nIterator This parameter will be assigned a handle to the iterator

Return value

  • true if successful
  • false otherwise

Example

transaction TMain
  var
    nIterator : number;
    sColumn   : string;
    nType     : number;
  begin
    // Connecting to SAP
    gsConnID := SapGuiOpenConnection("/SAP_CODEPAGE=1100  /FULLMENU  atlis-minisap 00 /3 /UPDOWNLOAD_CP=2",
    "SapGuiOpenConnection");
  
    SapGuiSetActiveConnection(gsConnID);

    SapGuiSetActiveSession("ses[0]");

    // SAP
    SapGuiSetActiveWindow("wnd[0]", "SAP", SAPGUI_MATCH_ExactNoCase);

    SapGuiWindowAction(SAPGUI_WND_MAXIMIZE, "SapGuiWindowAction\\SAPGUI_WND_MAXIMIZE");

    // Logon to SAP System
    // Before running a test you have to customize the password parameter!
    ThinkTime(5.8);
    SapGuiLogon("bcuser", "minisap", "001", "", "SapGuiLogon");

    // SAP Easy Access
    SapGuiIgnoreError(SAPENGINE_STATUSBAR_CHANGED, SEVERITY_SUCCESS);
    SapGuiSetActiveWindow("wnd[0]", "SAP Easy Access", SAPGUI_MATCH_ExactNoCase);

    // Grid Control Info: /app/con[0]/ses[0]/wnd[0]/usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell/ 15 columns
    // -------------------------------------
    // 1: CARRID:ID
    // 2: CONNID:No.
    // 3: COUNTRYFR:Cty
    // 4: CITYFROM:Depart. city
    // 5: AIRPFROM:Airport
    // 6: COUNTRYTO:Cty
    // 7: CITYTO:Arrival city
    // 8: AIRPTO:Apt
    // 9: FLTIME:Flght time
    // 10: DEPTIME:Departure
    // 11: ARRTIME:Arrival
    // 12: DISTANCE:Distance
    // 13: DISTID:Dis.
    // 14: FLTYPE:Charter
    // 15: PERIOD:Day(s)

    SapGuiGridGetColumnTitles("usr/cntlBCALVC_TOOLBAR_D100_C1/shellcont/shell", "CONNID", nIterator);
    while SapGuiIteratorHasMore(nIterator) do
      SapGuiIteratorFetchNext(nIterator);
      SapGuiIteratorGetValue(nIterator, sColumn, nType);
      Print(sColumn);
    end;
    SapGuiIteratorRelease(nIterator);

  end TMain;