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

Dynamic Internal table

Former Member
0 Likes
985

Hi Everyone,

My requirement is i have two Ztables, in this first ztable describes the Bank details i.e Bank name, Bank Account Number , Bank Key etc.

Coming two second Ztable having the Bank user names. in both the tables we have Common field is Bank Account Number, Bank Name, Bank key.

For one Bank we have multiple Users with the the Same   Bank Account Number, Bank Name, Bank key. this value is not constant, Every it will change means User's will be added or Deleted etc. That will changing the Dynamically, based on Bank Account Number, Bank Name, Bank key , how many users we have in the Second Ztable we want display in a Single Row that is User Name columns .If we have Same user in Multiple Bank's then It should Display in Same Column.Please find the Attachement for  Output Template.

BANK noBANK keyBank NameBank Account noUser1user2user3user4
1100ICICI1234567890abc
2101HDFC9877654321aefg

Please Advice....

Regards,

Jyothi

6 REPLIES 6
Read only

Former Member
0 Likes
933

Hi Jyothi,

You can make use of the method CREATE_DYNAMIC_TABLE of the class CL_ALV_TABLE_CREATE.

Check the below link for example :

http://wiki.sdn.sap.com/wiki/display/ABAP/Dynamic+Internal+table

Regards,

Rajesh

Read only

Former Member
0 Likes
933

Hi Jyothi,

This below link might help you .

http://saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm

Regards,

Santanu

Read only

Former Member
0 Likes
933

hi Jyoth...
If my understanding is correct you want values from the both Ztables?

If it is, then it would be very easy if you use JOIN statement.

Please clarify if necessary.

Thanks

Askar

Read only

0 Likes
933

Hi,

Thanks for your reply,

We don't know How many user's  we have for a Single Bank ,this value is not constant, based on Bank wise it is same or Different.first i need to know the how many user's we have for a single bank , that all user's must display in a Single Row, for this Inner Join is not Correct , this requirement will be based on Dynamic Internal table, is it possible With out OOPS-ABAP.

Regards,

Jyothi

Read only

former_member193464
Contributor
0 Likes
933

HI,
The easiest way is to define a dynamic table with columns the most no. of user of a bank ( if 5 then 5 columns for users(this can be achieved dynamically)) then just insert your entries into the table ....(for dynamic internal table creation links are already given up by many people , you can go with that or serach in SCN there are many good links).


OR

If you want to display it as a list (with WRITE statement), you can first write header depending on the max no of user for a bank,
for eg. say
hdfc- 3 users

ICICI - 4 users

RBS - 8 users.
then WRITE till user 8 as header
then simply for each bank WRITE their users ...also write blank users if there are no users (just to have that offset and display in the correct format.
you can sy-uline , sy-vline to make it look good.

Hope this helps.

Message was edited by: Maverick Manoj

Read only

souvik_saha
Explorer
0 Likes
933

Hi Jyothi,

Please try to implement the follwoing steps and check if your requirement is fulfilled:


1. Loop at Bank Details table with unique Bank no/BANK key /Bank Name/Bank Account no. Inside this loop find the number of users using a nested loop on Bank Users Table(using Parallel Cursor) and check for the number of users for each unique Bank no/BANK key /Bank Name/Bank Account no.
Store the maximum number in a variable say v_max_user.
2. Create a dynamic internal table with 4+ v_max_user fields which will be used to store  Bank no/BANK key /Bank Name/Bank Account no and User1/User2/.../User(v_max_user).

3. Populate the dynamic internal table using a similar nested loop as in step 1.

Regards,
Souvik