Show TOC

Function documentationSELECTION_FROM_FILE and FACTSELECTION_FROM_FILE for GETINFO Locate this document in the navigation structure

 

The SELECTION_FROM_FILE and FACTSELECTION_FROM_FILE instructions scan the specified ASCII file and build an SQL query based on all different combinations of certain dimensions found in the file. There is one difference between SELECTION_FROM_FILE and FACTSELECTION_FROM_FILE, when the dimensions to scan are taken by default. In this case, FACTSELECTION_FROM_FILE sets the time dimension to be TIMEID. SELECTION_FROM_FILE does not affect the time dimension name.

You use the following parameters with these instructions:

Variable

Description

variablename

The INFO variable in which to store the result. The default variable name is %SELECTION%.

file name

The name of the file to scan. This is a required parameter.

dimensions

The dimensions to scan in the file. The default dimensions are as follows:

  • category

  • time

  • entity

Example Example

In this example, the following GETINFO is used:

GETINFO(SELECTION_FROM_FILE,%SELECTION%,MYFILE.TXT,”CATEGORY,TIME”)

In this example, the contents of MYFILE.TXT are as follows:

CATEGORY, TIME, ENTITY, ACCOUNT, AMOUNT

ACTUAL,2000.JAN,ITALY,SALES,1234

ACTUAL,2000.FEB,ITALY,SALES,2345

ACTUAL,2000.JAN,FRANCE,SALES,3456

ACTUAL,2000.FEB,FRANCE,SALES,4567

BUDGET,2000.JAN,ITALY,SALES,5678

The result of the above instruction is the generation of the following INFO instruction:

INFO(%SELECTION%,”( ([CATEGORY]=’ACTUAL’ and [TIME]=’2000.JAN’) or _

([CATEGORY]=’ACTUAL’ and [TIME]=’2000.FEB’) or _

([CATEGORY]=’BUDGET’ and [TIME]=’2000.JAN’))”)

End of the example.

Example Example

This instruction can be used to dynamically decide what data to clear before importing a user-selected data file. The following samplescript comes from a typical data import package. Note how the generated %SELECTION% variable is used 'get in some subsequent TASK instruction.

'the data range to clear from the converted file

GETINFO(FACTSELECTION_FROM_FILE, %SELECTION%, %TEMPPATH%%TEMPFILE%)

'Modify Clear fact and wb tables tasks

TASK(DELETEDESTFACT,SQLSTATEMENT,DELETE FROM TBLFACT%APP% where %SELECTION%)

TASK(DELETEDESTWB,SQLSTATEMENT,DELETE FROM TBLFACTWB%APP% where %SELECTION%)

End of the example.

Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or by its gross negligence.