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

User exit issue

Former Member
0 Likes
741

I have created genric extracter on Header table,But for item table fields has been inclued in the extract structure.

In header table we have key Doc Number,where as in item table has several lintems for the Doc number.

When i write a user exit for line item data,which is picking first line item for the doc no from the Item table.

SELECT SINGLE ABC

XYZ

UVC

ASD

POS

INTO (<ZBW_EXTRACTER>-ABC,

<ZBW_EXTRACTER>-XYZ

<ZBW_EXTRACTER>-UVC,

<ZBW_EXTRACTER>ASD-,

<ZBW_EXTRACTER>-POS,

FROM ZTABLE_ITEM

WHERE DOCNUM = <ZBW_EXTRACTER>-DOCNUM.

This user exit is picking first line item from the ZTABLE_ITM for the Docu num of Heasdre table.

I would like to populate my structure with all line items for the Doc no.

How would i populate my extracter with all line items data.

Some one can help me in this scenario.

6 REPLIES 6
Read only

Former Member
0 Likes
718

SELECT <b>SINGLE</b> ABC

XYZ

UVC

ASD

POS

INTO (<ZBW_EXTRACTER>-ABC,

<ZBW_EXTRACTER>-XYZ

<ZBW_EXTRACTER>-UVC,

<ZBW_EXTRACTER>ASD-,

<ZBW_EXTRACTER>-POS,

FROM ZTABLE_ITEM

WHERE DOCNUM = <ZBW_EXTRACTER>-DOCNUM.

You select Query is supposed to fetch only one row as per the syntax. If u want to pick all the lines from it use INTO TABLE and remove the SINGLE statement.

or Do it inside a SELECT ENDSELECT.

Read only

0 Likes
718

SKC,

If i remove single ,which will fetch all the line items for the document number?

Document no is in Header table and as key ,where as in item table it is foreign key.

As per your instruction does it pull all the records from item table which is related document number.

Please guide me in this scenario.

Read only

0 Likes
718

SELECT ABC XYZ UVC ASD POS
INTO (<ZBW_EXTRACTER>-ABC,
<ZBW_EXTRACTER>-XYZ
<ZBW_EXTRACTER>-UVC,
<ZBW_EXTRACTER>ASD-,
<ZBW_EXTRACTER>-POS,
FROM ZTABLE_ITEM
WHERE DOCNUM = <ZBW_EXTRACTER>-DOCNUM
* Do the processing here - you will go thru the items here
* -----
ENDSELECT

better u select all the records at once -


IF NOT T_HEADER[] IS INITIAL.
SELECT ABC XYZ UVC ASD POS
INTO table t_items
FROM ZTABLE_ITEM
FOR  ALL ENTRIES IN T_HEADER
WHERE DOCNUM = T_HEADER-DOCNUM
ENDIF.

In this case - ur internal table T_HEADER should contain the Doc numbers, and for all these headers u ll get the items in internal table T_ITEM and then you can process using LOOP ENDLOOP or by READ itab statements.

Hope it explains.

Read only

0 Likes
718

SKC,

In my header table having 30 fields and item table have 5 fields.

My requirment is docu num is key in header table and each docum have several items from line item table.

I required total header fields 30 +line item data (5) fields.

Would it be possible if i am going to write a code as specified.

Please guide me.

Read only

0 Likes
718

Yes Aryan , u proceed in the way I have specified.

For example - Say u have got 4 header docs in ur internal table i_header_tab. and u populated that like this


SELECT docno docdate docetc
FROM    doc_header
INTO     TABLE i_header_tab
WHERE ...............

now for all these header data , u r trying to fetch the corresponding items then u ll write -


IF NOT i_header_tab[] IS INITIAL.

SELECT docno docitem fld2 fld3
FROM   doc_item
INTO     TABLE i_item_tab
FOR     ALL ENTRIES IN i_header_tab
WHERE docno = i_header_tab-docno.

So all the related items will be in the internal table i_item_tab.

Now u can process like this -

LOOP AT i_header_tab.

LOOP AT i_item_tab WHERE docno = i_header_tab-docno.

  • Processing logic for Items for Individual Doc numbers.

ENDLOOP.

ENDLOOP.

Does it help now ???

Read only

Former Member
0 Likes
718

Hi,

just remove the SINGLE from the query and

SELECT ABC XYX ..............

INTO corresponding fields of table zbw_extracter

from........