2007 May 08 4:35 PM
Dear All,
The requirement is to update any Ztable, the user inputs in the selection screen and the file corresponding to Ztable .
Basically, User will input any Z*table name and select the file present in desktop .
The file data has to be uploaded into Ztable entered in the selection screen.
Can someone suggest or tell how we can do this?
Regards
Dear All,
The requirement is to update any Ztable, the user inputs in the selection screen and the file corresponding to Ztable .
Basically, User will input any Z*table name and select the file present in desktop .
The file data has to be uploaded into Ztable entered in the selection screen.
Can someone suggest or tell how we can do this?
Regards
2007 May 08 4:46 PM
Record BDC for SM30 for particular Z table. Then upload the fle which you want and replace the field value with uploaded information. You need to define dynamic internal table with Z table structure.
Regards
Nilesh Shete
2007 May 08 5:54 PM
Hi
Write a simple program
Decalre 2 paramters on selection screen one for Ztable and other for file
use the GUI_DOWNLOAD to download the file to Internal table which is similar to the Entered z table.
Insert the data into the ZTABLE with the entries from Internal table. Update it.
Reward points if useful
Regards
Anji
2007 May 08 7:21 PM
No No, it's not for a particular Ztable.
Let's say first time user enters ZTABLE1 and file1, it has to update ZTABLE1.
Next time user enters ZTABLE2 and file2, it has to update ZTABLE2 and so on.
It has to be dynamic.
Regards
2007 May 08 8:48 PM
Then you need to create the Dynamic internal table. That internal table has to be created based on the table structure which you have entered in the selection screen. Then pass the data from presentation server to that internal table and then insert data into data base table based on that internal table.
For creating dynamic internal table find the help from below link.
/people/subramanian.venkateswaran2/blog/2004/11/19/dynamic-internal-table
Regards,
Raj
2007 May 08 9:14 PM
u have to select the fields of the table from dd03l. then create an internal table for that. see sample code.
DATA: wa_fldcat TYPE LVC_S_FCAT.
DATA: it_fldcat TYPE LVC_T_FCAT.
DATA: it TYPE REF TO DATA.
*parameters : p_week type kweek.
parameters : p_tabnm type TABNAME16.
FIELD-SYMBOLS: <fs_table> TYPE TABLE.
FIELD-SYMBOLS: <fs_temp> TYPE ANY.
data : t_dd03 like dd03l occurs 0 with header line.
select * from dd03l into corresponding fields of table t_dd03
where tabname = p_tabnm.
loop at t_dd03.
wa_fldcat-fieldname = t_dd03-fieldname.
wa_fldcat-tabname = 'IT'.
wa_fldcat-datatype = t_dd03-rollname.
append wa_fldcat to it_fldcat.
endloop.
*CREATE THE DYNAMIC INTERNAL TABLE
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat[]
IMPORTING
EP_TABLE = it.
ASSIGN it->* TO <fs_table>.
now u have an internal table ( field symbol) with structure of your table mentioned on selection screen. now play with this
2007 May 10 10:17 PM
Hi Sujamol,
Good Answer.
The dymamic internal table is created with the given Ztable in the selection screen.
Now the problem is when I try to upload this table <fs_table> using function module 'UPLOAD'.
The first column of flat file is getting updated in Mandt of <fs_table>.
I want to update Sy-mandt in MANDT of <fs_table> and the rest of the fields with flat file data.
e.g.
Flat file data:
100 white
101 black
<fs_table> structure is getting uploaded as below
mandt zcode zdesc
100 white
101 black
if the clint is 700
it has to be uploaded as
mandt zcode zdesc
700 100 white
700 101 black
Can you suggest me how to go about this or anyone who has any idea.
Regards
2007 May 10 10:31 PM
The blunt way of doing it is...
1. declare an internal table which has only one field which holds the entire record with tab delimiters.(itab)
data: begin of itab occurs 0,
record type string,
end of itab.
2. dynamic internal table(itab1)
3. upload ur file to itab
4. process itab splitting the record at the tab delimit and populate itab1.
5. now that you have your itab1 as that of ztable, update ztable.
Award points if it helps.
2007 May 10 10:50 PM
YOu caould do the way Vinni suggested, or if the MANDT field can be removed from the Z table. However it needs to be removed from all the Z tables since it can be used for any Z table.
However there could be some tables without the mandt field.
ALso noth that the method Vinni has suggested might give errors of the table dosent have the MANDT field.
I think sooo, so please check that sceniaro as well.
Shreekant
2007 May 11 12:21 AM
Hi Vinni,
Could you also explain on how can we transfer internal table contents itab to <fs_tab>. Like spliting and transfering to <fs_tab>.
Regards
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |