Skip to Content

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

moving data in all the internal tables to the final table t_data

hi all,

how to data in all the internal tables to the final table t_data

*selecting fields from bkpf table

SELECT bukrs

belnr

gjahr

bldat

xblnr

usnam

FROM bkpf

INTO TABLE t_bkpf

WHERE bukrs EQ po_bukrs AND

belnr IN so_belnr AND

budat IN so_budat AND

blart IN so_blart.

IF t_bkpf[] IS INITIAL.

MESSAGE a999(zfi_ap_gl) WITH text-011.

STOP.

ELSE.

*selecting fields from bseg table.

SELECT bukrs

belnr

gjahr

koart

shkzg

dmbtr

zuonr

sgtxt

kostl

hkont

lifnr

prctr

FROM bseg

INTO TABLE t_bseg

FOR ALL ENTRIES IN t_bkpf

WHERE bukrs EQ t_bkpf-bukrs AND

belnr EQ t_bkpf-belnr AND

gjahr EQ t_bkpf-gjahr AND

lifnr IN so_lifnr.

ENDIF.

IF t_bseg[] IS INITIAL.

MESSAGE a999(zfi_ap_gl) WITH text-011.

STOP.

ELSE.

*selecting the companies address from adrc table

SELECT SINGLE addrnumber street str_suppl2 city1

region post_code1

FROM adrc

INTO wa_adrc

WHERE addrnumber EQ w_adrnr.

*selecting adrnr from the lfa1 table

SELECT lifnr adrnr name1 ort01 regio pstlz

FROM lfa1

INTO TABLE t_adrnr

FOR ALL ENTRIES IN t_bseg

WHERE lifnr EQ t_bseg-lifnr.

IF NOT t_adrnr[] IS INITIAL.

*populating the t_vaddress table.

SELECT addrnumber

street

str_suppl2

FROM adrc

INTO TABLE t_vaddress

FOR ALL ENTRIES IN t_adrnr

WHERE addrnumber EQ t_adrnr-adrnr.

*populating the t_vendor table with the vendor address

SELECT lifnr

adrnp_2

namev

name1

INTO TABLE t_vendor

FROM knvk

FOR ALL ENTRIES IN t_adrnr

WHERE lifnr EQ t_adrnr-lifnr AND

adrnp_2 EQ t_adrnr-adrnr.

ENDIF.

ENDIF.

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