05-11-2015 12:42 PM
Hi Experts,
I have a strange Requirement.
i am doing a module pool program in which i have 5 input feilds in which user will make entries and saves to database.
So i have a created a z table and put those 5 feilds on screen in a vertical order.
Now when the user clicks on save button the entries are added to the database in a horizontal manner.
The user wants in a vertica manner as it normally shows in ALV.
IF i am not clear please let me know.
Thanks,
Amit
05-11-2015 1:15 PM
Hi Amit,
The user wants in a vertical manner as it normally shows in ALV.
Please elaborate.
I think you need ALV report in which all 5 field are aligned vertically instead of horizontally
am i correct?
you may need to transpose internal table.
regards,
Saurabh
05-11-2015 1:15 PM
Hi Amit,
The user wants in a vertical manner as it normally shows in ALV.
Please elaborate.
I think you need ALV report in which all 5 field are aligned vertically instead of horizontally
am i correct?
you may need to transpose internal table.
regards,
Saurabh
05-11-2015 1:24 PM
Hi Saurabh,
No I dont need a ALV.
i have created ztable with 13 feilds. out of which i have kept 5 feilds on screen for making entry.
now when the user presses save the feilds are getting saved in horizontal manner in database table.
i want those 5 feilds in vertica manner.
05-11-2015 1:59 PM
Looks like you want to add each field in new row (vertical manner).
i.e. insert only 1 field in 1 row (other 12 fields blank !?)
and insert 5 rows like this.
do steps 2 & 3 for five times.
hope this solves your issue.
Regards,
saurabh
05-13-2015 6:52 AM
Hi Saurabh,
I want to add entries in database table like below :
Invoice Type Document No. Bill Doc Echnage Rate
SEA 1234 9000001 10
9000002 10
9000003 10
9000004 10
9000004 10
so i have done the cding for first 2 feilds like this :
WA_INVTYPE-INVOICE_TYPE = ZTYPE_INVOICES-INVOICE_TYPE.
WA_INVTYPE-BELNR = ZTYPE_INVOICES-BELNR.
APPEND WA_INVTYPE TO IT_INVTYPE
MODIFY ZTYPE_INVOICES FROM TABLE IT_INVTYPE
and for remaining feilds as per ur instruction :
WA_INVTYPE1-CUSTOMINVOICE = ZTYPE_INVOICES-CUSTOMINVOICE.
APPEND WA_INVTYPE1 TO IT_INVTYPE1.
CLEAR WA_INVTYPE1.
WA_INVTYPE1-CUSTOMINVOICE1 = ZTYPE_INVOICES-CUSTOMINVOICE1.
APPEND WA_INVTYPE1 TO IT_INVTYPE1.
CLEAR WA_INVTYPE1.
WA_INVTYPE1-CUSTOMINVOICE2 = ZTYPE_INVOICES-CUSTOMINVOICE2.
APPEND WA_INVTYPE1 TO IT_INVTYPE1.
CLEAR WA_INVTYPE1.
WA_INVTYPE1-CUSTOMINVOICE3 = ZTYPE_INVOICES-CUSTOMINVOICE3.
APPEND WA_INVTYPE1 TO IT_INVTYPE1.
CLEAR WA_INVTYPE1.
WA_INVTYPE1-CUSTOMINVOICE4 = ZTYPE_INVOICES-CUSTOMINVOICE4.
APPEND WA_INVTYPE1 TO IT_INVTYPE1.
CLEAR WA_INVTYPE1.
MODIFY ZTYPE_INVOICES FROM TABLE IT_INVTYPE1.
but disried output is not coming.
i have attached the screenshot for you.
Thanks,
Amit
05-13-2015 7:15 AM
Dear amit,
Are you sure that you want invoice type field i.e. SEA only once for 5 rows added?
Invoice no | Doc no | Bill Doc | Exchange Rate |
SEA | 1234 | 9000001 | 10 |
9000002 | |||
9000003 | |||
9000004 | |||
9000005 |
so you are appending data from screen to WA_INVTYPE for 1st row
and appending data for other 4 rows in WA_INVTYPE1.
if you are able to use debugger please apply breakpoint to
MODIFY ZTYPE_INVOICES FROM TABLE IT_INVTYPE1.
and send your screenshot.
regards ,
saurabh
05-13-2015 7:26 AM
Hi Saurabh,
Yes i want invoice type and Doc no. only once as it will be same for all the 5 fields.
all the feilds are there in database but user want to only Bill Doc no .filds in vertical manner in database.
Attached screenshot of debugger
05-13-2015 7:30 AM
Hi amit,
it must be like.
WA_INVTYPE-INVOICE_TYPE = ZTYPE_INVOICES-INVOICE_TYPE. (sea)
WA_INVTYPE-BELNR = ZTYPE_INVOICES-BELNR. (1234)
WA_INVTYPE-CUSTOMINVOICE = screen field 1. (90001)
WA_INVTYPE-exchange_rate = ZTYPE_INVOICES-exchange_rate (10)
APPEND WA_INVTYPE TO IT_INVTYPE
CLEAR WA_INVTYPE.
WA_INVTYPE-CUSTOMINVOICE = screen field 2.
APPEND WA_INVTYPE TO IT_INVTYPE.
CLEAR WA_INVTYPE.
WA_INVTYPE-CUSTOMINVOICE = screen field 3.
APPEND WA_INVTYPE TO IT_INVTYPE.
CLEAR WA_INVTYPE.
WA_INVTYPE-CUSTOMINVOICE = screen field 4.
APPEND WA_INVTYPE TO IT_INVTYPE.
CLEAR WA_INVTYPE.
WA_INVTYPE-CUSTOMINVOICE = screen field 5.
APPEND WA_INVTYPE TO IT_INVTYPE.
CLEAR WA_INVTYPE.
MODIFY ZTYPE_INVOICES FROMTABLE IT_INVTYPE.
summery:
append 1 full filled row ti itab
clear work area.
move only screen field 2 to work area.
append
move only screen field 3 to work area.
append
move only screen field 4 to work area.
append
move only screen field 5 to work area.
append
modify ztab from itab.
regards,
saurabh
05-13-2015 7:51 AM
Hi Saurabh,
I have got the output like attached in database table.
should i delete reaming 4 feilds from DB and capture all the 5 values in single feilds as it is showing now.
Thanks,
Amit Dwivedi
05-13-2015 9:39 AM
should i delete reaming 4 feilds from DB and capture all the 5 values in single feilds as it is showing now.
I cant understand that fully.
are you referring that you want to merge all the bill docs in single row allong with first 3 fields??
05-13-2015 9:46 AM
Hi Saurabh,
I want my output as below :
Invoice no | Doc no | Bill Doc | Exchange Rate |
SEA | 1234 | 9000001 | 10 |
9000002 | |||
9000003 | |||
9000004 | |||
9000005 |
as per ur solution, i have attached the output. all the bill docs are cominng in vertical order under same field i.e. ZTYPE_INVOICES-CUSTOMINVOICE. but remaining 4 feilds are empty in database
ZTYPE_INVOICES-CUSTOMINVOICE1.
ZTYPE_INVOICES-CUSTOMINVOICE2.
ZTYPE_INVOICES-CUSTOMINVOICE3.
ZTYPE_INVOICES-CUSTOMINVOICE4.
05-13-2015 9:52 AM
hi amit,
Can you please draw your Ideal table output in paint with minimum 2 entries
looks like bit of miscommunication is here.
regards,
saurabh
05-13-2015 10:09 AM
Hi Saurabh,
Invoice Type | Freight INv No | Customs Inv No | Custom Exch Rate |
Sea | 1234 | 43534534 | 10 |
34343545 | 11 | ||
43534534 | 12 | ||
43534534 | 14 | ||
54345345 | 12 | ||
Sea | 2345 | 67878878 | 10 |
78765464 | 11 | ||
44566537 | 12 | ||
54567648 | 14 | ||
45367577 | 12 |
Only point to note is i have 5 different fields for custom invoice in DB like below
custom invoice1
custom invoice2
custom invoice3
custom invoice4
custom invoice5
This is desired output of database table.
Thanks,
Amit Dwivedi
05-13-2015 10:30 AM
Hi,
what you need is all 5 inputs inserted in same column.
it is impossible that all entries in table will look in vertical fashion, if thats what you want then i am sorry.
you can concatenate all 5 fields into 1 and then append it.
concatenate scr_fld1 ' ' scr_fld2 ' ' scr_fld3 ' ' scr_fld4 ' ' scr_fld5 INTO screen_input.
and then
WA_INVTYPE-INVOICE_TYPE = ZTYPE_INVOICES-INVOICE_TYPE. (sea)
WA_INVTYPE-BELNR = ZTYPE_INVOICES-BELNR. (1234)
WA_INVTYPE-CUSTOMINVOICE = screen_input (90001)
WA_INVTYPE-exchange_rate = ZTYPE_INVOICES-exchange_rate (10)
APPEND WA_INVTYPE TO IT_INVTYPE
CLEAR WA_INVTYPE.
MODIFY ZTYPE_INVOICES FROMTABLE IT_INVTYPE.
Regards ,
saurabh
05-13-2015 7:26 AM
Amit,
User will never have access to database tables in Production.Why not develop a LIST report and get the data displayed in whatever the way the User wants.
Either yours or the User's understanding is wrong.
K.Kiran.
05-13-2015 7:28 AM
Hi Kiran,
yes, i know we have ALV report in which we can have desired output.
But, internally i want like to have output in table above.
just wanted to check whether it is possible or not.
Thanks,
Amit
05-13-2015 7:48 AM
Amit,
To me it doesn't make any sense and also it is not the way the data gets stored in the database table.
Programatically you can update the table in whatever the way you want but fetching the data back from the table or interpreting it will also remain a challenge.
K.Kiran