Skip to Content
0

display the vendor master data from LFA1 table

May 29, 2017 at 08:06 AM

119

avatar image

display the vendor master data from LFA1 table, vendors should be filterd by country code and order by city by accepting the selection screen range and consider any 10 fields to display the output.

TABLES: LFA1.

DATA IT LIKE TABLE OF LFA1.
DATA WA LIKE LINE OF IT.
SELECT * FROM LFA1 INTO TABLE IT ORDER BY ORT01.

if sy-subrc <> 0.
Sort IT by ORT01.



LOOP AT IT INTO WA.
WRITE : / WA-LIFNR,
WA-LAND1,
WA-STRAS,
WA-BRSCH,
WA-ERDAT,
WA-ERNAM,
WA-*****,
WA-SPRAS,
WA-STKZU,
WA-KRAUS.
Else.
Message 'No Records Founds' TYPE 'E'.

ENDLOOP.
endif.

What could be wrong with the code, I am even unable to execute it after removing the if, else control blocks.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
avatar image
Former Member May 29, 2017 at 11:06 AM
0

Hi Rohan,

Give sy-subrc = 0. instead sy-subrc <> 0.

Regards,

Krishna Chaitanya.

Share
10 |10000 characters needed characters left characters exceeded
Krishna Murthy May 29, 2017 at 08:19 AM
0

hi

put endloop statement before else statement like below

ENDLOOP.

Else.
Message 'No Records Founds' TYPE 'E'.
endif.

Share
10 |10000 characters needed characters left characters exceeded
Rohan D'Souza May 29, 2017 at 10:16 AM
0

Hi Krishna,

Made changes as below, but when pressing F8 not executing, what could be the problem?

TABLES: LFA1.

DATA IT LIKE TABLE OF LFA1.
DATA WA LIKE LINE OF IT.
SELECT * FROM LFA1 INTO TABLE IT ORDER BY ORT01.

if sy-subrc <> 0.
Sort IT by ORT01.



LOOP AT IT INTO WA.
WRITE : / WA-LIFNR,
WA-LAND1,
WA-STRAS,
WA-BRSCH,
WA-ERDAT,
WA-ERNAM,
WA-*****,
WA-SPRAS,
WA-STKZU,
WA-KRAUS.
ENDLOOP.
Else.
Message 'No Records Founds' TYPE 'E'.


endif.

Share
10 |10000 characters needed characters left characters exceeded
Rohan D'Souza May 29, 2017 at 10:39 AM
0

in debugger it does not even go to the write statement.

Share
10 |10000 characters needed characters left characters exceeded
Krishna Murthy May 30, 2017 at 07:23 AM
0

then follow

either

Give sy-subrc = 0. instead sy-subrc <> 0.

or

krishna chaithanya answer

Share
10 |10000 characters needed characters left characters exceeded