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: 

Issue with WRITE statement from Internal Table

Former Member
0 Kudos

Hi All,

I have written the below code in a infoset query, the syntax check is ok & when i run the query in debugging mode, i find the internal table being filled with the values & the write statement outputing the values as well.

But the problem is when i execute the query the output does not show all the lines, instead just displays the last record . What could be the mistake?

Is it because i have defined Y_EBELN, Y_EBELP & Y_OPENQTY as nodes in the Extras Tab of the infoset & have chosen this for display in my query? How to display the output from my internal table in my query output?

Hope my problem is clear, await clarification.

Vivek

Code

types:

Begin of itab,

wl_ebeln type eket-ebeln,

wl_ebelp type eket-ebelp,

wl_openqty type eket-menge,

End of itab.

Data: il_po type table of itab with header line.

*Display open PO for materials

SELECT EKETEBELN EKETEBELP EKETMENGE EKETWEMNG EKET~EINDT

INTO (Y_EBELN, Y_EBELP, WL_MENGE, WL_WEMNG, Y_EINDT)

FROM EKET

INNER JOIN EKPO

ON EKETEBELN = EKPOEBELN

AND EKETEBELP = EKPOEBELP

INNER JOIN MARD

ON EKPOMATNR = MARDMATNR

AND EKPOWERKS = MARDWERKS

AND EKPOLGORT = MARDLGORT

WHERE EKPO~MATNR = MARD-MATNR

AND EKPO~WERKS = MARD-WERKS

AND EKPO~LGORT = MARD-LGORT

AND EKPO~LOEKZ = SPACE

AND EKPO~ELIKZ = SPACE.

*Display only still open qty per schedule line

Y_OPENQTY = WL_MENGE - WL_WEMNG.

il_po-wl_ebeln = Y_EBELN.

il_po-wl_ebelp = Y_EBELP.

il_po-wl_openqty = Y_OPENQTY.

append il_po.

ENDSELECT.

ENDIF.

Loop at il_po.

write:/ il_po-wl_ebeln, il_po-wl_ebelp, il_po-wl_openqty.

endloop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

after append use clear.

append il_po.

clear il_po.

Thanks and regards

7 REPLIES 7

Former Member
0 Kudos

Hi,

after append use clear.

append il_po.

clear il_po.

Thanks and regards

0 Kudos

Mr. Chandra,

Thanks for the inputs, but it does not solve my problem. Any way how i can resolve this issue?

Vivek

Former Member
0 Kudos

Vivek,

In START-OF -SELECTON event in infotype you will get the final internal table Yes?

create all your internal table fields into extras.

Move all these fields into your field group.

Go to record processing event and

READ TABLE internal table

move values to fields which are in extras like internal table.

IN tcode sq01

change mode select all your extras fields by selecting check boxes in order.

activate and execute the query.

Don't forget to reward if useful.....

0 Kudos

Mr. Muralikrishna,

Thanks for your inputs. I will test the code as per your suggestion, i think it should work. Will post back after my test.

Note for Erwan Thanks for the inputs will check.

Note for Harita I dont think the issue is with the declaration part, but it is only with the display part. As i am writing a infoset query, as Mr. Murali suggests, i think i should pass the values to the nodes & then it will work.

But thanks none the less for your valuable inputs.

Edited by: Vivek on Jan 10, 2008 5:00 PM

Former Member
0 Kudos

Hi Vivek,

I think the internal table is not well define.

The logic seems good.

The program treat it like a structure and, so, you just have 1 record ( which is the last as previous were overwritten ).

Check your internal table declaration !

Hope this helps,

Erwan

Former Member
0 Kudos

Hi Vivek,

Try it like this.

Data: Begin of itab,

lifnr type lfa1-lifnr,

name1 type lfa1-name1,

land1 type lfa1-land1,

End of itab,

it_lfa1 like table of itab with header line,

lifnr like lfa1-lifnr,

name1 like lfa1-name1,

land1 like lfa1-land1.

select lifnr name1 land1 into (lifnr, name1, land1)

from lfa1.

it_lfa1-lifnr = lifnr.

it_lfa1-name1 = name1.

it_lfa1-land1 = land1.

append it_lfa1.

endselect.

loop at it_lfa1.

write:/ it_lfa1-lifnr, it_lfa1-name1, it_lfa1-land1.

endloop.

Note:

In place of the above select you insert your join select statement. It is working for me.

You have declared your internal table wrongly. In the internal table instead of TYPE use LIKE, it will work.

Hope this will work for you.

Thanks & Regards

Haritha.

Former Member
0 Kudos

hi vivek,

execute below progarm, i hope it is useful for u.

tables: EKET, EKPO,MARD.

data: itab like eket occurs 0 with header line.

SELECT EKETEBELN EKETEBELP EKETMENGE "EKETWEMNG EKET~EINDT

FROM EKET

INNER JOIN EKPO

ON EKETEBELN = EKPOEBELN

AND EKETEBELP = EKPOEBELP

INNER JOIN MARD

ON EKPOMATNR = MARDMATNR

AND EKPOWERKS = MARDWERKS

AND EKPOLGORT = MARDLGORT

into corresponding fields of itab.

write:/(40) itab-ebeln, (40) itab-ebelp, (10) itab-menge.

endselect.

reward me if it is useful for u