2007 Nov 12 9:00 AM
Hi
this is lalitha
this is a report to display a sales order which are on hold
my program is synthetically correct but has got an run time error it is at selection screen
please do solve my error .
NO STANDARD PAGE HEADING
LINE-COUNT 23(3)
LINE-SIZE 125.
TABLES: VBAK,
VBUK,
TVLST,
TVFST.
DATA: BEGIN OF IT_VBAK OCCURS 1,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
LIFSK TYPE VBAK-LIFSK,
FAKSK TYPE VBAK-FAKSK,
KUNNR TYPE VBAK-KUNNR,
END OF IT_VBAK,
BEGIN OF IT_VBUK OCCURS 1,
VBELN TYPE VBUK-VBELN,
CMGST TYPE VBUK-CMGST,
END OF IT_VBUK,
BEGIN OF IT_TVLST OCCURS 1,
LIFSP TYPE TVLST-LIFSP,
VEXT1 TYPE TVLST-VTEXT,
END OF IT_TVLST,
BEGIN OF IT_TVFST OCCURS 1,
FAKSP TYPE TVFST-FAKSP,
VTEXT2 TYPE TVFST-VTEXT,
END OF IT_TVFST,
BEGIN OF IT_FINAL OCCURS 1,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
KUNNR TYPE VBAK-KUNNR,
CMGST TYPE VBUK-CMGST,
VtEXT1 TYPE TVLST-VTEXT,
VTEXT2 TYPE TVFST-VTEXT,
END OF IT_FINAL.
DATA: FLAG TYPE I VALUE 1.
*******SELECTION SCREEN******
SELECT-OPTIONS: S_ORDER FOR VBAK-VBELN,
S_CDATE FOR VBAK-ERDAT,
S_CUSTNO FOR VBAK-KUNNR.
****AT SELECTION SCREEN*******
AT SELECTION-SCREEN.
IF S_CUSTNO IS NOT INITIAL.
SELECT SINGLE KUNNR
FROM VBAK
INTO VBAK-KUNNR
WHERE KUNNR IN S_CUSTNO.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
IF S_ORDER IS NOT INITIAL.
SELECT SINGLE VBELN
FROM VBAK
INTO VBAK-VBELN
WHERE VBELN EQ S_ORDER.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
IF S_CDATE IS NOT INITIAL.
SELECT SINGLE ERDAT
FROM VBAK
INTO VBAK-ERDAT
WHERE ERDAT IN S_CDATE.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
*********START-OF-SELECTION****
START-OF-SELECTION .
********DATA EXTRACTION*******
SELECT VBELN
ERDAT
LIFSK
FAKSK
KUNNR
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE it_vbak
WHERE VBELN IN S_ORDER AND ERDAT
IN S_CDATE AND KUNNR IN S_CUSTNO .
IF it_vbak IS NOT INITIAL .
SELECT VBELN
CMGST
FROM VBUK
INTO TABLE it_vbuk
FOR ALL ENTRIES IN it_vbak
WHERE VBELN = it_vbak-vbeln.
ENDIF .
loop at it_vbak .
read table it_vbak with key vbeln = it_vbak-vbeln .
if sy-subrc = 0 .
if it_vbuk-cmgst = 'B' or
it_vbuk-cmgst = 'c' .
it_final-cmgst = 'yes' .
flag = 'x' .
endif.
endif .
if it_vbak-lifsk ne space .
select single vtext from tvlst into it_final-vtext1
where lifsp = it_vbak-lifsk and spras = 'e' .
endif .
flag = 'x' .
if it_vbak-faksk ne space .
select single vtext from tvfst
into it_final-vtext1
where faksp = it_vbak and spras = 'e' .
append it_final .
clear it_final .
endif .
endloop .
loop at it_final .
write : /10 it_final-vbeln,
20 it_final-erdat,
35 it_final-kunnr,
50 it_final-vtext1 ,
75 it_final-vtext2,
100 it_final-cmgst .
endloop .
2007 Nov 12 9:09 AM
There are two chngs.. i commented out original data and placed new lines. check that..
TABLES: VBAK,
VBUK,
TVLST,
TVFST.
DATA: BEGIN OF IT_VBAK OCCURS 1,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
LIFSK TYPE VBAK-LIFSK,
FAKSK TYPE VBAK-FAKSK,
KUNNR TYPE VBAK-KUNNR,
END OF IT_VBAK,
BEGIN OF IT_VBUK OCCURS 1,
VBELN TYPE VBUK-VBELN,
CMGST TYPE VBUK-CMGST,
END OF IT_VBUK,
BEGIN OF IT_TVLST OCCURS 1,
LIFSP TYPE TVLST-LIFSP,
VEXT1 TYPE TVLST-VTEXT,
END OF IT_TVLST,
BEGIN OF IT_TVFST OCCURS 1,
FAKSP TYPE TVFST-FAKSP,
VTEXT2 TYPE TVFST-VTEXT,
END OF IT_TVFST,
BEGIN OF IT_FINAL OCCURS 1,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
KUNNR TYPE VBAK-KUNNR,
CMGST TYPE VBUK-CMGST,
VtEXT1 TYPE TVLST-VTEXT,
VTEXT2 TYPE TVFST-VTEXT,
END OF IT_FINAL.
*DATA: FLAG TYPE I VALUE 1.
DATA: FLAG TYPE C VALUE 1.
*******SELECTION SCREEN******
SELECT-OPTIONS: S_ORDER FOR VBAK-VBELN,
S_CDATE FOR VBAK-ERDAT,
S_CUSTNO FOR VBAK-KUNNR.
****AT SELECTION SCREEN*******
AT SELECTION-SCREEN.
IF S_CUSTNO IS NOT INITIAL.
SELECT SINGLE KUNNR
FROM VBAK
INTO VBAK-KUNNR
WHERE KUNNR IN S_CUSTNO.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
IF S_ORDER IS NOT INITIAL.
SELECT SINGLE VBELN
FROM VBAK
INTO VBAK-VBELN
WHERE VBELN EQ S_ORDER.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
IF S_CDATE IS NOT INITIAL.
SELECT SINGLE ERDAT
FROM VBAK
INTO VBAK-ERDAT
WHERE ERDAT IN S_CDATE.
IF SY-SUBRC <> 0 .
MESSAGE E001(ZSAI_MSG).
ENDIF.
ENDIF .
*********START-OF-SELECTION****
START-OF-SELECTION .
********DATA EXTRACTION*******
SELECT VBELN
ERDAT
LIFSK
FAKSK
KUNNR
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE it_vbak
WHERE VBELN IN S_ORDER AND ERDAT
IN S_CDATE AND KUNNR IN S_CUSTNO .
IF it_vbak[] IS NOT INITIAL .
*IF it_vbak IS NOT INITIAL .
SELECT VBELN
CMGST
FROM VBUK
INTO TABLE it_vbuk
FOR ALL ENTRIES IN it_vbak
WHERE VBELN = it_vbak-vbeln.
ENDIF .
loop at it_vbak .
read table it_vbak with key vbeln = it_vbak-vbeln .
if sy-subrc = 0 .
if it_vbuk-cmgst = 'B' or
it_vbuk-cmgst = 'c' .
it_final-cmgst = 'yes' .
flag = 'x' .
endif.
endif .
if it_vbak-lifsk ne space .
select single vtext from tvlst into it_final-vtext1
where lifsp = it_vbak-lifsk and spras = 'e' .
endif .
flag = 'x' .
if it_vbak-faksk ne space .
select single vtext from tvfst
into it_final-vtext1
where faksp = it_vbak and spras = 'e' .
append it_final .
clear it_final .
endif .
endloop .
loop at it_final .
write : /10 it_final-vbeln,
20 it_final-erdat,
35 it_final-kunnr,
50 it_final-vtext1 ,
75 it_final-vtext2,
100 it_final-cmgst .
endloop .
Still you are not filling output table properly.. i mean where u r filling vbeln and other fields into it_final.. CHeck that once..