Skip to Content
0
Former Member
Apr 18, 2008 at 09:44 AM

Report Problem

15 Views

hi gurus,

i have a problem in alv report where the all codes are work rightly but it not print the data in list.

plz help me in this program. plz

DATA: BEGIN OF lt_output OCCURS 0,

vbeln TYPE vbak-vbeln, "Sales Document

audat TYPE vbak-audat, "Document date

auart TYPE vbak-auart, "Sales Document Type

vkorg TYPE vbak-vkorg, "Sales Organization

vtweg TYPE vbak-vtweg, "Distribution Channel

spart TYPE vbak-spart, "Division

bstnk TYPE vbak-bstnk, "Customer purchase order number

telf1 TYPE vbak-telf1, "Telephone number

kunnr TYPE vbak-kunnr, "Sold-to party

posnr TYPE vbap-posnr, "Sales Document Item

matnr TYPE vbap-matnr, "Material Number

kwmeng TYPE vbap-kwmeng, "Cumulative order quantity in sales

lsmeng TYPE vbap-lsmeng, "Cumulative required delivery qty

werks TYPE vbap-werks, "Plant

lgort TYPE vbap-lgort, "Storage Location

END OF lt_output.

DATA: BEGIN OF lt_vbak OCCURS 0,

vbeln TYPE vbak-vbeln, "Sales Document

audat TYPE vbak-audat, "Document date

auart TYPE vbak-auart, "Sales Document Type

vkorg TYPE vbak-vkorg, "Sales Organization

vtweg TYPE vbak-vtweg, "Distribution Channel

spart TYPE vbak-spart, "Division

bstnk TYPE vbak-bstnk, "Customer purchase order number

telf1 TYPE vbak-telf1, "Telephone number

kunnr TYPE vbak-kunnr, "Sold-to party

END OF lt_vbak.

DATA: BEGIN OF lt_vbap OCCURS 0,

vbeln TYPE vbap-vbeln, "Sales Document

posnr TYPE vbap-posnr, "Sales Document Item

matnr TYPE vbap-matnr, "Material Number

kwmeng TYPE vbap-kwmeng, "Cumulative order quantity in sales

lsmeng TYPE vbap-lsmeng, "Cumulative required delivery qty

werks TYPE vbap-werks, "Plant

lgort TYPE vbap-lgort, "Storage Location

END OF lt_vbap.

SELECT-OPTIONS: s_audat FOR lt_vbak-audat, "OBLIGATORY,

s_matnr FOR lt_vbap-matnr,

s_vkorg FOR lt_vbak-vkorg,

s_vtweg FOR lt_vbak-vtweg,

s_spart FOR lt_vbak-spart,

s_werks FOR lt_vbap-werks.

INCLUDE: ZA_COMMON_ALV_FM.

START-OF-SELECTION.

PERFORM get_data.

PERFORM fieldcatlog USING gt_fieldcat[].

PERFORM print_alv_data_list.

*&----


*

*& Form get_data

*&----


*

  • text

*----


*

FORM get_data.

SELECT vbeln

audat

auart

vkorg

vtweg

spart

bstnk

telf1

kunnr

FROM vbak INTO TABLE lt_vbak

WHERE audat IN s_audat AND

( auart = 'KA' OR

auart = 'KB' OR

auart = 'KE' ) AND

vkorg IN s_vkorg AND

vtweg IN s_vtweg AND

spart IN s_spart.

IF sy-subrc = 0.

SORT lt_vbak[] BY vbeln.

DELETE ADJACENT DUPLICATES FROM lt_vbak[]

COMPARING vbeln.

IF NOT lt_vbak[] IS INITIAL.

SELECT vbeln

posnr

matnr

kwmeng

lsmeng

werks

lgort

FROM vbap

INTO TABLE LT_VBAP

FOR ALL ENTRIES IN lt_vbak

WHERE vbeln = lt_vbak-VBELN AND

matnr IN s_matnr AND

werks IN s_werks.

IF sy-subrc = 0.

SORT lt_vbap[].

DELETE ADJACENT DUPLICATES FROM lt_vbap[]

COMPARING ALL FIELDS.

APPEND lt_output.

LOOP AT lt_vbap.

lt_output-vbeln = lt_VBAP-vbeln.

lt_output-posnr = lt_VBAP-POSNR.

lt_output-matnr = lt_VBAP-MATNR.

lt_output-kwmeng = lt_VBAP-KWMENG.

lt_output-lsmeng = lt_VBAP-LSMENG.

lt_output-werks = lt_VBAP-WERKS.

lt_output-lgort = lt_VBAP-LGORT.

MODIFY LT_OUTPUT

TRANSPORTING vbeln

posnr

matnr

kwmeng

lsmeng

werks

lgort

WHERE vbeln = lt_vbap-vbeln AND

posnr = lt_vbap-posnr.

CLEAR : LT_VBAP,

lt_output.

ENDLOOP.

LOOP AT lt_vbak.

lt_output-audat = lt_vbak-audat.

lt_output-auart = lt_vbak-auart.

lt_output-vkorg = lt_vbak-vkorg.

lt_output-vtweg = lt_vbak-vtweg.

lt_output-spart = lt_vbak-spart.

lt_output-bstnk = lt_vbak-bstnk.

lt_output-telf1 = lt_vbak-telf1.

lt_output-kunnr = lt_vbak-kunnr.

MODIFY LT_OUTPUT

TRANSPORTING audat

auart

vkorg

vtweg

spart

bstnk

WHERE vbeln = lt_vbak-vbeln.

CLEAR: lt_vbak,

LT_OUTPUT.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

ENDFORM.

FORM fieldcatlog USING rt_fieldcat TYPE slis_t_fieldcat_alv.

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

DATA: tablename LIKE ls_fieldcat-tabname.

DATA: n TYPE sycucol VALUE 1.

REFRESH rt_fieldcat. CLEAR ls_fieldcat.

tablename = 'LT_OUTPUT'.

CLEAR ls_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'vbeln'.

ls_fieldcat-outputlen = '18'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'consign fillup'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'audat'.

ls_fieldcat-outputlen = '10'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'date'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'bstnk'.

ls_fieldcat-outputlen = '11'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'purch. order'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'telf1'.

ls_fieldcat-outputlen = '11'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'telno'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'matnr'.

ls_fieldcat-outputlen = '18'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'mat nr'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'kwmeng'.

ls_fieldcat-outputlen = '15'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'qty consigned'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'lsmeng'.

ls_fieldcat-outputlen = '11'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'o/p qty'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'werks'.

ls_fieldcat-outputlen = '7'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'plant'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'lgort'.

ls_fieldcat-outputlen = '11'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'store'.

APPEND ls_fieldcat TO rt_fieldcat.

n = n + 1.

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = n.

ls_fieldcat-fieldname = 'kunnr'.

ls_fieldcat-outputlen = '30'.

ls_fieldcat-tabname = tablename.

ls_fieldcat-seltext_l = 'sales emp'.

APPEND ls_fieldcat TO rt_fieldcat.

ENDFORM.

help me its urgent i am stuck in this programm.

thanks.

jayant