﻿// add two columns
Column "Name" name="vendorname" size=20 position=4 -readonly
Column "City" name="vendorcity" size=20 position=5 -readonly

// reset column data
Clear V[vendorname.*]
Clear V[vendorcity.*]

// row number
Set V[i] 1

// absolute row number
GetTableAttribute T[Table] firstvisiblerow=k


// process all rows
label nextrow

Set V[vendorno] "&cell[Table,EORD-LIFNR,&V[i]]"
if V[vendorno]
  
  // Read vendor address
  CreateStructure V[bapivendorinfo] name city
  Call "BAPI_VENDOR_GETDETAIL" cache="session" _
    export.VENDORNO="vendorno" _
    import.GENERALDETAIL="bapivendorinfo"
  
  // fill columns
  Set V[vendorname.&V[k]]  "&V[bapivendorinfo.name]"
  Set V[vendorcity.&V[k]]  "&V[bapivendorinfo.city]"
  
  // next row
  Set V[i] &V[i] + 1
  Set V[k] &V[k] + 1
  goto nextrow
  
endif

