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: 

structure and internal table

Former Member
0 Kudos

is it possible to made a report by using internal talbe and structure....if yes how and if u have sample code for that pls tell me....

raju

1 ACCEPTED SOLUTION

Vinod_Chandran
Active Contributor
0 Kudos

Hi Raju,

Yes. It is possible. But it depends upon your requirement. Please check the transaction ABAPDOCU for examples.

Here are some examples

http://www.sapgenie.com/abap/code/chap1201.txt

http://www.sapgenie.com/abap/code/chap0103.txt

http://www.sapgenie.com/abap/code/chap0407.txt

http://www.sapgenie.com/abap/code/chap1112.txt

There are many examples here.

http://www.sapgenie.com/abap/example_code.htm

Cheers

Vinod

Message was edited by: Vinod C

13 REPLIES 13

Vinod_Chandran
Active Contributor
0 Kudos

Hi Raju,

Yes. It is possible. But it depends upon your requirement. Please check the transaction ABAPDOCU for examples.

Here are some examples

http://www.sapgenie.com/abap/code/chap1201.txt

http://www.sapgenie.com/abap/code/chap0103.txt

http://www.sapgenie.com/abap/code/chap0407.txt

http://www.sapgenie.com/abap/code/chap1112.txt

There are many examples here.

http://www.sapgenie.com/abap/example_code.htm

Cheers

Vinod

Message was edited by: Vinod C

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Types : begin of ty,

matnr type mara-matnr,

end of ty.

data : itab type standard table of ty,

wa type ty.

select matnr from mara into table itab.

loop at itab into wa.

write : wa-matnr.

endloop.

Kindly reward points by clicking the star on the left of reply,if it helps.

0 Kudos

i want to write a report with different fields ...some of them from internal table(ex:iseg) and some of them from structures (ex:vm07i) .....is it possible then tell me....

i know how to write with reports by using internal talbes..

Message was edited by: mpr raju

0 Kudos

yes it is possible, just you have to create one

more internal table which contain these both.

regards

0 Kudos

hi,

as far as i know, u will not be able to retrieve data from a structure....VM07I is a structure and not a table thus it will not contain any data. what u probably need to do is declare an internal table with the requisite fields (whether from structure or tables) and then write the logic to populate the internal table with data from the relevant <b>tables</b> and thereafter use this internal table for report output.....

rgds,

PJ

0 Kudos

Hi Raju,

Is the internal table iseg and the structure vm07i in your custom program? In that case you can use the WRITE statement to display it. Otherwise you have to find out the corresponding database table and select the data and then display it.

Cheers

Vinod

0 Kudos

problem is i have to write a report with the following fields

matnr type iseg-matnr,

gjahr type iseg-gjahr,

werks type iseg-werks,

iblnr type iseg-iblnr,

zeili type iseg-zeili,

buchm type iseg-buchm,

menge type iseg-menge,

dmbtr type iseg-dmbtr,

usnam type iseg-usnam,

lgort type iseg-lgort,

meins type iseg-meins,

  • difmg type t5d5e-difmg,

but here in t5d5e table contain only 3 kez fields mandt, MGKEY and MELGR.

and MELGR is only the field t5d5e no where else.

and MGKEY is only key field t5d5e...

in this case how can i use this field <b>DIFMG</b>..

RAJU..

0 Kudos

Hi,

Then u can create an internal table with all these fields

TABLES: iseg, t5d5e.

TYPES: BEGIN of ty_out,
        matnr LIKE iseg-matnr,
        gjahr LIKE iseg-gjahr,
        werks LIKE iseg-werks,
        iblnr LIKE iseg-iblnr,
        zeili LIKE iseg-zeili,
        buchm LIKE iseg-buchm,
        menge LIKE iseg-menge,
        dmbtr LIKE iseg-dmbtr,
        usnam LIKE iseg-usnam,
        lgort LIKE iseg-lgort,
        meins LIKE iseg-meins,
        difmg LIKE t5d5e-difmg,
EDN OF ty_out.

DATA: i_out TYPE STANDARD TABLE OF ty_out,
 work area
      wa_out TYPE ty_out.

0 Kudos

i did it same as u said ...but im getting the error like this...

Wrong table name or table alias name "T5D5E". the field "T5D5E~DIFMG".

in select statement.... how can i declare...

Message was edited by: mpr raju

0 Kudos

Hello Raju

I guess there is no linkage in ISEG ( Inventory Doc .) and T5D5E ( Supplemenary Bens. for Civil Service: Message Reason Table ) . Please check with you functional guy on how to link these . Is there a standard transaction where he/ she can show you the values i.e DIFMG value for an ISEG ( Inventory Document ).

Cheers.

0 Kudos

Hi,

As there is no key fields commmon to both the tables

it is not possible to use select using inner join.

U can use select

SELECT matnr
       gjahr
       werks
       iblnr
       zeili
       buchm
       menge
       dmbtr
       usnam
       lgort
       meins
       from iseg <b>into corresponding fields</b> 
   of table i_out.
       
if sy-subrc = 0.
 
endif.

U have to check whether if any of the values that r getting populted in itab can be equated with the

fields in the t5d5e table.

Then u can modify the table.

U can check with ur functional cons whether the

way u r retrieving is correct.

Also see whether u can compare ZEILI with MELGR if then u can do so as u expect.

0 Kudos

Try this out


TABLES: iseg, t5d5e.

TYPES: BEGIN of ty_out,
        matnr LIKE iseg-matnr,
        gjahr LIKE iseg-gjahr,
        werks LIKE iseg-werks,
        iblnr LIKE iseg-iblnr,
        zeili LIKE iseg-zeili,
        buchm LIKE iseg-buchm,
        menge LIKE iseg-menge,
        dmbtr LIKE iseg-dmbtr,
        usnam LIKE iseg-usnam,
        lgort LIKE iseg-lgort,
        meins LIKE iseg-meins,
        difmg LIKE t5d5e-difmg,
END OF ty_out.

DATA: i_out TYPE STANDARD TABLE OF ty_out,
* work area
      wa_out TYPE ty_out.

SELECT a~matnr
       a~gjahr
       a~werks
       a~iblnr
       a~zeili
       a~buchm
       a~menge
       a~dmbtr
       a~usnam
       a~lgort
       a~meins
       b~difmg
       from iseg
       as a inner join t5d5e as b
       on a~ZEILI = b~MELGR
       into table i_out.

if sy-subrc = 0.

endif.

LOOP AT i_out into wa_out.
  write: / wa_out-difmg.
clear wa_out.
ENDLOOP.

Check once the way of retrieval with ur FCs.