‎2009 Apr 06 11:53 PM
Hi,
I get a syntax error in this statement in ECC 6.0
AT LINE-SELECTION.
GET CURSOR LINE L_LINE VALUE ROW_DATA.
The error says
row_data cannot be converted to a character-type field.
Here
L_line is sy-index and
Row data is a TYPE defined in my program as follows
BUKRS LIKE GLPCT-RBUKRS,
PRCTR LIKE GLPCT-RPRCTR,
ITEM LIKE ECMCT-RITEM,
SUM1 LIKE ECMCT-HSLVT,
SUM2 LIKE ECMCT-HSLVT,
This works well in 4.6 but fails in ECC 6.0. If I am right this is because SAP expects the line to be fully character based but sum1 and sum2 and currency types. So the incomaptibility.
How do I solve this issue. I want to read the line which the user double clicks and want to manipulate those currency values too.
thks
‎2009 Apr 07 4:27 AM
Hi,
Refer the demo:-
TABLES : LFA1, LFB1.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
ORT01 LIKE LFA1-ORT01,
END OF VENDOR,
BEGIN OF VENDOR1,
LIFNR LIKE LFA1-LIFNR,
LAND1 LIKE LFA1-LAND1,
BUKRS LIKE LFB1-BUKRS,
END OF VENDOR1.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 20 WITH HEADER LINE,
VENDOR1_TAB TYPE STANDARD TABLE OF VENDOR1 INITIAL SIZE 20 WITH HEADER LINE,
FLDNAME(25),
FLDVALUE(25).
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE :/ 'SECONDART LIST FOR VENDOR ID:', VENDOR_TAB-LIFNR COLOR 3.
ULINE.
START-OF-SELECTION.
SELECT LIFNR NAME1 ORT01
FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE VENDOR_TAB.
AT LINE-SELECTION.
GET CURSOR FIELD FLDNAME VALUE FLDVALUE.
CASE FLDNAME.
WHEN 'VENDOR_TAB-LIFNR' OR 'VENDOR_TAB-NAME1' OR 'VENDOR_TAB-ORT01'.
IF SY-LSIND EQ 1.
SELECT A~LIFNR A~LAND1 B~BUKRS
FROM LFA1 AS A
INNER JOIN LFB1 AS B
ON A~LIFNR = B~LIFNR
INTO CORRESPONDING FIELDS OF TABLE VENDOR1_TAB
WHERE A~LIFNR = VENDOR_TAB-LIFNR.
WRITE : /1 TEXT-001, 13 TEXT-004, 46 TEXT-005.
ULINE.
LOOP AT VENDOR1_TAB.
WRITE : /1 VENDOR1_TAB-LIFNR, 13 VENDOR1_TAB-LAND1, 46 VENDOR1_TAB-BUKRS.
ENDLOOP.
ULINE.
IF SY-SUBRC <> 0.
MESSAGE E005.
ENDIF.
ENDIF.
WHEN OTHERS.
MESSAGE E006.
ENDCASE.
END-OF-SELECTION.
WRITE : /1 TEXT-001, 13 TEXT-002, 46 TEXT-003.
ULINE.
FORMAT HOTSPOT.
LOOP AT VENDOR_TAB.
WRITE : /1 VENDOR_TAB-LIFNR, 13 VENDOR_TAB-NAME1, 46 VENDOR_TAB-ORT01.
HIDE : VENDOR_TAB-LIFNR.
ENDLOOP.
ULINE.
Hope this helps you.
Regards,
Tarun
‎2009 Apr 07 1:05 AM
In the declaration part of ROW_DATA data types SUM1 SUM2 does not match with other fields which is not allowed in Unicode environment.So change the the type of it to NUMC.
a®
‎2009 Apr 07 2:47 AM
Hi,
The ROW_DATA should be char type if not it gives you the su\yntax error.. check the below code
DATA l_line TYPE i.
DATA row_data(2000) TYPE c.
GET CURSOR LINE l_line VALUE row_data.
‎2009 Apr 07 5:03 PM
Hi Avinash,
Thanks for ur suggestion. A related question will be, in case the line is read like that how do I then split the data of the character variable into my individual currency amounts for manipulation ?
thks
‎2009 Apr 07 5:14 PM
Hi,
You can do this way to get the value of sum1.
DATA : l_char(20) TYPE c,
l_int TYPE i,
l_sum1 LIKE ecmct-hslvt.
REPLACE '.' IN l_char WITH space. CONDENSE l_char.
l_int = l_char.
l_sum1 = l_int / 100.or
If you are reading the whole line than you need to use the position and offset to read the SUM1 value and use the above logic to convert into amount.
‎2009 Apr 07 4:27 AM
Hi,
Refer the demo:-
TABLES : LFA1, LFB1.
TYPES : BEGIN OF VENDOR,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
ORT01 LIKE LFA1-ORT01,
END OF VENDOR,
BEGIN OF VENDOR1,
LIFNR LIKE LFA1-LIFNR,
LAND1 LIKE LFA1-LAND1,
BUKRS LIKE LFB1-BUKRS,
END OF VENDOR1.
DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 20 WITH HEADER LINE,
VENDOR1_TAB TYPE STANDARD TABLE OF VENDOR1 INITIAL SIZE 20 WITH HEADER LINE,
FLDNAME(25),
FLDVALUE(25).
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE :/ 'SECONDART LIST FOR VENDOR ID:', VENDOR_TAB-LIFNR COLOR 3.
ULINE.
START-OF-SELECTION.
SELECT LIFNR NAME1 ORT01
FROM LFA1
INTO CORRESPONDING FIELDS OF TABLE VENDOR_TAB.
AT LINE-SELECTION.
GET CURSOR FIELD FLDNAME VALUE FLDVALUE.
CASE FLDNAME.
WHEN 'VENDOR_TAB-LIFNR' OR 'VENDOR_TAB-NAME1' OR 'VENDOR_TAB-ORT01'.
IF SY-LSIND EQ 1.
SELECT A~LIFNR A~LAND1 B~BUKRS
FROM LFA1 AS A
INNER JOIN LFB1 AS B
ON A~LIFNR = B~LIFNR
INTO CORRESPONDING FIELDS OF TABLE VENDOR1_TAB
WHERE A~LIFNR = VENDOR_TAB-LIFNR.
WRITE : /1 TEXT-001, 13 TEXT-004, 46 TEXT-005.
ULINE.
LOOP AT VENDOR1_TAB.
WRITE : /1 VENDOR1_TAB-LIFNR, 13 VENDOR1_TAB-LAND1, 46 VENDOR1_TAB-BUKRS.
ENDLOOP.
ULINE.
IF SY-SUBRC <> 0.
MESSAGE E005.
ENDIF.
ENDIF.
WHEN OTHERS.
MESSAGE E006.
ENDCASE.
END-OF-SELECTION.
WRITE : /1 TEXT-001, 13 TEXT-002, 46 TEXT-003.
ULINE.
FORMAT HOTSPOT.
LOOP AT VENDOR_TAB.
WRITE : /1 VENDOR_TAB-LIFNR, 13 VENDOR_TAB-NAME1, 46 VENDOR_TAB-ORT01.
HIDE : VENDOR_TAB-LIFNR.
ENDLOOP.
ULINE.
Hope this helps you.
Regards,
Tarun
‎2009 Apr 07 5:09 PM
Thanks Tarun. This demo is really good if I need to read the field's value which user clicked. What about reading the entire line ? I am actually trying to read the entire line and not just one field.
I am also going to try with the NUMC option as the other person suggested. Meanwhile if you have any other info, would be great.
thks
‎2009 Apr 07 5:29 PM
Try to change your code this way and check whether it works?
report zaRs
no standard page heading line-size 255.
data : l_line like sy-index.
data : begin of row_data occurs 0,
bukrs like glpct-rbukrs,
prctr like glpct-rprctr,
item like ecmct-ritem,
sum1 like dtaxnl9a-hashc, " Changed to numc 24
sum2 like dtaxnl9a-hashc. " Changed to numc 24
data : end of row_data.
at line-selection.
get cursor line l_line value row_data.
a®
‎2009 Apr 07 5:51 PM