Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Column value as null in ABAP program while calling Calculation View

Former Member
0 Likes
1,258

Hi All,

I have created a scripted calculation view which data from multiple standard and custom tables.

The output in hana studio is like below (all output fields are nvarchar type)

Doc NumberColumn 2Column 3Column 4Column 5Column 6Column 7Column 8
1234567890ABC12341ASAHSJHSJDHHAJSHDJHJAHS
1234567891CDF123231MMMMHAJDHJJHJADHJASJHADJ
1234567892SDS113333JCCCJHASDJHAJDHSDMMMM
1234567893ASDS176DDDDDDASDJHAJSD

But when i am calling the same view in ABAP report, doc number's value is changed to null.

Doc NumberColumn 2Column 3Column 4Column 5Column 6Column 7Column 8
ABC12341ASAHSJHSJDHHAJSHDJHJAHS
CDF123231MMMMHAJDHJJHJADHJASJHADJ
SDS113333JCCCJHASDJHAJDHSDMMMM
ASDS176DDDDDDASDJHAJSD

The columns in HANA calculation view and the internal table in ABAP report both refer to the same Database Table.

Please help here.

Thanks,

Vijay Sah

9 REPLIES 9
Read only

pfefferf
Active Contributor
0 Likes
1,193

Hello Vijay,

how do you consume the calculation view on the ABAP side? Via an external view or via ADBC or ...?

How do you visualize the data.

There can be several reasons for the issue depending on what you are using. Please provide more information on that.

Regards,

Florian

Read only

Former Member
0 Likes
1,193

Hi Florian,

I have used native sql to consume the view and the data is shown in form of a ALV grid.

Please suggest.

Thanks,

Vijay

Read only

pfefferf
Active Contributor
0 Likes
1,193

Show us some coding, otherwise it is a kind of quiz to find the specific problem out of the possible ones.

Read only

Former Member
0 Likes
1,193

Hi Florian,

Below is the code which I have used for calling the view.


lv_mandt = sy-mandt.

   IF sy-sysid = 'ECD' OR sy-sysid = 'ECQ'.

     lv_sql = | SELECT "DOC_NUMBER","GJAHR", "MONAT", "BUDAT", "BUKRS", "BLART","BUZEI","ZBAT_ID","USNAM","CPUDT","ZSTATUS",|

              && |"BKTXT", "WAERS", "XBLNR", "GSBER", |

              && |"HKONT", "ZZACT", "ZZCOUNTRY", "SHKZG", "KOART", "WRBTR","PROJK", "MENGE", "MEINS", "SGTXT",  |

              && |"PERNR", "HWAER",  "DMBTR", "BILKT", "TXT50", "GLDESC", "ZDES", "PSPHI", "POSTU", "PRCTR" FROM |

              && | "_SYS_BIC"."Infy.FI_TILL_ECQ_ONLY/ZFI_CALSQL_ECA" |.

   ELSE.

     lv_sql = | SELECT "DOC_NUMBER","GJAHR", "MONAT", "BUDAT", "BUKRS", "BLART","BUZEI","ZBAT_ID","USNAM","CPUDT","ZSTATUS",|

              && |"BKTXT", "WAERS", "XBLNR", "GSBER", |

              && |"HKONT", "ZZACT", "ZZCOUNTRY", "SHKZG", "KOART", "WRBTR","PROJK", "MENGE", "MEINS", "SGTXT",  |

              && |"PERNR", "HWAER",  "DMBTR", "BILKT", "TXT50", "GLDESC", "ZDES", "PSPHI", "POSTU", "PRCTR" FROM |

               && | "_SYS_BIC"."Infy.FI/ZFI_CALSQL_ECA" |.

   ENDIF.

   lv_sql = |{ lv_sql }|

   && | ('PLACEHOLDER' = ('$$INP_BUKRS_HIGH$$', '{ lv_bukrs }' ), |

               && | 'PLACEHOLDER' = ('$$INP_BUKRS_LOW$$', '{ so_bukrs-low }' ), |

               && | 'PLACEHOLDER' = ('$$INP_MONAT$$', '{ lv_monat }' ),|

               && | 'PLACEHOLDER' = ('$$INP_MANDT$$', '{ lv_mandt }' ),|

               && | 'PLACEHOLDER' = ('$$INP_GJAHR$$', '{ p_gjahr }' ))|.

   CONDENSE lv_sql.

   TRY.

       lo_result = NEW cl_sql_statement( )->execute_query( lv_sql ).

*     Assign refference to lr_data1 table as gt_final

       GET REFERENCE OF gt_finaltab INTO lr_data.

*     Set table data from result to lr_data1 it will be assigned

       lo_result->set_param_table( lr_data ).

       lo_result->next_package( ).

       lo_result->close( ).

     CATCH cx_sql_exception INTO lx_sql_exc.

       lv_err = lx_sql_exc->get_text( ).

       MESSAGE lv_err TYPE 'E'.

   ENDTRY.

Thanks,

Vijay

Read only

0 Likes
1,193

So you have two different calc views that you call based on the sysid.

Do both of them return a filled DOC_NUMBER column in HANA Studio? You only showed one of them (not sure which).

Read only

Former Member
0 Likes
1,193

Both of the calc view has same code and output. And the problem is with both of them returning the column as null value. both are returning correct value in hana studio.

Read only

0 Likes
1,193

Hello Vijay,

When you use data preview in HANA view it shows exact data without bothering length of data type of that column.

Please check length of HANA view column.

-Amol S

Read only

Former Member
0 Likes
1,193

Hi Amol,

The length in HANA view is varchar 10 and it is same in the program also.

Vijay

Read only

0 Likes
1,193

Its better to raise OSS...