‎2013 May 06 1:13 PM
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 no | BANK key | Bank Name | Bank Account no | User1 | user2 | user3 | user4 |
| 1 | 100 | ICICI | 1234567890 | a | b | c | |
| 2 | 101 | HDFC | 9877654321 | a | e | f | g |
Please Advice....
Regards,
Jyothi
‎2013 May 06 3:51 PM
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
‎2013 May 06 4:50 PM
Hi Jyothi,
This below link might help you .
http://saptechnical.com/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
Regards,
Santanu
‎2013 May 06 5:09 PM
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
‎2013 May 07 6:18 AM
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
‎2013 May 07 6:39 AM
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
‎2013 May 07 6:52 AM
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