2007 Sep 19 10:17 AM
can any one clarify my doubt .... i am getting an error saying that " LFA1-LIFNR" IS UNKNOWN.
but that is there in that table... i am sending u the report coding also.... reply me soon.
REPORT Z_SB_VENDORREPORT
NO STANDARD PAGE HEADING
MESSAGE-ID ZLANCO
LINE-SIZE 120
LINE-COUNT 30(2).
**********************
TABLES DELARATIONS *
**********************
TABLES: LFA1,
LFM1.
******************************
INTERNAL TABLE DECLARATION *
******************************
DATA: BEGIN OF ITAB OCCURS 10,
LIFNR LIKE LFA1-LIFNR, " ACCOUNT NUMBER OF VENDOR OR CREDITOR
NAME1 LIKE LFA1-NAME1, " NAME
LAND1 LIKE LFA1-LAND1, " COUNTRY KEY
REGIO LIKE LFA1-REGIO, " REGION
ERDAT LIKE LFA1-ERDAT, " DATE ON WHICH THE RECORD WAS CREATED
EKORG LIKE LFM1-EKORG, " PURCHASING ORGANIZATION
WAERS LIKE LFM1-WAERS, " PURCHASE ORDER CURRENCY
EKGRP LIKE LFM1-EKGRP, " PURCHASING GROUP
MINBW LIKE LFM1-MINBW, " MINIMUM ORDER VALUE
END OF ITAB.
********************
SELECTION-SCREEN *
********************
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: SLIFNR FOR LFA1-LIFNR,
SEKORG FOR LFM1-EKORG,
SEKGRP FOR LFM1-EKGRP.
SELECTION-SCREEN END OF BLOCK BLK.
***********************
AT SELECTION-SCREEN *
***********************
AT SELECTION-SCREEN.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ITAB
FROM LFA1 WHERE LIFNR = SLIFNR.
IF SY-SUBRC NE 0.
MESSAGE I001.
ENDIF.
***************
TOP-OF-PAGE *
***************
TOP-OF-PAGE.
WRITE:/40 'VENDOR DETAILS',
/40(15) SY-ULINE,
/ 'S.NO.',
10 'LIFNR',
20 'NAME1',
35 'EKORG',
45 'EKGRP',
55 'LAND1',
65 'REGIO',
75 'ERDAT',
85 'WAERS',
95 'MINBW'.
START-OF-SELECTION *
**********************
START-OF-SELECTION.
SELECT LFA1-LIFNR
LFA1-NAME1
LFM1-EKORG
LFM1-EKGRP
LFA1-LAND1
LFA1-REGIO
LFA1-ERDAT
LFM1-WAERS
LFM1-MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1-LIFNR = LFM1-LIFNR.
********************
END-OF-SELECTION *
********************
END-OF-SELECTION.
LOOP AT ITAB.
WRITE:/ ITAB-LIFNR UNDER 'LIFNR',
ITAB-NAME1 UNDER 'NAME1',
ITAB-EKORG UNDER 'EKORG',
ITAB-EKGRP UNDER 'EKGRP',
ITAB-LAND1 UNDER 'LAND1',
ITAB-REGIO UNDER 'REGIO',
ITAB-ERDAT UNDER 'ERDAT',
ITAB-WAERS UNDER 'WAERS',
ITAB-MINBW UNDER 'MINBW'.
ENDLOOP.
Thanx & Regards ,
PHANINDER GOLLAPUDI.
2007 Sep 19 10:21 AM
SLIFNR is a select-option and not a parameter.
so in your sql stement you should use
where lifnr in SLIFNR
not
lifnr = SLIFNR
if you want the = condition, use this
lifnr = slifnr-low
or
lifnr = slifnr-high
2007 Sep 19 10:21 AM
start of selection.
select lfa1~lifnr
......
from lfa1 innerjoin
use "~" symbol here. also
at selection-screen
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ITAB
FROM LFA1 WHERE LIFNR = SLIFNR.
use IN slifnr here
2007 Sep 19 10:24 AM
hi,
instead of
SELECT LFA1-LIFNR
LFA1-NAME1
LFM1-EKORG
LFM1-EKGRP
LFA1-LAND1
LFA1-REGIO
LFA1-ERDAT
LFM1-WAERS
LFM1-MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1-LIFNR = LFM1-LIFNR.
write this
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR.
Message was edited by:
Dhwani shah
2007 Sep 19 10:24 AM
STILL I AM GETTING THE SAME ERROR --- " LFA1-LIFNR " UNKNOWN
REPLY ME
2007 Sep 19 10:25 AM
Hello,
In ur code part
SELECT LFA1-LIFNR
LFA1-NAME1
LFM1-EKORG
LFM1-EKGRP
LFA1-LAND1
LFA1-REGIO
LFA1-ERDAT
LFM1-WAERS
LFM1-MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1-LIFNR = LFM1-LIFNR.
<b>use ~ rather -</b>
see this corrected code
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO TABLE ITAB
FROM LFA1 INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR.
<b>Reward Points If Useful</b>
Regards, Srikanth
2007 Sep 19 10:30 AM
Hi phaninder:
When u use inner join, u must refer to the field from the DBT using '~' ot '-':
Mdify the select statement at start of selection. this wll solve ur prob':
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR.
*Reward pts if usefu!
2007 Sep 19 10:34 AM
CHANGE YOR STAR OF SELECTION
WRITE THE FOLLOWING CODE INSTEAD
START-OF-SELECTION *
**********************
START-OF-SELECTION.
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR.
Reward points if useful, get back in case of query...
Cheers!!!
2007 Sep 19 10:35 AM
STILL I AM GETTING RUN TIME ERROR .. I AM SENDING U THE DETAILS
Runtime Errors DBIF_RSQL_INVALID_RSQL
Except. CX_SY_OPEN_SQL_DB
Date and Time 19.09.2007 03:16:22
Short text
RSQL error 23 when accessing table "LFA1 ".
Missing Handling of System Exception
Program Z_SB_VENDORREPORT
Trigger Location of Exception
Program Z_SB_VENDORREPORT
Include Z_SB_VENDORREPORT
Row 80
Module Name START-OF-SELECTION
Source Code Extract
Line SourceCde
50 SELECT SINGLE * INTO CORRESPONDING FIELDS OF ITAB
51 FROM LFA1 WHERE LIFNR = SLIFNR-LOW.
52
53 IF SY-SUBRC NE 0.
54 MESSAGE I001.
55 ENDIF.
56
57 ***************
58 * TOP-OF-PAGE *
59 ***************
60 TOP-OF-PAGE.
61
62 WRITE:/40 'VENDOR DETAILS',
63 /40(15) SY-ULINE,
64 / 'S.NO.',
65 10 'LIFNR',
66 20 'NAME1',
67 35 'EKORG',
68 45 'EKGRP',
69 55 'LAND1',
70 65 'REGIO',
71 75 'ERDAT',
72 85 'WAERS',
73 95 'MINBW'.
74
75 **********************
76 * START-OF-SELECTION *
77 **********************
78 START-OF-SELECTION.
79
>>>>> SELECT LFA1~LIFNR
81 LFA1~NAME1
82 LFM1~EKORG
83 LFM1~EKGRP
84 LFA1~LAND1
85 LFA1~REGIO
86 LFA1~ERDAT
87 LFM1~WAERS
88 LFM1~MINBW
89 INTO TABLE ITAB
90 FROM LFA1
91 INNER JOIN LFM1
92 ON LFA1LIFNR = LFM1LIFNR
93 WHERE LFA1~LIFNR IN SLIFNR.
94
95 ********************
96 * END-OF-SELECTION *
97 ********************
98 END-OF-SELECTION.
99
2007 Sep 19 10:48 AM
2007 Sep 19 11:05 AM
i have run this code and caught ur problem copy this code
**********************
START-OF-SELECTION *
**********************
START-OF-SELECTION.
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO corresponding fields of TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR
WHERE
lfa1~LIFNR IN SLIFNR AND
LFM1~EKORG IN SEKORG and
LFM1~EKGRP in sekgrp.
Reward points if useful, get back in case of query...
Cheers!!!
Actually the problem is:
*The data read during a SELECT access could not be *inserted into the
*target field.
*Either conversion is not supported for the target *field's type or the
*target field is too short to accept the value or the *data are not in a
*form that the target field can accept
It means that the way in which your ITAB is defined and the order you have written in select query are not in same order, so either you write "INTO corresponding fields of TABLE ITAB" or you make the order of the select query same as ITAB
Message was edited by:
Tripat Pal Singh
2007 Sep 19 12:50 PM
hi,
i copied ur code and made some changes.
Now its not giving any error.
I cant get output as my tables dont have data.
so u try and reward me back.
**********************
TABLES DELARATIONS *
**********************
TABLES: LFA1,LFM1.
******************************
INTERNAL TABLE DECLARATION *
******************************
DATA: BEGIN OF ITAB OCCURS 10,
LIFNR LIKE LFA1-LIFNR, " ACCOUNT NUMBER OF VENDOR OR CREDITOR
NAME1 LIKE LFA1-NAME1, " NAME
LAND1 LIKE LFA1-LAND1, " COUNTRY KEY
REGIO LIKE LFA1-REGIO, " REGION
ERDAT LIKE LFA1-ERDAT, " DATE ON WHICH THE RECORD WAS CREATED
EKORG LIKE LFM1-EKORG, " PURCHASING ORGANIZATION
WAERS LIKE LFM1-WAERS, " PURCHASE ORDER CURRENCY
EKGRP LIKE LFM1-EKGRP, " PURCHASING GROUP
MINBW LIKE LFM1-MINBW, " MINIMUM ORDER VALUE
END OF ITAB.
********************
SELECTION-SCREEN *
********************
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: SLIFNR FOR LFA1-LIFNR,
SEKORG FOR LFM1-EKORG,
SEKGRP FOR LFM1-EKGRP.
SELECTION-SCREEN END OF BLOCK BLK.
***********************
AT SELECTION-SCREEN *
***********************
AT SELECTION-SCREEN.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ITAB
FROM LFA1 WHERE LIFNR = SLIFNR.
IF SY-SUBRC NE 0.
MESSAGE I001.
ENDIF.
***************
TOP-OF-PAGE *
***************
TOP-OF-PAGE.
WRITE:/40 'VENDOR DETAILS',
/40(15) SY-ULINE,
/ 'S.NO.',
10 'LIFNR',
20 'NAME1',
35 'EKORG',
45 'EKGRP',
55 'LAND1',
65 'REGIO',
75 'ERDAT',
85 'WAERS',
95 'MINBW'.
**********************
START-OF-SELECTION *
**********************
START-OF-SELECTION.
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO corresponding fields of table ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR where lfa1~lifnr = slifnr.
********************
END-OF-SELECTION *
********************
END-OF-SELECTION.
LOOP AT ITAB.
WRITE:/ ITAB-LIFNR UNDER 'LIFNR',
ITAB-NAME1 UNDER 'NAME1',
ITAB-EKORG UNDER 'EKORG',
ITAB-EKGRP UNDER 'EKGRP',
ITAB-LAND1 UNDER 'LAND1',
ITAB-REGIO UNDER 'REGIO',
ITAB-ERDAT UNDER 'ERDAT',
ITAB-WAERS UNDER 'WAERS',
ITAB-MINBW UNDER 'MINBW'.
ENDLOOP.
2007 Sep 19 1:08 PM
hi,
plz..... change this select query in ur program and let me know u are solved
**********************
START-OF-SELECTION *
**********************
START-OF-SELECTION.
SELECT LFA1~LIFNR
LFA1~NAME1
LFM1~EKORG
LFM1~EKGRP
LFA1~LAND1
LFA1~REGIO
LFA1~ERDAT
LFM1~WAERS
LFM1~MINBW
INTO TABLE ITAB
FROM LFA1
INNER JOIN LFM1
ON LFA1LIFNR = LFM1LIFNR.
regards,
karthik