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

Internal table

Former Member
0 Likes
862

Hi Experts,

I have the requirement as follows:

Requirement:

My requirement is to combine the contents of tables t_xebkn and t_xeban into one internal table and pass it to the function

Z_WRITE_TO_QUEUE.

Please Pardon my ignorance with regards to code syntax but this what I am looking to do.

I want to create an internal table like this and pass Itab1 to the function module:

Data: Begin of Itab1

abc like eban,

xyz like ebkn,

End of Itab1.

I would really appreciate if someone can provide me code example on

how to do that.

Thanks.

Regards,

bw_newbie

Code:

FUNCTION ZSC_FUNC1.

*"----


""Local Interface:

*" TABLES

*" T_XEBAN STRUCTURE EBAN OPTIONAL

*" T_XEBKN STRUCTURE EBKN OPTIONAL

*" T_YEBAN STRUCTURE EBAN OPTIONAL

*" T_YEBKN STRUCTURE EBKN OPTIONAL

*"----


data:

l_datasource type roosource-oltpsource.

l_datasource = 'Z_BTE_DELTA'.

if lines( t_xebkn[] ) gt 0.

call function 'Z_WRITE_TO_QUEUE'

exporting

i_datasource = l_datasource

tables

i_t_data = t_xebkn.

endif.

Edited by: Alvaro Tejada Galindo on Apr 8, 2008 3:52 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
821

Hi Ramiro,

Thanks for the reply. If you look at my original post. I have the code listed there for Function ZSC_FUNC1 which is recieving the tables tables t_xebkn (ebkn) and t_xeban (eban). Please let me know if

the code you had provided would work in my scenario.

Thanks.

Regards,

bw_newbie

9 REPLIES 9
Read only

Sm1tje
Active Contributor
0 Likes
821

Data: Begin of Itab1.

include structure eban.

include structure ebkn.

End of Itab1.

Read only

Former Member
0 Likes
821

Hi Micky,

Thanks for the reply. I get the following error message

"ITAB1-MANDT" has already been declared." How can I fix this error?

Thanks.

Regards,

bw_newbie

Read only

Former Member
0 Likes
821

The two tables are always going to have the same number of records?

They are always going to have the same keys?

if so, do something like this


TYPES: BEGIN OF all_two.
        INCLUDE STRUCTURE eban AS a RENAMING WITH SUFFIX a.
        INCLUDE STRUCTURE ebkn AS k RENAMING WITH SUFFIX k.
TYPES: END OF all_two.

data: i_tab1 type table of all_two.

Now you have the table, but we really need to know how those tables are filled before appending them to the itab_1

Read only

Former Member
0 Likes
822

Hi Ramiro,

Thanks for the reply. If you look at my original post. I have the code listed there for Function ZSC_FUNC1 which is recieving the tables tables t_xebkn (ebkn) and t_xeban (eban). Please let me know if

the code you had provided would work in my scenario.

Thanks.

Regards,

bw_newbie

Read only

0 Likes
821

I don't know what that function or the calling function will do, because they are custom functions.

You only asked to join those tables into one, yes is possible. However is important to know the structure of the tables

The problem is eban has only 2 keys, while ebkn has 3.

an example

eban with

BANFN BFNPO

00001 000001

and ebkn with

BANFN BFNPO ZEBKN

00001 000001 000001

Our itab1 is easy too understand it will combine those two records, because they have the same keys banfn and bfnpo

However, if we had

eban with

BANFN BFNPO

00001 000001

and ebkn with

BANFN BFNPO ZEBKN

00001 000001 000001

00001 000001 000002

How are we going to combine them in itab1? We repeat eban for each ebkn? we leave eban alone in the secon ebkn?

And the other possibilities.

What if we don't find matching records?

Are we going to let them outside itab1?

That's your task too figure it out

Read only

0 Likes
821

You have multiple TABLES parameters in the FM. You should be able to pass different itabs to these parameters in the FM call. Why do we need to combine two tables?

Sanjeev

Read only

0 Likes
821

They want him to pass the two tables combined to 'Z_WRITE_TO_QUEUE'

Something tells me that function has a generic table as a parameter.

Something also tells me joining the two tables is not going to give the desired results.

Something tells me that the FM might work if you call it two times with a different table

Read only

Former Member
0 Likes
821

Hi Ramiro and Sanjeev,

Thank you for taking time to respond to my questions.

Ramiro:

To your point that the keys in EBAN and EBKN are not the same:

When this function module is invoked by the system. I will have data either in the table t_xebkn or t_xeban whenever Function ZSC_FUNC is invoked. I will never have data (rows) in both the tables at the same time.

I am actually implementing a BTE for Requisitions. In the BTE Function module my intent was to capture changes for both Requisitions (EBAN) and also Account Assignment (EBKN) at the same time and then write the changes to a Delta Queue and then pass it to SAP BW.

I guess I will create two seperate extractors to keep things simple. Then, I will be able to invoke the Function 'Z_WRITE_TO_QUEUE' once for table t_xebkn and then t_xeban.

Thanks a lot for your help.

<REMOVED BY MODERATOR>

Regards,

bw_newbie

Edited by: Alvaro Tejada Galindo on Apr 8, 2008 5:14 PM

Read only

Former Member
0 Likes
821

Hi Ramiro/Sanjeev,

I have assigned points and closed the thread.

Thanks.

bw newbie