Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reports display

Hi,

i create an alv report but i am not get data from DB table into my internal table plz tell me where i am do mistake in this programm

TYPES: BEGIN OF gty_output,

vbeln TYPE vbrk-vbeln, " Billing Document

fkart TYPE vbrk-fkart, " Billing Type

vkorg TYPE vbrk-vkorg, " Sales area

vtweg TYPE vbrk-vtweg, " Distribution Channel

kalsm TYPE vbrk-kalsm, " Pricing Procedure

knumv TYPE vbrk-knumv, " Document Condition

bukrs TYPE vbrk-bukrs, " Company Code

kunrg TYPE vbrk-kunrg, " Payer

spart TYPE vbrk-spart, " Division

vbund TYPE vbrk-vbund, " Company ID of Trading Partner

fkimg TYPE vbrp-fkimg, " Invoiced Quantity

matnr TYPE vbrp-matnr, " Material Number

kvgr3 TYPE vbrp-kvgr3, " Customer group

END OF gty_output.

  • Billing Document Header Data

TYPES: BEGIN OF gty_vbrp,

vbeln TYPE vbrp-vbeln, " Billing Document

fkimg TYPE vbrp-fkimg, " Invoiced Quantity

matnr TYPE vbrp-matnr, " Material Number

kvgr3 TYPE vbrp-kvgr3, " Customer group

END OF gty_vbrp.

CONSTANTS: c_sa TYPE char4 VALUE 'SD02'.

  • Distribution Channel

CONSTANTS: c_vt TYPE char2 VALUE 'AI'.

  • Pricing Procedure

CONSTANTS: c_ct TYPE char6 VALUE 'ZMP001'.

  • Company Code

CONSTANTS: c_cd TYPE char4 VALUE '8614'.

  • Division

CONSTANTS: c_dv TYPE char2 VALUE 'AG'.

SELECT-OPTIONS: s_matnr FOR gv_matnr,

  • Refrence Document Number

s_vbeln FOR gv_vbeln,

  • Customer

s_kunrg FOR gv_kunrg,

  • Transaction Partner

s_vbund FOR gv_vbund,

  • Posting Date

s_budat FOR gv_budat,

  • Customer group 3

s_kvgr3 FOR gv_kvgr3.

PARAMETERS: p_fkimg TYPE fkimg.

SELECTION-SCREEN END OF BLOCK blk.

FORM get_data CHANGING ch_it_output TYPE gta_output

ch_wa_output TYPE gty_output

ch_it_vbrp TYPE gta_vbrp

ch_wa_vbrp TYPE gty_vbrp.

SELECT vbeln

fkart

vkorg

vtweg

kalsm

knumv

bukrs

kunrg

spart

vbund

INTO TABLE ch_it_output

FROM vbrk

WHERE vbeln IN s_vbeln AND

fkart = c_bt AND

vkorg = c_sa AND

vtweg = c_vt AND

kalsm = c_ct AND

bukrs = c_cd AND

kunrg IN s_kunrg AND

spart = c_dv AND

vbund IN s_vbund.

IF sy-subrc = 0.

SORT ch_it_output[] BY vbeln.

DELETE ADJACENT DUPLICATES FROM ch_it_output[] COMPARING vbeln.

ENDIF.

IF NOT ch_it_output[] IS INITIAL.

SELECT vbeln

fkimg

matnr

kvgr3

INTO TABLE ch_it_vbrp

FROM vbrp

FOR ALL ENTRIES IN ch_it_output

WHERE vbeln = ch_it_output-vbeln AND

fkimg = p_fkimg AND

matnr IN s_matnr AND

kvgr3 IN s_kvgr3.

IF sy-subrc = 0.

SORT ch_it_vbrp[] BY vbeln.

DELETE ADJACENT DUPLICATES FROM ch_it_vbrp[] COMPARING vbeln.

ENDIF.

LOOP AT ch_it_output INTO ch_wa_output.

READ TABLE ch_it_vbrp INTO ch_wa_vbrp WITH KEY vbeln = ch_wa_output-vbeln

BINARY SEARCH.

IF sy-subrc = 0.

MOVE: ch_wa_vbrp-fkimg TO ch_wa_output-fkimg.

MOVE: ch_wa_vbrp-matnr TO ch_wa_output-matnr.

MOVE: ch_wa_vbrp-kvgr3 TO ch_wa_output-kvgr3.

MODIFY ch_it_output FROM ch_wa_output

TRANSPORTING fkimg matnr kvgr3

WHERE vbeln = ch_wa_vbrp-vbeln.

CLEAR: ch_wa_vbrp.

ENDIF.

CLEAR: ch_wa_output.

ENDLOOP.

endform.

Thanks,

jayant.

plz tell me where is mistake in this code i am not get data in table ch_it_vbrp.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question