Application Development 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: 

FI Document Programing

Former Member
0 Kudos
194

Hello Experts,

I was trying to build a FI Report, that contain this parameters:

from Table BKPF :

bukrs, belnr, gjahr

from Table BSEG :

buzei, dmbtr, vorgn

the structure that I planned is this:

can someone please tell me what is wrong in this structure???

I am total confused...

DATA: gs_bkpf TYPE bkpf.

DATA: gt_bkpf TYPE STANDARD TABLE OF bkpf.

DATA: gs_bseg TYPE bseg.

DATA: gt_bseg TYPE STANDARD TABLE OF bseg.

TYPES: BEGIN OF ts_beanz,

bukrs TYPE bukrs,

belnr TYPE belnr,

gjahr TYPE gjahr,

buzei TYPE buzei,

dmbtr TYPE dmbtr,

vorgn TYPE vorgn,

END OF ts_beanz.

DATA: gs_beanz TYPE ts_beanz.

DATA: gt_beanz TYPE STANDARD TABLE OF ts_beanz.

SELECT-OPTIONS: pr_belnr FOR gs_bkpf-belnr.

PARAMETERS: bukrs TYPE bukrs,

gjahr TYPE gjahr.

START-OF-SELECTION.

SELECT belnr bukrs gjahr FROM bkpf

INTO CORRESPONDING FIELDS OF gs_bkpf

WHERE belnr IN pr_belnr

and bukrs = bukrs

and gjahr = gjahr.

endselect.

select belnr dmbtr from bseg

into corresponding fields of gs_bseg

where belnr in pr_belnr

and dmbtr = dmbtr.

endselect.

12 REPLIES 12

Former Member
0 Kudos
125

Hi,

gs_bkpf,gt_bkpf,gs_bseg , gt_bseg are workareas and tables type BKPF and BSEG.

While in select statement you are just fetching 2-3 fields from each table.

defien a seperate type for both tables. Use that for defining teh workareas and internal. tables.

Then use that in your select statemnt.

0 Kudos
125

thx for the quick responde.

can you pls explaine me a bit more how can I do it?

do you speak about making a 4th Table? I have already ts_beanz, bkpf and bseg...

0 Kudos
125

Hi Kfir,

your select statment is:

SELECT belnr bukrs gjahr FROM bkpf

INTO CORRESPONDING FIELDS OF gs_bkpf

WHERE belnr IN pr_belnr

and bukrs = bukrs

and gjahr = gjahr.

endselect.

you nee dto define a type for gs_bkpf,

i.e:

types: begin of ty_bkpf,

belnr type belnr_d,

gjahr type gjahr,

bukrs type bukrs,

end of ty_bkpf.

data: gt_bkpf type table of ty_bkpf,

gs_bkpf type ty_bkpf.

do the same for bseg.

When you fetch data from a table, you fetch it into a workarea/internal table having same structure as teh fields you are fetching. So if you fetch 3 fields, you fetch them into a table having just those 3 fields in same order.

Please go thru select statement basics.Would help you.

0 Kudos
125

Hi,

suppose in the BKPF and BSEG table what are the values your selecting that one only u should declare like below.


TYPES : BEGIN OF ty_bkpf,
        BUKRS	TYPE BUKRS,
        BELNR	TYPE BELNR_D,
        GJAHR TYPE GJAHR,
        END OF ty_bkpf.
        
TYPES : BEGIN OF ty_bseg,
        BUKRS	TYPE BUKRS,
        BELNR	TYPE BELNR_D,
        GJAHR TYPE GJAHR,
        BUZEI	TYPE BUZEI,
        END OF ty_bseg.      
        
DATA: gs_bkpf TYPE ty_bkpf.
DATA: gt_bkpf TYPE STANDARD TABLE OF ty_bkpf.
DATA: gs_bseg TYPE ty_bseg.
DATA: gt_bseg TYPE STANDARD TABLE OF ty_bseg.          

then no need give INTO CORRESPONDING FIELDS OF it will reduce the performance.


SELECT belnr bukrs gjahr FROM bkpf
INTO TABLE gs_bkpf
WHERE belnr IN pr_belnr
and bukrs = bukrs
and gjahr = gjahr.

Regards,

Dhina..

0 Kudos
125

Dear Dhina,

I was trying to folow your advice, but it doesnt work...

thank you for your time

0 Kudos
125

where can I find the select statement basics?

goolge bring nothing with SAP...

thx

0 Kudos
125

Hi,

I fail to understand why the logic i have suggested ir dhina has sugegsted doesnt work.

Are you getting some error?

Do a sy-subrc check after the select statement.

Are you getting sy-subrc 4?

Goto transaction abapdocu to check out sap examples and check saphelp for any doubts on select statement.

0 Kudos
125

Hi,

I made some mistake change the code like


SELECT belnr bukrs gjahr FROM bkpf
INTO TABLE gt_bkpf"here you declare ITab name
WHERE belnr IN pr_belnr
and bukrs = bukrs
and gjahr = gjahr.

type select and pressf1 key you can find it..

see the below link is more helpful..

http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb39eb358411d1829f0000e829fbfe/content.htm

Regards,

Dhina..

Edited by: Dhina DMD on Jun 21, 2011 12:32 PM

0 Kudos
125

I dont get an Error, but I do get this massege:

Field ´´pr_buzei`` is unknown. You shuld define it through a table or a Data command.

and when I do it, than I must do i to the dmbtr, vorgn and than I become more confused....

and now to the original Question:

how would you build a Program, that will show the next Data:

BKDF:

bukrs, belnr, gjahr

BSEG:

buzei, dmbtr, vorgn

regards,

Kfir

0 Kudos
125

Hi,

1)i donot see any pr_buzei in the code snippet you have pasted.

2)Also, you seem confused in your requirement.

please try and understand what you intend to do and what are the basic steps in coding.

We cannot spoon feed you here.

0 Kudos
125

I was asking for Structure, I dont really expect that someone will code for me...

thank you all for the help and the time!

monika_dhumal
Participant
0 Kudos
125

What exactly you need? please describe. first select the data into internal table and then read that data.

For that define your internal tables like

DATA: gs_bkpf TYPE bkpf.

DATA: gt_bkpf TYPE STANDARD TABLE OF bkpf Occurs 0 with HEADER LINE.

DATA: gs_bseg TYPE bseg.

DATA: gt_bseg TYPE STANDARD TABLE OF bseg Occurs 0 with HEADER LINE.

.