‎2005 Aug 01 1:59 PM
I don't have much ABAP experience. I want to convert records in a BW datapak to a new account number scheme, which is contained in a database table.
Is this the most efficient way to do it?
Also, I am particularly concerned about the modify statement, is it only modifying the one line, or is it modifying the whole datapak table?
Thanks for any help.
PROGRAM CONVERSION_ROUTINE.
TYPES: BEGIN OF TRANSFER_STRUCTURE ,
record TYPE rsarecord,
CHART_OF_ACCTS TYPE P,
SEGMENT1(000025) TYPE C,
SEGMENT2(000025) TYPE C,
SEGMENT3(000025) TYPE C,
END OF TRANSFER_STRUCTURE .
TYPES: TAB_TRANSTRU type table of TRANSFER_STRUCTURE.
DATA: WA LIKE /BIC/AZORA_O_N00,
ITAB TYPE STANDARD TABLE OF /BIC/AZORA_O_N00 WITH HEADER LINE.
FORM STARTROUTINE
USING G_S_MINFO TYPE RSSM_S_MINFO
CHANGING DATAPAK type TAB_TRANSTRU
G_T_ERRORLOG TYPE rssm_t_errorlog_int
ABORT LIKE SY-SUBRC.
DATA: l_s_datapak_line type TRANSFER_STRUCTURE,
l_s_errorlog TYPE rssm_s_errorlog_int.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM /BIC/AZORA_O_N00.
LOOP AT DATAPAK INTO L_S_DATAPAK_LINE.
READ TABLE ITAB WITH KEY
SOURSYSTEM = 'OR'
ORA_COAID = L_S_DATAPAK_LINE-CHART_OF_ACCTS
ORA_CCTR = L_S_DATAPAK_LINE-SEGMENT2
ORA_ACCNT = L_S_DATAPAK_LINE-SEGMENT3.
IF SY-SUBRC = 0.
L_S_DATAPAK_LINE-SEGMENT2 = ITAB-/BIC/ZORA_CCTR.
L_S_DATAPAK_LINE-SEGMENT3 = ITAB-/BIC/ZORA_ACCT.
MODIFY DATAPAK FROM L_S_DATAPAK_LINE.
ENDIF.
ENDLOOP.
ABORT = 0.
ENDFORM.
<b></b><b></b><b></b>
‎2005 Aug 01 2:06 PM
‎2005 Aug 01 2:05 PM
Hi Jerry,
in your coding statement "MODIFY DATAPAK FROM L_S_DATAPAK_LINE." is in a loop.
so all records of "DATAPAK", which are found in migration-table "ITAB" are modified.
regards Andreas
‎2005 Aug 01 2:05 PM
U can convert the select to -
SELECT * INTO CORRESPONDING FIELDS OF TABLE ITAB FROM /BIC/AZORA_O_N00
for all entries in DATAPAK
where ORA_COAID = DATAPAK_LINE-ACCTS AND
ORA_CCTR = DATAPAK_LINE-SEGMENT2 AND
ORA_ACCNT = DATAPAK_LINE-SEGMENT3
AND SOURSYSTEM = 'OR'.
This will result in less number of entries in ITAB.
‎2005 Aug 01 2:06 PM
‎2005 Aug 01 2:06 PM
The way you are doing is good.
In this case only one record of DATAPACK will be modified at a time depends on the value from L_S_DATAPAK_LINE.
‎2005 Aug 01 2:07 PM
Hi Jerry,
Just add this lines(Transporting) also in the modify statement to make it more efficient.This modify statement would modify the whole datapak table if the read statement pacifies.
IF SY-SUBRC = 0.
L_S_DATAPAK_LINE-SEGMENT2 = ITAB-/BIC/ZORA_CCTR.
L_S_DATAPAK_LINE-SEGMENT3 = ITAB-/BIC/ZORA_ACCT.
MODIFY DATAPAK FROM L_S_DATAPAK_LINE TRANSPORTING /BIC/ZORA_CCTR /BIC/ZORA_ACCT .
ENDIF.
Regards
Abhishek
‎2005 Aug 01 2:16 PM
It seems a little redundant and wasteful to read the datapak line by line, but then update the entire datapak, because there will be multiple rows that need converting to the same value.
It doesn't seem to impact performance, I am just wondering if there is a neater way of doing it.
Thanks for all the replies.
‎2005 Aug 01 2:17 PM
‎2005 Aug 01 2:18 PM
‎2005 Aug 01 2:32 PM
Sure will award points. It seems to limit me on how many "very helpful answers" I can give.