Der All,
is that possible to use views(attribute,analytic and calculation views) of HANA trial account in sap ABAP system.
if 'YES' please provide me the proper documentation.
Thanks and Regards
Ashwin M V
Der All,
is that possible to use views(attribute,analytic and calculation views) of HANA trial account in sap ABAP system.
if 'YES' please provide me the proper documentation.
Thanks and Regards
Ashwin M V
Hi Gungor,
Last Friday I had a Code Jam event in NL and asked for input on this question. They acknowledged performance issues, but these should have been resolved with HANA SP 10.
On which HANA SP are you running?
I'll definitely try out you approach as well and do some testing again on this topic by using functions.
Thanks for sharing your experience.
Regards,
Bart
Hello Florian,
thanks for your reply
you know classical alv can display totals per unit,
so i disappointed to hear that ida alv is not able to do collect amounts or quantities per unit or currency
i will try your suggestion by grouping sales units
Hello All,
I have created an ABAP CDS view with input parameters and I am using Odata.publish:true annotation to generate odata service. Now when i see the metadata of the service, I found 2 entities. One for input parameter and the other for ABAP CDS view with input parameter as a common field in both entities. Now when i try to fetch the data using "/entitySet1?$expand=navigationProperty(inputParameter='parameterValue')", it does not give me any data. I tried to debug and i found that input parameter is being passed as initial value. Any help here would great. The system that is used has NW 750 SP02.
Thanks and Best Regards,
Govind
Can you try a URL like this:
/entitySet1(inputParameter='parameterValue')/navigationProperty
Regards, Thomas
Thanks a lot Thomas. It worked.
Hello Sijin,
there are different tools and ways you can use information views from SAP HANA. Just to list a view:
Regards,
Florian
Hi Gaurav,
I have AFO v. 2.1.3 probably you need an upgrade on that.
Best
Linh
REPORT ZSG_ALV_HIERARCHICAL_SO.
TYPE-POOLS:SLIS.
TABLES:VBAK,VBAP.
TYPES: BEGIN OF TY_VBAK,
VBELN TYPE VBAK-VBELN, "SALES DOC
ERDAT TYPE VBAK-ERDAT, "DATE ON WHICH RECORD CREATED
ERNAM TYPE VBAK-ERNAM, "NAME OF PERSON RECORD CREATED
AUDAT TYPE VBAK-AUDAT, "DOC DATE
AUART TYPE VBAK-AUART, "SALES DOC
VKORG TYPE VBAK-VKORG, "Sales Organization
VTWEG TYPE VBAK-VTWEG, "Distribution Channel
SPART TYPE VBAK-SPART, "Division
VKGRP TYPE VBAK-VKGRP, "Sales Group
EXPAND,
END OF TY_VBAK.
DATA:LT_VBAK TYPE TABLE OF TY_VBAK,
LS_VBAK TYPE TY_VBAK.
TYPES:BEGIN OF TY_VBAP,
VBELN TYPE VBAP-VBELN, "SALES DOC
POSNR TYPE VBAP-POSNR, "SALES DOC ITEM
MATNR TYPE VBAP-MATNR, "MATERIAL NUMBER
MATKL TYPE VBAP-MATKL, "MATERIAL GRP
WERKS TYPE VBAP-WERKS, "PLANT
LGORT TYPE VBAP-LGORT, "STOARGE LOC
NETPR TYPE VBAP-NETPR, "NETPRICE
END OF TY_VBAP.
DATA: LT_VBAP TYPE TABLE OF TY_VBAP,
LS_VBAP TYPE TY_VBAP,
LT_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
* LS_FCAT TYPE SLIS_FIELDCAT_ALV,
S_KEYINFO TYPE SLIS_KEYINFO_ALV,
S_LAYOUT TYPE SLIS_LAYOUT_ALV.
SELECTION-SCREEN : BEGIN OF BLOCK B WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : P_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN : END OF BLOCK B.
START-OF-SELECTION.
PERFORM READ.
PERFORM FCAT.
PERFORM KEYINFO.
PERFORM DISPLAY.
PERFORM LAYOUT.
*&---------------------------------------------------------------------*
*& Form READ
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM READ .
SELECT VBELN
ERDAT
ERNAM
AUDAT
AUART
VKORG
VTWEG
SPART
VKGRP
FROM VBAK INTO TABLE LT_VBAK
WHERE VBELN IN P_VBELN.
IF LT_VBAK[] IS NOT INITIAL.
SELECT VBELN
POSNR
MATNR
MATKL
WERKS
LGORT
NETPR
FROM VBAP INTO TABLE LT_VBAP
FOR ALL ENTRIES IN LT_VBAK
WHERE VBELN = LT_VBAK-VBELN.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'LT_VBAK'
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = LT_FCAT[]
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'LT_VBAP'
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = SY-REPID
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
CHANGING
CT_FIELDCAT = LT_FCAT[]
* EXCEPTIONS
* INCONSISTENT_INTERFACE = 1
* PROGRAM_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form KEYINFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM KEYINFO .
S_KEYINFO-HEADER01 = 'VBELN'.
S_KEYINFO-ITEM01 = 'VBELN'.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
IS_LAYOUT = S_LAYOUT
IT_FIELDCAT = LT_FCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
I_TABNAME_HEADER = 'LT_VBAK'
I_TABNAME_ITEM = 'LT_VBAP'
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
IS_KEYINFO = S_KEYINFO
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IR_SALV_HIERSEQ_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB_HEADER = LT_VBAK
T_OUTTAB_ITEM = LT_VBAP
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM LAYOUT .
S_LAYOUT-EXPAND_FIELDNAME = 'EXPAND'.
S_LAYOUT-WINDOW_TITLEBAR = 'HIERARCHICAL ALV LIST DISPLAY'.
S_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM.
HI,
Could any one please let me know how to use select-option in AMDP .I have seen the post on scn and tried to apply but it gives me syntax error.same code in abap is not giving syntax error.
SELECT MATNR, SPMON, SUM( MZUBB) AS MZUBB, SUM( WZUBB ) AS WZUBB,
SUM( MGVBR) AS MGVBR, SUM( WGVBR) AS WGVBR,
SUM( MAGBB) AS MAGBB, SUM( WAGBB ) AS WAGBB,WERKS
FROM S031
WHERE (IV_WHERE_CLAUSE)
GROUP BY MATNR,SPMON,WERKS;
here where clause is dynamic generated by class and method.
it says incorrect syntax near group by.i am writing this code inside AMDP implementation.
or else can anyone give step by step process to handle select option in amdp and consume it in our existing abap report.
also in my system i am not able to find cl_shdb_seltab? is there any alternative to this? please give full steps to acheive this..
Regarding the missing CL_SHDB_SELTAB class you have to implement note 2124672.
In an AMDP you cannot specify the where clause in a dynamic way as you did it. You have to use the APPLY_FITLER functionality like described in the blog of Carine (except you create a complete dynamic statement, which is not recommend).
Hi Rohit
did you solve your problem. I'm stucking in a similar problem (SAP HANA SP09)
Regards
Thomas
Hi Bart,
Our HANA is sp10 but there is still performance problem, Solution I applied is in productive system for some time and it is ok, and I find out nested casting available in ABAP 7.5 ( we are currently 7.40) So in a system where SP is ABAP 7.50 above approach can be applied using only one view instead of three.
Regards,
Gungor
Hello,
Is it possible to pass dynamic internal tables to amdp? My requirement is to pick 6 fields from the internal table.The 6 fields will be constant but the structure of the internal table can vary based on user selection i.e it can have 20 fields in one case and 15 the next time.I am not able to define an internal table with type any in amdp.I guess we need to use a table type only but am not sure how to declare in this case.
Thanks,
Prem
Hi Friends,
Need some help with association in CDS view.
I am trying to convert the below join ddl using association. But getting error "Table b unknown or shadowed by an alias" at line number 47. Please help, what mistake I am making here.
@AbapCatalog.sqlViewName: 'ZTRM_BOOK' @AbapCatalog.compiler.CompareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Flight Booking Data' define view Ztrm_Book_DDL as select from sbook as a join spfli as b on a.carrid = b.carrid and a.connid = b.connid join scarr as c on a.carrid = c.carrid join sairport as d on b.airpfrom = d.id join sairport as e on b.airpto = e.id { a.carrid as carrid, a.connid as connid, fldate, bookid, passname, forcuram, b.airpfrom, d.name as airportfrom, cityfrom, countryfr, airpto, e.name as airportto, countryto, cityto, carrname, url, class, loccuram, loccurkey, order_date, agencynum } --------------------------------------------------------------------------------------------------------------------------------------------------------- @AbapCatalog.sqlViewName: 'ZTRM_BOOK' @AbapCatalog.compiler.CompareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Flight Booking Data' define view Ztrm_Book_DDL as select from sbook as a association [1] to spfli as b on a.carrid = b.carrid and a.connid = b.connid association [1] to scarr as c on a.carrid = c.carrid association [1] to SAIRPORT as d on b.airpfrom = d.id //Table b unknown or shadowed by an alias association [1] to sairport as e on b.airpto = e.id { a.carrid as carrid, a.connid as connid, fldate, bookid, passname, forcuram, b.airpfrom, d.name as airportfrom, cityfrom, countryfr, airpto, e.name as airportto, countryto, cityto, carrname, url, class, loccuram, loccurkey, order_date, agencynum // _association_name // Make association public }
1. Native SQL is connecting to other DB Servers(MDM/BW….) and fetching data from tables not in R/3. How to handle in HANA.
2.Views/table which are not present in R/3 but available in oracle DB. Would these be created automatically after migration or CDS views should be created manually ? To handle this, do we need to create local/dictionary structures/tables manually ?
3. Please explain the below native SQL code as SUM-ROOT in where is not populated anywhere in the code.Also how to rewrite for HANA DB.
Hi,
I am looking for information on performance implications when a parameterized CDS View is queries using OPENSQL with WHERE Clause. Suppose, if we have a CDS View as
define view Ztest
with parameters p_a : s_type
from ztable1 as t1 join
ztable2 as t2
on t1.f1 = t2.f1
and t2.a = $parameters.p_a {
t1.f1,
t2.f2,
t2.f3,
t1.f4,
t1.f5 // field used to be filtered by select option
}
and if we query this from OPENSQL as follows:
DATA(lv_a) = '0001'.
SELECT f1, f2, f3, f4
FROM Ztest( p_a = @lv_a )
WHERE f5 in s_f5. " Query Q
Now my understanding is that if it were a simple CDS View (i.e. without parameters) I believe the where condition would have been pushed down while creation the execution plan for the query Q. Is it correct? Please correct me if I am wrong here.
But in case of parameterized view, since it is saved as a table function inside the DB, so I believe that this function will be called first when the query Q is executed and once we have the result returned from the table function, WHERE clause will be applied after that. Is my understanding correct here?
I need to know this as I am trying this approach in a couple of my objects and need to understand this. If it is going to be heavy on performance, can you please suggest me what could be the possible other way to achieve this with CDS. I want to keep AMDP as last resort. The reason why I am going with parameterized approach is because I am reusing it. I know that we can't pass select options to the CDS View and that's why I am using in WHERE clause of OPENSQL.
Thanks!
Tried some options and this seemed to work.
@AbapCatalog.sqlViewName: 'ZTRM_BOOK' @AbapCatalog.compiler.CompareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'Flight Booking Data' define view Ztrm_Book_DDL as select from sbook as a join spfli as b on a.carrid = b.carrid and a.connid = b.connid association [1] to scarr as c on $projection.carrid = c.carrid association [1] to sairport as d on $projection.airpfrom = d.id association [1] to sairport as e on $projection.airpto = e.id { a.carrid as carrid, a.connid as connid, fldate, bookid, passname, forcuram, b.airpfrom, d.name as airportfrom, cityfrom, countryfr, airpto, e.name as airportto, countryto, cityto, c.carrname, c.url, class, loccuram, loccurkey, order_date, agencynum // _association_name // Make association public }
Hi Experts,
I want to ask how to link Sales text of material master in ABAP Query, I already have "Read_Text" call function for script.
Please guide me from where i have to pick ABAP code of call function and how to update it in info set of query.
Given is my whole call function abap code. kindly teach me step by step process update call function.
************************************************
FUNCTION READ_TEXT.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(CLIENT) LIKE SY-MANDT DEFAULT SY-MANDT
*" VALUE(ID) LIKE THEAD-TDID
*" VALUE(LANGUAGE) LIKE THEAD-TDSPRAS
*" VALUE(NAME) LIKE THEAD-TDNAME
*" VALUE(OBJECT) LIKE THEAD-TDOBJECT
*" VALUE(ARCHIVE_HANDLE) LIKE SY-TABIX DEFAULT 0
*" VALUE(LOCAL_CAT) DEFAULT SPACE
*" EXPORTING
*" VALUE(HEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(OLD_LINE_COUNTER) TYPE THEAD-TDTXTLINES
*" TABLES
*" LINES STRUCTURE TLINE
*" EXCEPTIONS
*" ID
*" LANGUAGE
*" NAME
*" NOT_FOUND
*" OBJECT
*" REFERENCE_CHECK
*" WRONG_ACCESS_TO_ARCHIVE
*"----------------------------------------------------------------------
" B20K074874 ... READ_TEXT resolves references in CATALOG
" with READ_REFERENCE_LINES
" resolve references for texts created with COPY_TEXTS
" B20K024363 ... Replace SY-TFILL with DESCRIBE
" B20K023213 ... Optimizing Performance with referenced texts
" B20K019187 ... New module COPY_TEXTS
" B20K019113 ... Process non-SAPscript texts
*-----------------------------------------------------------------------
DATA THEADER LIKE THEAD.
DATA STXH_WA LIKE STXH.
DATA NEWTEXT LIKE BOOLEAN.
DATA L_LANGUAGE(2). " for two char language code
*...Prüfen ob vom Archiv gelesen werden soll............................
IF ARCHIVE_HANDLE > 0.
CALL FUNCTION 'TEXT_READ_ARCHIVE_OBJECT'
EXPORTING ARCHIVE_HANDLE = ARCHIVE_HANDLE
ID = ID
LANGUAGE = LANGUAGE
NAME = NAME
OBJECT = OBJECT
CLIENT = CLIENT
IMPORTING HEADER = HEADER
TABLES LINES = LINES
EXCEPTIONS NOT_FOUND = 1
WRONG_ACCESS_TO_ARCHIVE = 2.
CASE SY-SUBRC.
WHEN 1. MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
WHEN 2. MESSAGE A020 RAISING WRONG_ACCESS_TO_ARCHIVE.
ENDCASE.
EXIT.
ENDIF.
*...Initialisierung.....................................................
NEWTEXT = FALSE.
REFERENCE = FALSE.
*...Pruefen Aufrufparameter.............................................
PERFORM CHECK_KEY USING OBJECT NAME ID LANGUAGE.
perform check_catalog_local using local_cat.
*...Text aus Textmemory lesen...........................................
IF TTXOB-TDSAVEMODE = SAVEMODE_POSTING.
PERFORM IMPORT_CATALOG.
if client = sy-mandt.
PERFORM READ_CATALOG USING OBJECT NAME ID LANGUAGE.
IF SY-SUBRC = 0.
CASE CATALOG-FUNCTION.
* text will be deleted
WHEN FUNCTION_DELETE.
REFRESH LINES. CLEAR LINES.
CALL FUNCTION 'SAPSCRIPT_MESSAGE_DEF'
EXPORTING NO = 600
V1 = NAME
V2 = ID
V3 = LANGUAGE.
MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
* text will be created new
WHEN FUNCTION_INSERT.
CLEAR THEADER. REFRESH LINES. "B20K074874
IMPORT THEAD TO THEADER "
TLINE TO LINES "
FROM MEMORY ID MEMORY_ID. "
HEADER = THEADER. "
HEADER-TDNAME = CATALOG-TDNAME. "
PERFORM READ_REFERENCE_LINES TABLES LINES "
USING CLIENT "
HEADER. "
DESCRIBE TABLE LINES LINES HEADER-TDTXTLINES. "
* text will be updated
WHEN FUNCTION_UPDATE.
CLEAR THEADER. REFRESH LINES. "B20K074874
IMPORT THEAD TO THEADER "
TLINE TO LINES "
FROM MEMORY ID MEMORY_ID. "
HEADER = THEADER. "
PERFORM READ_REFERENCE_LINES TABLES LINES "
USING CLIENT "
HEADER. "
DESCRIBE TABLE LINES LINES HEADER-TDTXTLINES. "
* text will be copied from other DB text at COMMIT_TEXT
WHEN FUNCTION_COPY.
PERFORM IMPORT_COPY_CATALOG.
READ TABLE COPY_CATALOG INDEX CATALOG-COPYINDEX.
IF SY-SUBRC = 0.
HEADER-TDOBJECT = CATALOG-TDOBJECT.
HEADER-TDNAME = CATALOG-TDNAME.
HEADER-TDID = CATALOG-TDID.
HEADER-TDSPRAS = CATALOG-TDSPRAS.
THEADER-TDOBJECT = COPY_CATALOG-TDOBJECT.
THEADER-TDNAME = COPY_CATALOG-TDNAME.
THEADER-TDID = COPY_CATALOG-TDID.
THEADER-TDSPRAS = COPY_CATALOG-TDSPRAS.
PERFORM BUILD_COPY_HEADER USING HEADER
THEADER
FUNCTION_COPY.
IF THEADER-TDREFOBJ = SPACE AND "B20K074874
THEADER-TDREFID = SPACE AND "
THEADER-TDREFNAME = SPACE. "
PERFORM READ_TEXTLINES TABLES LINES "
USING THEADER "
SY-MANDT. "
ELSE. "
PERFORM READ_REFTEXT_LINES TABLES LINES "
USING THEADER "
SY-MANDT. "
ENDIF.
header-tdtxtlines = theader-tdtxtlines.
ENDIF.
* text will be updated from other DB text at COMMIT_TEXT
WHEN FUNCTION_COPYUPDATE.
PERFORM IMPORT_COPY_CATALOG.
READ TABLE COPY_CATALOG INDEX CATALOG-COPYINDEX.
IF SY-SUBRC = 0.
SELECT SINGLE * FROM STXH INTO STXH_WA
WHERE TDOBJECT = CATALOG-TDOBJECT
AND TDNAME = CATALOG-TDNAME
AND TDID = CATALOG-TDID
AND TDSPRAS = CATALOG-TDSPRAS.
CHECK SY-SUBRC = 0.
MOVE-CORRESPONDING STXH_WA TO HEADER.
THEADER-TDOBJECT = COPY_CATALOG-TDOBJECT.
THEADER-TDNAME = COPY_CATALOG-TDNAME.
THEADER-TDID = COPY_CATALOG-TDID.
THEADER-TDSPRAS = COPY_CATALOG-TDSPRAS.
PERFORM BUILD_COPY_HEADER USING HEADER
THEADER
FUNCTION_COPYUPDATE.
IF THEADER-TDREFOBJ = SPACE AND "B20K074874
THEADER-TDREFID = SPACE AND "
THEADER-TDREFNAME = SPACE. "
PERFORM READ_TEXTLINES TABLES LINES "
USING THEADER "
SY-MANDT. "
ELSE. "
PERFORM READ_REFTEXT_LINES TABLES LINES "
USING THEADER "
SY-MANDT. "
ENDIF.
header-tdtxtlines = theader-tdtxtlines.
ENDIF.
* no action is performed since text was created and deleted
WHEN FUNCTION_NONE.
REFRESH LINES. CLEAR LINES.
CALL FUNCTION 'SAPSCRIPT_MESSAGE_DEF'
EXPORTING NO = 600
V1 = NAME
V2 = ID
V3 = LANGUAGE.
MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
ENDCASE.
ELSE.
NEWTEXT = TRUE.
ENDIF.
else.
newtext = true.
endif.
ENDIF.
*...Text aus Textdatei lesen............................................
IF TTXOB-TDSAVEMODE = SAVEMODE_DIALOG OR NEWTEXT = TRUE.
SELECT SINGLE * FROM STXH CLIENT SPECIFIED
WHERE MANDT = CLIENT
AND TDOBJECT = OBJECT
AND TDNAME = NAME
AND TDID = ID
AND TDSPRAS = LANGUAGE.
IF SY-SUBRC > 0.
WRITE LANGUAGE TO L_LANGUAGE(2).
CALL FUNCTION 'SAPSCRIPT_MESSAGE_DEF'
EXPORTING NO = 600
V1 = NAME
V2 = ID
V3 = L_LANGUAGE.
MESSAGE E600 WITH NAME ID LANGUAGE RAISING NOT_FOUND.
ELSE.
MOVE-CORRESPONDING STXH TO HEADER.
OLD_LINE_COUNTER = HEADER-TDTXTLINES.
IF STXH-TDREF = TRUE.
PERFORM READ_REFTEXT_LINES TABLES LINES
USING HEADER
CLIENT.
ELSE.
PERFORM READ_TEXTLINES TABLES LINES
USING HEADER
CLIENT.
IF SY-SUBRC > 0.
REFRESH LINES. CLEAR LINES.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*...Ausgabeparameter setzen.............................................
if header-tdtexttype is initial. " just for ITF
HEADER-TDLINESIZE = TTXOB-TDLINESIZE.
endif.
ENDFUNCTION.
* read LINES of a reference text found in CATALOG "B20K074874
* returns SY-SUBRC = 0 if found
FORM READ_REFERENCE_LINES TABLES LINES STRUCTURE TLINE
USING CLIENT
VALUE(HEADER) LIKE THEAD.
STATICS: TEXT_IN_CATALOG LIKE BOOLEAN.
TEXT_IN_CATALOG = TRUE.
PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ "sets REFERENCE
HEADER-TDREFNAME
HEADER-TDREFID.
IF REFERENCE = FALSE.
EXIT.
ENDIF.
* resolve reference chain in CATALOG
WHILE REFERENCE = TRUE AND TEXT_IN_CATALOG = TRUE.
PERFORM READ_CATALOG USING HEADER-TDREFOBJ
HEADER-TDREFNAME
HEADER-TDREFID
HEADER-TDSPRAS.
IF SY-SUBRC = 0.
* read header from MEMORY
CASE CATALOG-FUNCTION.
* text will be deleted
WHEN FUNCTION_DELETE.
MESSAGE E610 WITH CATALOG-TDOBJECT
CATALOG-TDID
CATALOG-TDNAME
CATALOG-TDSPRAS
RAISING REFERENCE_CHECK.
* text will be created new
WHEN FUNCTION_INSERT.
IMPORT THEAD TO HEADER
TLINE TO LINES
FROM MEMORY ID MEMORY_ID.
PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ "sets REFERENCE
HEADER-TDREFNAME
HEADER-TDREFID.
* text will be updated
WHEN FUNCTION_UPDATE.
IMPORT THEAD TO HEADER
TLINE TO LINES
FROM MEMORY ID MEMORY_ID.
PERFORM CHECK_REFERENCE USING HEADER-TDREFOBJ "sets REFERENCE
HEADER-TDREFNAME
HEADER-TDREFID.
* text will be copied from DB text at COMMIT_TEXT
WHEN FUNCTION_COPY. "COPY_TEXTS copies from DB
TEXT_IN_CATALOG = FALSE.
WHEN FUNCTION_COPYUPDATE. "COPY_TEXTS copies from DB
TEXT_IN_CATALOG = FALSE.
WHEN FUNCTION_NONE. "read from DB
TEXT_IN_CATALOG = FALSE.
ENDCASE.
ELSE.
TEXT_IN_CATALOG = FALSE.
ENDIF.
ENDWHILE.
IF REFERENCE = TRUE.
REFRESH LINES.
* read text from DB?
IF TEXT_IN_CATALOG = FALSE.
PERFORM READ_REFTEXT_LINES TABLES LINES
USING HEADER
CLIENT.
*
ENDIF.
ELSE.
* LINES have been filled by IMPORT ....
ENDIF.
ENDFORM.
***************************************************************************************************************
Regards,
Qamber Abbas