‎2016 Jun 22 1:44 PM
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 Number | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7 | Column 8 |
|---|---|---|---|---|---|---|---|
| 1234567890 | ABC | 123 | 41 | ASAHS | JHSJDH | HAJSHDJ | HJAHS |
| 1234567891 | CDF | 123 | 231 | MMMM | HAJDHJ | JHJADHJAS | JHADJ |
| 1234567892 | SDS | 1133 | 33 | JCCC | JHASDJH | AJDHSD | MMMM |
| 1234567893 | ASDS | 1 | 76 | DDD | DDD | ASD | JHAJSD |
But when i am calling the same view in ABAP report, doc number's value is changed to null.
| Doc Number | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7 | Column 8 |
|---|---|---|---|---|---|---|---|
| ABC | 123 | 41 | ASAHS | JHSJDH | HAJSHDJ | HJAHS | |
| CDF | 123 | 231 | MMMM | HAJDHJ | JHJADHJAS | JHADJ | |
| SDS | 1133 | 33 | JCCC | JHASDJH | AJDHSD | MMMM | |
| ASDS | 1 | 76 | DDD | DDD | ASD | JHAJSD |
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
‎2016 Jun 22 4:07 PM
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
‎2016 Jun 22 6:26 PM
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
‎2016 Jun 22 6:29 PM
Show us some coding, otherwise it is a kind of quiz to find the specific problem out of the possible ones.
‎2016 Jun 22 6:38 PM
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
‎2016 Jun 22 7:23 PM
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).
‎2016 Jun 22 7:39 PM
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.
‎2016 Jun 23 11:48 AM
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
‎2016 Jun 23 5:33 PM
Hi Amol,
The length in HANA view is varchar 10 and it is same in the program also.
Vijay
‎2016 Jun 24 11:26 AM