Application Development 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: 

How to decalre the variable.

former_member623843
Participant
0 Kudos

HI all,

I have decalred a variable mard-LABST

Data: v_labst type mard-lasbst.

But when i check syntactical check it was showing syntactically wrong.

can any body please tell me how to decalre.

13 REPLIES 13

Former Member
0 Kudos

I think it suppoused to be Data: v_labst type mard-labst.

0 Kudos

no wrong..

Can any body please..

0 Kudos

Give this ,

Tables : mard.

data :v_labst type mard-labst.

0 Kudos

Try to check the code around the line of syntax error to see if you missed any periods..

data: v_labst type mard-labst should work.

0 Kudos

Hi all,

This is my code. can you please check in u r editors.

tables: mard.

Types: begin of ty_NTGEW,

Matnr type matnr,

labst type labst,

lgort type LGORT_D,

end of ty_NTGEW.

data: v_ntgew type standard table of ty_ntgew,

wa_ntgew type ty_ntgew.

data: v_ntgew1 type standard table of ty_ntgew,

wa_ntgew1 type ty_ntgew,

v_open like wa_ntgew.

data: v_test type mard-labst.

Select MATNR

labst

lgort

From MARd up to 10 rows

Into corresponding fields of table V_NTGEW

where labst NE '0.000'.

loop at v_ntgew into wa_ntgew.

v_open = wa_ntgew.

move v_open-labst to v_test.

Replace all occurrences of '-' in v_test with ''.

Replace all occurrences of CL_ABAP_CHAR_UTILITIES=>CR_LF in V_test with ''.

write:/ v_test.

move v_test to v_open-labst.

write:/ v_open-labst.

endloop.

0 Kudos

Data: v_labst type mard-lasbst. "it is wrong

because in mard there is no field with lasbst.

Data: v_labst type mard-labst. "correct

0 Kudos
DATA: v_test TYPE mard-labst.
DATA: lv_test(18).  "char field


SELECT matnr
labst
lgort
FROM mard UP TO 10 ROWS
INTO CORRESPONDING FIELDS OF TABLE v_ntgew
WHERE labst NE '0.000'.

LOOP AT v_ntgew INTO wa_ntgew.
  v_open = wa_ntgew.
  MOVE v_open-labst TO v_test.
  WRITE v_test TO lv_test.
 "error is from qty field
  REPLACE ALL OCCURRENCES OF '-' IN lv_test WITH ''.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN lv_test WITH
''.
  WRITE:/ v_test.
  MOVE v_test TO v_open-labst.
  WRITE:/ v_open-labst.
ENDLOOP.

0 Kudos

HI vijay,

Sorry i have typed here wrong . But in my pgm i have typed correct.

Can you please check my above pgm.

Former Member
0 Kudos

What was your syntactically error meassage ?

Former Member
0 Kudos

You have an structure of type ty_mard and while declaring an internal table you can declare it as

data: t_mard type table of ty_mard,

wa_mard like line of t_mard.

There is no problem with the declaration of the variable v_open.

Former Member
0 Kudos

Hi,

Try this..

Declare V_TEST as string...In the replace statement the V_TEST should be given as a character data type.

data: v_test type string.

Thanks

Naren

Former Member
0 Kudos

MARD-LABST is a quantity field. You can not use REPLACE on a quantity field (and there wouldn't be any '-' in there anyways).

0 Kudos

Thanks