Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SYNTAX ERROR.............

Former Member
0 Likes
946

Hi all,

here i got some problem i.e my code is..

  • report for displaying GL a/c Opening balance.

tables: GLT0, " G/L account master record transaction figures

BSEG, " Accounting Document Segment

BKPF, " Accounting Document Header

V_001_B, " Company Code Global Data

T001B. " Permitted Posting Periods

select-options: SO_RACCT for GLT0-RACCT memory id RAC visible length 10,

SO_BUKRS for GLT0-BUKRS memory id BUK.

parameters : RYEAR TYPE GLT0-RYEAR. " FISCAL YEAR

parameters : p_date like sy-datum default sy-datum.

selection-screen begin of block b1 with frame.

PARAMETERS : loc_cur RADIOBUTTON GROUP RGB USER-COMMAND R DEFAULT 'X'.

PARAMETERS : Tran_cur RADIOBUTTON GROUP RGB .

selection-screen end of block b1.

data : i_GLT0 like GLT0 occurs 0 with header line.

DATA: BEGIN OF gt_data OCCURS 0 ,

BUKRS LIKE GLT0-BUKRS,

RYEAR LIKE GLT0-RYEAR,

RACCT LIKE GLT0-RACCT,

TSLVT LIKE GLT0-TSLVT,

TSL01 LIKE GLT0-TSL01,

TSL02 LIKE GLT0-TSL02,

TSL03 LIKE GLT0-TSL03,

TSL04 LIKE GLT0-TSL04,

TSL05 LIKE GLT0-TSL05,

TSL06 LIKE GLT0-TSL06,

TSL07 LIKE GLT0-TSL07,

TSL08 LIKE GLT0-TSL08,

TSL09 LIKE GLT0-TSL09,

TSL10 LIKE GLT0-TSL10,

TSL11 LIKE GLT0-TSL11,

TSL12 LIKE GLT0-TSL12,

TSL13 LIKE GLT0-TSL13,

TSL14 LIKE GLT0-TSL14,

TSL15 LIKE GLT0-TSL15,

TSL16 LIKE GLT0-TSL16,

TSL_total like GLT0-TSLVT,

  • TSL_total TYPE i,

HSLVT LIKE GLT0-HSLVT,

HSL01 LIKE GLT0-HSL01,

HSL02 LIKE GLT0-HSL02,

HSL03 LIKE GLT0-HSL03,

HSL04 LIKE GLT0-HSL04,

HSL05 LIKE GLT0-HSL05,

HSL06 LIKE GLT0-HSL06,

HSL07 LIKE GLT0-HSL07,

HSL08 LIKE GLT0-HSL08,

HSL09 LIKE GLT0-HSL09,

HSL11 LIKE GLT0-HSL11,

HSL12 LIKE GLT0-HSL12,

HSL13 LIKE GLT0-HSL13,

HSL14 LIKE GLT0-HSL14,

HSL15 LIKE GLT0-HSL15,

HSL16 LIKE GLT0-HSL16,

HSL_total TYPE TSLXX,

END OF gt_data.

AT SELECTION-SCREEN ON SO_RACCT.

IF SO_RACCT-LOW IS INITIAL.

MESSAGE E000(ZGLM).

ELSEIF GLT0-RACCT = SO_RACCT AND BSEG-ALTKT = SO_RACCT.

IF SY-SUBRC <> 0.

MESSAGE E001(ZGLM).

endif.

ENDIF.

AT SELECTION-SCREEN ON SO_BUKRS.

if SO_BUKRS-LOW IS INITIAL.

MESSAGE E002(ZGLM).

elseif BKPF-BUKRS = SO_BUKRS AND GLT0-BUKRS = SO_BUKRS.

IF SY-SUBRC <> 0.

MESSAGE E003(ZGLM).

ENDIF.

ENDIF.

AT SELECTION-SCREEN ON P_DATE.

v_day = p_date+6(2). "'01'.

v_mon = p_date+4(2).

v_year = p_date+0(4).

month = v_mon - 1.

year = v_year - 1.

concatenate v_year v_mon v_day into v_date.

IF p_date IS INITIAL.

MESSAGE E004(ZGLM).

  • ELSEIF P_DATE > V_DATE.

  • MESSAGE E005(ZGLM).

ENDIF.

IF TRAN_CUR = 'X'.

SELECT TSLVT TSL01 TSL02 TSL03 TSL04 TSL05 TSL06 TSL07

TSL08 TSL09 TSL10 TSL11 TSL12 TSL13 TSL14 TSL15 TSL16 FROM GLT0

INTO CORRESPONDING FIELDS OF TABLE gt_data where RACCT IN SO_RACCT and BUKRS IN SO_BUKRS.

  • WHERE RACCT IN SO_RACCT AND BUKRS IN SO_BUKRS AND RYEAR = GLT0-RYEAR.

ENDIF.

LOOP AT gt_data.

