Skip to Content
0
Former Member
Aug 01, 2005 at 12:59 PM

Doubt Regarding Internal Table

15 Views

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>