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

Fetching data from KRMI transaction

Former Member
0 Likes
398

Hi experts,

I want to fetch the quantity data from KRMI transaction and use this in my report.

How to fetch the data from this transaction and after fetching how to use this in my report?

1 REPLY 1
Read only

deepak_dhamat
Active Contributor
0 Likes
343

dear praveen ,

create one report in se38 and

paste this code and just change selection parameter according to your requirment I.E MATNR ='WFHAR02570' OR KOKRS = 'XYX' ETC ......

and also change no of fields you want in work area .

data : listtab like abaplist occurs 1 .

data : listtab_tmp like abaplist occurs 1.

data: txtlines(2000) type c occurs 0 with header line.

data :txtlines1(2000) type c occurs 0 with header line .

data : n type int2 .

data : cnt type i value 1 .

types : begin of wa_alpha,

a(30) type c ,

b(30) type c ,

c(30) type c ,

d(30) type c ,

e(30) type c ,

f(30) type c ,

g(30) type c ,

h(30) type c ,

i(30) type c ,

j(30) type c ,

k(30) type c ,

l(30) type c ,

end of wa_alpha .

data : it_alpha type standard table of wa_alpha with header line .

data : it_alpha1 type standard table of wa_alpha with header line .

submit KRMI using "selecting parameter " exporting list to memory and return .

call function 'LIST_FROM_MEMORY'

tables

listobject = listtab

exceptions

not_found = 1

others = 2.

if sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

describe table listtab lines n .

check sy-subrc = 0.

call function 'LIST_TO_ASCI'

tables

listobject = listtab

listasci = txtlines

exceptions

empty_list = 1

list_index_invalid = 2

others = 3.

check sy-subrc = 0.

describe table txtlines lines n .

n = n - 2.

loop at txtlines .

if cnt = 1 or cnt = 3 .

delete txtlines .

endif.

if cnt = n .

delete txtlines .

endif.

cnt = cnt + 1 .

clear txtlines .

endloop.

data : delimiter(1) value '|'.

loop at txtlines.

split txtlines at delimiter into it_alpha-a

it_alpha-b

it_alpha-c

it_alpha-d

it_alpha-e

it_alpha-f

it_alpha-g

it_alpha-h

it_alpha-i

it_alpha-j

it_alpha-k

it_alpha-l .

append it_alpha .

clear txtlines .

endloop.

Use this logic your problem will solve .....

Thanks And Regards

Deepak Dhamat