05-29-2017 9:06 AM
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.
05-29-2017 12:06 PM
Hi Rohan,
Give sy-subrc = 0. instead sy-subrc <> 0.
Regards,
Krishna Chaitanya.
05-29-2017 9:19 AM
hi
put endloop statement before else statement like below
ENDLOOP.
Else.
Message 'No Records Founds' TYPE 'E'.
endif.
05-29-2017 11:16 AM
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.
05-29-2017 11:39 AM
05-29-2017 12:06 PM
Hi Rohan,
Give sy-subrc = 0. instead sy-subrc <> 0.
Regards,
Krishna Chaitanya.
05-30-2017 8:23 AM
then follow
either
Give sy-subrc = 0. instead sy-subrc <> 0.
or
krishna chaithanya answer