SAP Example

The following is a template example that uses the introspected BAPI BAPI_ALM_ORDERHEAD_GET_LIST

Test is the module's name given when introspecting the BAPI.
	imports = B.Test.BapiAlmOrderheadGetList.Imports()
	tables = B.Test.BapiAlmOrderheadGetList.Tables()
	
	//Completing a Table
	// currentRow is used to refer to the row to complete
	tables.itRanges = B.Test.BapiAlmOrderListheadRanges()
	tables.itRanges.currentRow.fieldName = 
	                               "OPTIONS_FOR_DOC_TYPE"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = "PM01"
	
	//Adds the row and moves to the next row to complete
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName = 
	                                "OPTIONS_FOR_PLANPLANT"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = "5300"
	
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName =
	                                "OPTIONS_FOR_COMP_CODE"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = "5560"
	
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName = 
	                                "SHOW_COMPLETED_DOCUMENTS"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = "X"
	
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName = 
	                                "SHOW_DOCUMENTS_IN_PROCESS"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = ""
	
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName = 
	                                "SHOW_OPEN_DOCUMENTS"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "EQ"
	tables.itRanges.currentRow.lowValue = ""
	
	appendRow tables.itRanges
	
	tables.itRanges.currentRow.fieldName = 
	                                "OPTIONS_FOR_CHANGE_DATE"
	tables.itRanges.currentRow.sign = "I"
	tables.itRanges.currentRow.option = "GE"
	tables.itRanges.currentRow.lowValue = "20060710"
	
	// "Exports" is defined to receive
	// the returned result from the BAPI
	Exports as B.Test.BapiAlmOrderheadGetList.Exports
	
	// Invoking the BAPI using the "call" method
	call B.Test.BapiAlmOrderheadGetList
	    using imports, 
	          tables 
	    returning tables = tables, 
	              Exports = Exports
	
	// Table iteration to display the rows
	for each row in tables.itRanges.rows do
	      display row
	end
	
	// Working with a table
	if size(tables.etResult) > 0 then
	    display tables.etResult
	end