Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

query

Former Member
0 Likes
381

Hi folks,

I have the requirement of modifying the already created script. I have to modify the driver program. The declarations for my driver program is below. Please help me how to write the query so that i can get the data from tables into the internal table.

DATA: BEGIN OF ITAB OCCURS 0,

CPER LIKE KNA1-NAME1,

ORDNO LIKE VBRK-VBELN,

ORDDAT LIKE VBRK-FKDAT,

INV LIKE VBAK-VBELN,

SLN TYPE N VALUE 1,

DESC(20),

QTY LIKE VBRP-FKIMG,

UNIT LIKE VBRP-VRKME,

AMNT LIKE VBRP-NETWR,

TAMNT LIKE VBRP-NETWR,

TAX LIKE VBRK-MWSBK,

TAXTYPE LIKE VBRK-J_1AFITP,

DISC LIKE KOMV-KBETR,

WRD(30),

TOT LIKE VBRP-NETWR,

PAYMT LIKE VBKD-ZTERM,

REM LIKE VBAK-AUGRU,

IMATNR LIKE VBRP-MATNR,

SORDNO LIKE VBKD-BSTKD,

KNUMV LIKE VBAK-KNUMV,

CESS LIKE KONV-KWERT,

SORDDAT LIKE VBKD-BSTDK,

IKUNNR LIKE KNA1-KUNNR,

IKWART LIKE KONV-KAWRT,

IKWERT LIKE KONV-KWERT,

IKWERT1 LIKE KONV-KWERT,

IKWERT2 LIKE KONV-KWERT,

IHREZ LIKE VBKD-IHREZ,

END OF ITAB.

DATA TAMNT TYPE P DECIMALS 2.

DATA: BEGIN OF IT_ADD OCCURS 0,

KUNNR LIKE KNA1-KUNNR,

NAME1 LIKE KNA1-NAME1,

NAME2 LIKE KNA1-NAME2,

ADD LIKE KNA1-STRAS,

CITY LIKE KNA1-ORT01,

POC LIKE KNA1-PSTLZ,

NAME3 LIKE vbak-bname,

START-OF-SELECTION.

SELECTION-SCREEN : BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.

PARAMETERS : P_VBELN LIKE VBRK-VBELN OBLIGATORY MATCHCODE

OBJECT VMCF.

SELECTION-SCREEN : END OF BLOCK BLK1.

Points will be awarded.

Regards

Swetha

3 REPLIES 3
Read only

Former Member
0 Likes
344

Any answers please am waiting

Read only

0 Likes
344

Swetha this is ur 3rd on the same issue , no body interested in giving out complete code for u , first u have to try at ur level then u can post in case of any issues.

Here u just declared Internal table and wants us to create a program for u ? that is not fare.

u can get invoice data from VBRK+VBRP .

Pricing data from KONP with VBRK-KNUMH.

Regards

Prabhu

Read only

Former Member
0 Likes
344

Hi,

See the sample query and modify with the required fields:

first VBRK and VBRP tables:

form invoice_selection.

select

a~vbeln " Billing Doc Number

a~fktyp " Billing Category

a~vbtyp " Sales Doc category

a~fkdat " Billing doc date

a~fkart " Billing doc type

a~bukrs " Company code

a~kurrf " Exchange rate

a~knumv " Condition record Number

a~waerk " Currency

a~kunag " Sold to Party

b~vrkme " Sales Unit

b~posnr " Item Number

b~charg " Batch Number

b~fkimg " Billed quantity

b~werks " Plant

b~matnr " Material Number

b~netwr " Net Value of Bill Doc

b~wavwr " Cost in Doc Currency

into table itab_bill

from vbrk as a join vbrp as b

on bvbeln = avbeln

where a~vbeln in s_vbeln .

loop at itab_bill.

itab_out-vbeln = itab_bill-vbeln.

itab_out-fktyp = itab_bill-fktyp.

itab_out-vbtyp = itab_bill-vbtyp.

itab_out-fkdat = itab_bill-fkdat.

itab_out-fkart = itab_bill-fkart.

itab_out-bukrs = itab_bill-bukrs.

itab_out-kurrf = itab_bill-kurrf.

itab_out-waerk = itab_bill-waerk.

itab_out-kunag = itab_bill-kunag.

itab_out-vrkme = itab_bill-vrkme.

itab_out-posnr = itab_bill-posnr.

itab_out-charg = itab_bill-charg.

itab_out-fkimg = itab_bill-fkimg.

itab_out-werks = itab_bill-werks.

itab_out-matnr = itab_bill-matnr.

itab_out-kdmat = itab_bill-kdmat.

clear : konv.

  • Pricing data from KONV table

select single kbetr kwert kpein from konv into

(konv-kbetr,konv-kwert,konv-kpein)

where knumv = itab_bill-knumv and

kposn = itab_bill-posnr and

kschl eq 'ZSP1' and

krech eq 'C' and

kinak eq ' '.

Move-corresponding fields from konv to itab_out.

fetch the Address details from KNA1 using VBRK-KUNAG field.

append itab_out.

clear itab_out.

endform .

reward if useful

regards,

ANJI