Pass the values like below :-
BAPI_PBSRVAPS_GETDETAIL2:Used to read key figure values from one data view for a planning book. The parameters key figure, key figure value and characteristic combination serve as return parameters.
The key figure details are contained in Key figure. These entries use the field CharComId to refer to the characteristics combinations in parameter Characteristics Combination for which they are valid. The key figure values for the individual periods of time are contained in parameter Key Figure Value.
By default, no macros are executed for DP planning books. If, however, to execute macros for the planning book or the data view, the field Macro Execution Flag must be set in parameter read options. In the case of SNP planning books on the other hand, macros are always executed.
CALLFUNCTION'BAPI_PBSRVAPS_GETDETAIL2'
EXPORTING
planningbook = planningbook Name
data_view = data view name
planning_version = planning version
read_options = gs_read_options
period_type = ’A’
date_from = date_from
date_to = date_to
TABLES
selection = gt_selection
group_by = gt_group_by
key_figure = gt_key_figure
key_figure_value = gt_key_figure_value
return = gt_return1.
There is a new book on Programming in SAP APO. You might want to check that out.