cancel
Showing results for 
Search instead for 
Did you mean: 

Declarations, Work Areas and Loops in BW 7.0

Former Member
0 Kudos

Just having a little problem with declarations on BW 7.0. My end routine is looping through the result_package into a work area called wa_result_package. I am however having syntax problems with my declaration. Never had problems with declarations in BW 3.5 so this is a little embarrassing.

DATA:

  • same type as the result package

wa_result_package TYPE tys_TG_1,

When I use the above I get the errror "cannot be converted to the line type of "RESULT_PACKAGE"".

Alternatively when I try

DATA:

*assigning line type

wa_result_package LIKE LINE OF RESULT_PACKAGE,

I get the following error: "No component exists with the name "WA_RESULT_PACKAGE"".

Any ideas what I'm doing wrong.....am i missing something really straightforward here?

Any help will be appreciated. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

shanthi_bhaskar
Active Contributor
0 Kudos

McCavoy

use this


data: wa_result_package TYPE standard table of  _ty_s_TG_1, 
        wa_result_package_1 type wa_result_package. 

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I copy your program into my end routine,but system shows that 'NO SYNTAX ERRORS FOUND'...

Usually,when I creating my routine in BI7.0, I dont declare workarea, just like this:

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

DATA: S_RESULT_PACKAGE TYPE TYS_TG_1.

DATA: T_RESULT_PACKAGE TYPE TYT_TG_1.

LOOP AT RESULT_PACKAGE INTO S_RESULT_PACKAGE.

IF S_RESULT_PACKAGE-'YOUR-FIELDS' = 'xxx'.

APPEND S_RESULT_PACKAGE TO T_RESULT_PACKAGE.

...

..

ENDLOOP.

CLEAR: RESULT_PACKAGE, RESULT_PACKAGE[].

RESULT_PACKAGE[ ] = T_RESULT_PACKAGE[ ].

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

You can try this.

Then you can see that TYT_TG_1 is a table(Result_package type TYT_TG_1,and TYT_TG_1 TYPE STANDARD TABLE OF tys_TG_1), but TYS_TG_1 isn't .

Thats only my opinion, maybe i am wrong.

Edited by: Tino J.T. Zhao on May 7, 2009 3:06 AM

Former Member
0 Kudos

Thanks guys but none of those worked for me.

Ok this is the code where I need the WA_RESULT_PACKAGE declaration for. Replace the appropriate infoobject name and technical names. Seems like it doesnt matter how I declare it I get either:"cannot be converted to the line type of "RESULT_PACKAGE" or "No component exists with the name "WA_RESULT_PACKAGE". I will appreciate greatly any help in making the code below pass syntax check. All the program does is loop through a DSO, sum a field then use that result to calculate a % and update the result package, with at the fields for "total order value" and "% order value".

types : begin of itabtype,

order type /bic/oi*,

tot_amt type /bic/oi*,

end of itabtype.

  • use the name of infoobject.

data : itab type standard table of itabtype,

wa_itab like line of itab.

sort result_pacakge by /bic/* ascending (use technical name of order)

clear wa_itab.

loop at result_package into wa_result_package.

At End of wa_result_package-* . ( use technical name of order)

wa_itab-order = wa_result_package-/bic/*. ( use technical name of order).

wa_itab-tot_amt = wa_itab-tot-amt + wa_result_package-amount.

append wa_itab to itab.

ENDAT.

wa_itab-order = wa_result_package-/bic/*.

wa_itab-tot_amt = wa_itab-tot-amt + wa_result_package-amount.

endloop.

        • after this loop in the internal table we will bring the order and the total amount...........now we will again update this value in the result_pacakge.

loop at result_package into wa_result_package.

read table itab into wa_itab

with key order = wa_result_package-/bic/*. ( use technical name......)

if sy-subrc = 0.

wa_result_package-/bic/ztotal_order_amount = wa_itab-amount. (use technical name)

endif.

wa_result_package-/bic/prd_sale_% = wa_result_package-/bic/sale_amount / wa_result_package-/bic/ztotal_order_amount * 100.

modify result_package from wa_result_package.

endloop.

shanthi_bhaskar
Active Contributor
0 Kudos

declare the WA_RESULT_PACKAGE below this std. code..


    FIELD-SYMBOLS:
      <RESULT_FIELDS>    TYPE _ty_s_TG_1.

    DATA:
      MONITOR_REC     TYPE rstmonitor.

data: wa_result_package TYPE _ty_s_TG_1.

Former Member
0 Kudos

Thank you for those that suggested possible solutions you were all right. Your suggestions forced me to look for other syntax errors apart from std declaration issues.

The errors with were caused by my AT statement, but original problem was that the generic error code got me thinking my declaration syntax was wrong but debugged it stepping through and found the syntax error in the AT statement , f1,f2, etc calls..

Thanks again!