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: 

Records from a Table as input to a method in eCATT.

Former Member
0 Kudos

Hello Gurus,

How can one achieve this in eCATT. I have to retrieve records from a table based on a condition and use one of the columns from the retrieved records as input to the method in eCATT. If there are 10 records then the method should get executed 10 times with diff input everytime.

For example: If table T1 contains multiple records with A1, B1, C1, D1 as four coloumns then first retrieve all records where D1>5. Then pass B1 as input for the method M1 and perform this operation for all the retrieved records.

I am using SAP 4.7. Please let me know if this can be achieved in eCATT tool.

Regards,

GS...

4 REPLIES 4

venkatesh_sakthivel
Active Participant
0 Kudos

Hi,

I think its possible but little hard to write the ABAP code inside the ABAP..ENDABAP statement.

Use select command to sort out the condition and retreive your records(Column and result).

Count the number of records for this select statement,Say N.

Say N times,you can execute your method in eCATT with different values.

Place a increment counter once the method is executed.

remember to use local variables inside the ABAP..ENDABAP and the conditon for a while loop as well.

Hope it helps.

Regards,

Venky

Former Member
0 Kudos

Hello,

For this you need to write an Select statment within ABAP .... ENDABAP, so you create a paramter of the table type from where you want to retrieve the value. So all the values based on where clause will be saved in the corresponding fields of your table type parameter.

Declare this parameter and local value as the scope of the parameter types in ABAP ... ENDABAP is only local.

Then assign this local parameter to the export parameter declared as same as local type.

Then you can use the values in the export parameter in other ecatts.

Thanks & Best regards,

Ajay

0 Kudos

Hello Ajay/Venkat,

Thanks for replying to the thread. I have used your instructions but still not getting the desired output. Let me tell you what I am doing.

First I have declared a parameter T2 as local variable of table type T1 from which I want to write a query. Then within ABAP...ENDABAP I have written the following selection query.

ABAP.

SELECT * FROM T1 INTO CORRESPONDING FIELDS OF T2

WHERE C1 > SY-DATUM

ENDSELECT.

ENDABAP.

T3 = T2. ( T3 is an export parameter of table type T1 ).

LOG ( T3 ). (First want to check if I am retrieving all the records.)

But this log stmt just gives the last record in table. How can i display all the records in log just to make sure that I have all the records in T3 based on my query. Also I get an error message when i use below stmt.

GETLEN ( T3 , X ) ( Error Message - Only unstructured and table-like parameters allowed)

I am using the GETLEN to retrieve number of records to perfom number of iterations.

Please help.

Regards,

GS

0 Kudos

Hello Colleague,

The steps followed by you are perfectly fine, just cross check in the table by logging into SE16 transaction , enter the table name and the same condition in the selection screen and see if all the records are displayed manually.

Also check the data type of the selection entry (where clause) in your example C1.

Check for the leading zeroes in C1, sometime this creates a problem.

Also log all the fields used in the select statement before the select statment and after it , just to cross the values.

Hope you should be able to figure out by then.

Thanks & Best regards,

Ajay