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

How to get data from database?

Former Member
0 Likes
682

In most cases, I get requirments from module consultant to creat a new program or modify an old one without knowing how to get to the source of data. I mean what are the database tables to be used in the report.

How to get this information?

Module consultant claims that they didn't study that in their courses.

thanks alot.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
641

Hi albara,

1 Creating a new program.

As per the protocol followed in various companies,

it is the Functional Consultants job

to provide the required information about

tables. The provide details

about selection screen parameters,tables,

logic etc in the format of SPECIFICATIONS.

As an abaper, we can use our knowledge

and experience, but still the ball is always

in their court. Becuase we are not the process

owners of the module/business process.

2. Modifying an old one.

Modifying SAP standard program is absolytely not recommended.

Copying and modifying is still advisable.

But in such cases nobody knows the

LOGIC ( neither the consultant nor us)

hence, at the most we can use our experience/knowledge

or debug the program to gather required information.

But such practice is very time consuming .

3. I mean to say, that there has to be

some THIN LINE between our work as a abaper

and the work of functional consultants.

regards,

amit m.

Hi albara,

1 Creating a new program.

As per the protocol followed in various companies,

it is the Functional Consultants job

to provide the required information about

tables. The provide details

about selection screen parameters,tables,

logic etc in the format of SPECIFICATIONS.

As an abaper, we can use our knowledge

and experience, but still the ball is always

in their court. Becuase we are not the process

owners of the module/business process.

2. Modifying an old one.

Modifying SAP standard program is absolytely not recommended.

Copying and modifying is still advisable.

But in such cases nobody knows the

LOGIC ( neither the consultant nor us)

hence, at the most we can use our experience/knowledge

or debug the program to gather required information.

But such practice is very time consuming .

3. I mean to say, that there has to be

some THIN LINE between our work as a abaper

and the work of functional consultants.

regards,

amit m.

3 REPLIES 3
Read only

Former Member
0 Likes
641

Albara,

Well the question is not clear?

If you want to find out which are the database tables that you need to access, what you can do go to specific transaction put the curson on a field press F1 and click on the technical details. You should be able to see the table in which that field exist.

Once you identify the tables, it will be simple SELECT statements using which you can fetch the data.

Regards,

Ravi

Note : Please reward points if this helps

Read only

Former Member
0 Likes
642

Hi albara,

1 Creating a new program.

As per the protocol followed in various companies,

it is the Functional Consultants job

to provide the required information about

tables. The provide details

about selection screen parameters,tables,

logic etc in the format of SPECIFICATIONS.

As an abaper, we can use our knowledge

and experience, but still the ball is always

in their court. Becuase we are not the process

owners of the module/business process.

2. Modifying an old one.

Modifying SAP standard program is absolytely not recommended.

Copying and modifying is still advisable.

But in such cases nobody knows the

LOGIC ( neither the consultant nor us)

hence, at the most we can use our experience/knowledge

or debug the program to gather required information.

But such practice is very time consuming .

3. I mean to say, that there has to be

some THIN LINE between our work as a abaper

and the work of functional consultants.

regards,

amit m.

Read only

Former Member
0 Likes
641

Albara,

When your creating new programs in the top of your

program TABLES statement is used to declare tables.

Also you can use transaction code SQVI to see relation

between two tables i mean joins. Also SE11 is the

transaction of Data Dictionary where you can see all

database tables. I have attached small code with this.

So that you will understand joins and table declaratin

in ABAP.

I hope this will slove your problem. If you get any

addtional info from this please reward the points.

Thanks.

&----


*& Report ZVENDOR_CHECK_REPORT

*&

&----


*&

*&

&----


REPORT ZVENDOR_CHECK_REPORT.

&----


*& Tables

&----


Tables: PAYR,

BKPF,

BSEG.

&----


*& Structure

&----


DATA: BEGIN OF WA_RECORD,

LIFNR LIKE PAYR-LIFNR,

ZNME1 LIKE PAYR-ZNME1,

CHECT LIKE PAYR-CHECT,

ZALDT LIKE PAYR-ZALDT,

BELNR LIKE BSEG-BELNR,

WRBTR LIKE BSEG-WRBTR,

BLART LIKE BKPF-BLART,

BLDAT LIKE BKPF-BLDAT,

XBLNR LIKE BKPF-XBLNR,

END OF WA_RECORD.

&----


*& Internal Table

&----


DATA: IT_RECORD LIKE WA_RECORD OCCURS 0 WITH HEADER LINE.

&----


*& Selection Screen

&----


selection-screen begin of block i_data with frame title text-002.

select-options: s_gjahr FOR payr-GJAHR,

s_lifnr for payr-Lifnr,

s_chect for payr-Chect,

s_belnr for bkpf-Belnr,

s_bldat for bkpf-Bldat.

selection-screen end of block i_data.

&----


*& Start of selection

&----


start-of-selection.

PERFORM BASIC_DATA USING S_GJAHR S_LIFNR S_CHECT S_BELNR S_BLDAT.

PERFORM BSEG_DATA USING IT_RECORD.

&----


*& Form BASIC_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM BASIC_DATA USING P1 P2 P3 P4 P5.

SELECT AZBUKR ACHECT ALIFNR AVBLNR AGJAHR AZALDT

BBLDAT BBLART BXBLNR BBELNR

INTO CORRESPONDING FIELDS OF TABLE IT_RECORD

FROM PAYR AS A INNER JOIN BKPF AS B

ON AZBUKR = BBUKRS

AND AVBLNR = BBELNR

AND AGJAHR = BGJAHR

WHERE A~GJAHR IN S_GJAHR

AND A~LIFNR IN S_LIFNR

AND A~CHECT IN S_CHECT

AND A~VBLNR IN S_BELNR

AND B~BLDAT IN S_BLDAT.

SORT IT_RECORD BY ZALDT LIFNR.

ENDFORM. " BASIC_DATA

&----


*& Form BSEG_DATA

&----


  • text

----


  • -->P_IT_RECORD text

----


FORM BSEG_DATA USING P_IT_RECORD.

READ TABLE

ENDFORM. " BSEG_DATA