cancel
Showing results for 
Search instead for 
Did you mean: 

Start Routine BW3.5 to BI 7.4- ABAP 00

former_member228877
Participant
0 Kudos

Hi Friends ,

I am in process of converting BW 3.5 flow BI 7.4. I want to convert below Start routine to BI 7 (ABAP OO) method. I have declared and done code in BI 7.X following way. Getting Error .

Could any one help.

I am not core ABAPer

Original 3.5 Code

DATA: BEGIN OF t_empl OCCURS 0.
        INCLUDE STRUCTURE /bi0/qemployee.
DATA: END OF t_empl.

DATA: BEGIN OF t_pers OCCURS 0.
        INCLUDE STRUCTURE /bi0/qperson.
DATA: END OF t_pers.

DATA: BEGIN OF t_appl OCCURS 0.
        INCLUDE STRUCTURE /bi0/qapplicant.
DATA: END OF t_appl.

************************************************************************

  data: begin of t_appid occurs 0,
          appid like /bi0/qapplicant-applicant,
        end of t_appid.
  data: begin of t_empid occurs 0,
          empid like /bi0/qemployee-employee,
        end of t_empid.

  data: begin of t_perid occurs 0,
         perid like /bi0/qperson-person,
        end of t_perid.
  DATA: l_s_datapak_line type TRANSFER_STRUCTURE.
  clear: t_appid[], t_empid[], t_empl[], t_appl[]. 

  loop at datapak into  l_s_datapak_line.
    case l_s_datapak_line-APPEE_TYPE.
      when 'AP'.
        t_appid-appid =  l_s_datapak_line-APPEE_ID.
        append t_appid.
      when 'P'.
        t_empid-empid =  l_s_datapak_line-APPEE_ID.
        append t_empid.
      when others.
    endcase.
  endloop.

  delete adjacent duplicates from t_empid. 
  delete adjacent duplicates from t_appid. 

* Bring employee master data into buffer
  if not t_empid[] is initial.
    SELECT * FROM /bi0/qemployee INTO TABLE t_empl
    for all entries in t_empid
    where employee = t_empid-empid
      and dateto ge sy-datum
      and datefrom le sy-datum.
  endif.

*Bring Applicanr master data into buffer
if not t_appid[] is initial.
    SELECT * FROM /bi0/qapplicant INTO TABLE t_appl
    for all entries in t_appid      
    where applicant = t_appid-appid   
      and dateto ge sy-datum
      and datefrom le sy-datum.
  endif.

*Bring person master data into buffer by comparing with empid.

  if not t_empid[] is initial.
    SELECT * FROM /bi0/qperson INTO TABLE t_pers
    for all entries in t_empid
    where person = t_empid-empid
      and dateto ge sy-datum
      and datefrom le sy-datum.
  endif.
sort: t_pers, t_empl, t_appl. 



After my conversion to BI7.4

TYPES : t_empl TYPE STANDARD TABLE OF /bi0/qemployee,
        t_pers TYPE STANDARD TABLE OF /bi0/qperson,
        t_appl TYPE STANDARD TABLE OF /bi0/qapplicant.
Types: begin of t_appid,
          appid TYPE /bi0/qapplicant-applicant,
        end of t_appid.

TYPES: begin of t_empid ,
          empid TYPE /bi0/qemployee-employee,
        end of t_empid.

TYPES: begin of t_perid,
          perid TYPE /bi0/qperson-person,
        end of t_perid.


   loop at SOURCE_PACKAGE ASSIGNING <SOURCE_FIELDS>.
    case <SOURCE_FIELDS>-APPEE_TYPE.
      when 'AP'.
        t_appid-appid =  <SOURCE_FIELDS>-APPEE_ID.
        append t_appid.
      when 'P'.
        t_empid-empid =  <SOURCE_FIELDS>-APPEE_ID.
        append t_empid.
      when others.
    endcase.
  endloop.

Accepted Solutions (0)

Answers (1)

Answers (1)

matt
Active Contributor
0 Kudos

If you get an error - state what the error is. If you can't fix your ABAP, have you considered asking your local friendly ABAP team for help? Or asking to be sent on an ABAP course? Or even buying a book on ABAP (or getting one of the ones legally available for free, downloading it and working through it for free?).

Answer:

Tables with header lines are obsolete. append t_appid. is a statement for tables with header lines, saying take the contents of the header line and append them to the table.It is bad programming, since t_appid refers to the header line or the table depending on context.

To be honest, the original code is pretty bad.

Here is an optimal solution. I suggest you read the ABAP documentation on each keyword so you understand how this works, and how it duplicates the 3.5 code.

LOOP AT source_package ASSIGNING <source_fields> WHERE appee_type EQ 'AP' OR appee_type EQ 'P'.
  INSERT INTIAL LINE INTO FIELD-SYMBOL(<appid>).
  <appid>-appid = <source_fields>-appee_id.
ENDLOOP.