gt_data-TSL_total = i_glt0-tslvt + i_glt0-tsl01 + i_glt0-tsl02 + i_glt0-tsl03 + i_glt0-tsl04. (HERE values r not storing into TSL_total field)

(or)

move gt_data-tslvt i_glt0-tsl01 i_glt0-tsl02 i_glt0-tsl03 i_glt0-tsl04 to gt_data-TSL_total. (this is also not working)

endloop.

COUNT = 0.

LOOP AT gt_data.

WRITE: /30 'THE Opening BALANCE IS........', gt_data-TSL_total.

COUNT = COUNT + 1.

ENDLOOP.

( hi friends my problem is in select query where cond not working if check date field, and while looping gt_data data is not storing into gt_data-TSLtotal field, alternativly i have used MOVE statement it is also not working. )

plz could anyone correct it.

Thanks in advance.

sudharsan.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
862

You have got:

INTO CORRESPONDING FIELDS OF TABLE gt_data

but then you do:

LOOP AT gt_data.

gt_data-TSL_total = i_glt0-tslvt + i_glt0-tsl01 + i_glt0-tsl02 + i_glt0-tsl03 + i_glt0-tsl04.

... but the "i_glt0" structure doesn't seem to get filled in your code?

... and do you need a "modify gt_data" inside to loop to keep the total value in the internal table ready for reporting later?

Jonathan

6 REPLIES 6
Read only

Former Member
0 Likes
863

You have got:

INTO CORRESPONDING FIELDS OF TABLE gt_data

but then you do:

LOOP AT gt_data.

gt_data-TSL_total = i_glt0-tslvt + i_glt0-tsl01 + i_glt0-tsl02 + i_glt0-tsl03 + i_glt0-tsl04.

... but the "i_glt0" structure doesn't seem to get filled in your code?

... and do you need a "modify gt_data" inside to loop to keep the total value in the internal table ready for reporting later?

Jonathan

Read only

Former Member
0 Likes
862

Hi Sudarshan,

You are only using the table gt_data in your logic. So, all the data that you need is here itself..

Code like below:

LOOP AT gt_data.

gt_data-tsl_total = gt_data-tslvt + gt_data-tsl01 + gt_data-tsl02 + ... + gt_data-tsl16.

gt_data-hsl_total = gt_data-hslvt + gt_data-hsl01 + gt_data-hsl02 + ... + gt_data-hsl16.

MODIFY gt_data.

ENDLOOP.

After this peace of code, you will have the totals calculated for all the records.

You can print the same as:

LOOP AT gt_data.

WRITE : / 'The opening balance is :',

gt_data-tsl_total.

ENDLOOP.

Thanks and Best Regards,

Vikas Bittera.

***Points for usefull answers ***

Read only

0 Likes
862

Hi vikas,

Thanks for ur replay, i have done like that even though gt_data-tsl_total field is not getting any value. it is displaying 0.00.

( after adding MODIFY gt_data also )

just check it out oncemore plz.

sudharsan

Read only

Former Member
0 Likes
862

Hi Sudarshan,

I do not find any error in the code..

Just check these two things:

1) Do the records have values in other fields like tsl01, tsl02... etc..

2) Take a single record values and add them in calculator, as it may be that the total amount becomes zero, due to equal total debit and credit amount..

Thanks and Best Regards,

Vikas Bittera.

***Points for usefull answers ***

Read only

0 Likes
862

Hi vikas thank u very munch what u told is right it is adding.

( i ' ve given gd rewards )

but i ' ve one more problem i.e

in my selection-screen i have a a/c no , comp code and date field, but i want to get the data based on month and year, suppose if i give 27-08-2007, but i want data for up to 07th month and 2007(date(27) is not checking), but in where condition am trying to check for year ( posting date year not Fiscalyear) month i can check in loop, so how to do it.

plz help me towords this way..

Regards,

sudharsan.

Read only

Former Member
0 Likes
862

hi,

for select statement u had written if an IF conditional statement. so check whether if that conditional statement is correct or not. if it is correct only then control enters inside the block. for this put a break point n check it. and also in select ........... in where condition u use and operator which means that all conditions are true only then select statement works.

and for loop after making changes to that field u have to use UPDATE or MODIFY statement so that that changes are reflected in the internal table as,

LOOP AT gt_data.

gt_data-TSL_total = i_glt0-tslvt + i_glt0-tsl01 + i_glt0-tsl02 + i_glt0-tsl03 + i_glt0-tsl04. (HERE values r not storing into TSL_total field)

modify gt_data. // changes that are made are reflected to body of internal table body

(or)

move gt_data-tslvt i_glt0-tsl01 i_glt0-tsl02 i_glt0-tsl03 i_glt0-tsl04 to gt_data-TSL_total. (this is also not working)

endloop.

COUNT = 0.

LOOP AT gt_data.

WRITE: /30 'THE Opening BALANCE IS........', gt_data-TSL_total.

COUNT = COUNT + 1.

ENDLOOP.

if helpful reward some points.

with regards,

Suresh Aluri.