Skip to Content
0
Former Member
Mar 29, 2008 at 03:35 PM

validation in alv report

58 Views

Hi friends i am new to abap.i am doing some validation in my report .my program is executing properly but i need some modification.... its alv report on bapi for GOODS MOVEMENT TYPE For tht i am uploading a flat file using gui_upload.but i need some modification on validation..this program is abt goods transfer from one plant to another plant,s location .so in my flat file i am having material,from plant ,from location,to plant,to location and quantity .here is the code:

&----


*& Form VALIDATE_DATA

&----


  • 1.Check Material in Table MARC >> Material Plant Validation

  • If not found, Fill Remarks with 'Material Not Found in Plant'

  • 2.Check Plant is Assigned to POrg in Table T024W >> Plant POrg Validation

  • If not found, Fill Remarks with 'Invalid POrg for Plant'

  • 3.Check Location for Plant and Location in Table T001L >> Plant SLoc Validation

  • If not found, Fill Remarks with 'Invalid Storage Location for Plant'

----


FORM validate_data .

DATA: lv_ekorg TYPE t024e-ekorg.

  • Get POrg for CompanyCode

SELECT SINGLE ekorg INTO lv_ekorg FROM t024e

WHERE bukrs EQ p_bukrs.

LOOP AT it_final.

  • Check-1

SELECT SINGLE * FROM marc

WHERE matnr = it_final-matnr

AND werks = it_final-f_werks.

IF sy-subrc = 4.

it_final-remark = 'Material Not Found in Plant'.

MODIFY it_final.

ELSE.

  • Check-2

SELECT SINGLE * FROM t024w

WHERE werks = it_final-t_werks

AND ekorg = lv_ekorg.

IF sy-subrc = 4.

it_final-remark = 'Invalid POrg for Plant'.

MODIFY it_final.

ELSE.

  • Check-3

SELECT SINGLE * FROM t001l

WHERE werks = it_final-t_werks

AND lgort = it_final-t_lgort.

IF sy-subrc = 4.

it_final-remark = 'Invalid Storage Location for Plant'.

MODIFY it_final.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " VALIDATE_DATA

for this code i am getting output as if plant value is wrong then there will be a remark in the output as material is 'Material Not Found in Plant'....and as same for location n purchase organization....

But in my output i want ,if there is plant n location is wrong the then 2 remarks should display in 2 rows but like wise now i am getting only one remark for 2 errors also..........getting remark based on first condition....

can any one help me hw to solve ...