Add MATNR to 0FI_GL_4
Hi Experts,
We are trying to modify the 0FI_GL_4 extractor to pull in Material Number information.
We understand that in this case MATNR field should be appended through CI_BSIS after reading some of the posts.
We tried following approach,
1. Create CI_BSIS
2. Add 'MATNR' same as BSEG-MATNR
3. Activate CI_BSIS
4. Activate DTFIGL_4
5. Activate Datasource through RSA6
However when we execute RSA3, MATNR is not populated.(we have checked BSEG and there are values against MATNR)
Request your guidance for any missing steps in this case.
Thanks,
Gaurav
1. The name for the fields in CI_BSIK needs to be exactly the same as in BSEG, i.e MATNR needs to be named MATNR not ZZMATNR as normal practice would require, because in the extractor evalutes field names for selection.
2. You need to un-check the flags for 'Hidden' AND the flag for 'Known in own exit' in for the new MATNR field in the datasource 0FI_GL_4 (RSA6).
That should do it
Regards,
Ola
Similar Messages
-
Add matnr in fgi02 as an characteristic
hi is there any way to add matnr in the characteristics field of report painter fgi2
Hi
As far as I know, these reports are based on FAGL tables, which dont update MATNR in themselves
You can raise an OSS message to SAP and check if they can provide this solution
br, Ajay M -
Line layout option for G/L account
Dear All,
When we clear G/L account using tcode F-03, we get line layout as
Assignment, document no, document type, Posting key, posting date, amount.
I want to add material number column to this line layout.
1. I tried using IMG -> Fi-> AR/AP -> Vendor accounts->Line items-> Open item processing -> define line layout
Here we cannot add material in line layout, because fields are extracted from structure RFOPS.
MATNR(material number) field is exist in table BSEG, not in structure RFOPS. So we cannot add MATNR field in Line Layout here.
2. In this path, IMG -> FI -> G/L accounting -> Buisnes stransactions->open item clearing -> Make settings for processing open items -> Here we do not have option to change line layout for clearing of G/L account. Here we can change it for diaply and change documents.
Could any one help me in this case?
Thanks in Advance!
Regards,
NidhiHi Nidhi,
1.Please refer to note: 647773 and note:693288 if you want to make another field available in open line items seletion screen. these are modification notes.
2.as far as I confirmed in sap testing systems( release 470 and 600), there is create and change button existed, so if you don't have change and create button available in T-cd:O7Z1, I guess that you don't have the change or create authorization.
Addition if you want to maintain default value in T-cd:07V1, please double click the layout,then you can define it.
WIth Best Regards,
Gladys xing -
Selection screen for logical database PNP..
hi all,
I am having a requirement to produce a HR Report where i need to use logical database PNP. Now the issue is i need to supress some of the elements of standard selection screen of PNP and add a couple of fields of mine.
i have been looking all around and i got few of the below methods.
its good to use a report category.
somewhere it says include it in ur program using selection screen block..
can you please guide me which is the best way and what would be a perfect solution?
thanks in advance,
ReenaHi reeena,
1. simple
2. u want to
a) add ur own fields
b) suppress some fields
3. a) is simple, just add your parameters,
in your program, and they will appear
b) use SCREEN logic
4. just copy paste to get a taste of it
(it will HIDE the PAYROLL AREA field)
and add MATNR field
5.
report abc.
TABLES : PERNR.
PARAMETERS : MATNR LIKE MARA-MATNR.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'ABKRS'.
SCREEN-INVISIBLE = '1'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
regards,
amit m. -
Enhancing the FAGLFLEXA(General Ledger: Actual Line Items) table
Hi All,
I am trying to add Material Number (MATNR) to the table FAGLFLEXA(General Ledger: Actual Line Items)
For this i have added Material number in the include CI_FAGLFLEX04 of the table FAGLFLEXA.
But still material numbers are not appeared in the table FAGLFLEXA.Material number exist in the structure COBL - Coding Block,i believe SAP standard programs has to pick up material number from coding block to FAGLFLEXA table.
Please advise me if anyone enhanced this table .
Regards
L AppanaHi Appana,
I also want to add MATNR to FAGLFLEXA. Can i know how did you go about creating new segment to flow MATNR in FAGLFLEXA?
Somar
Edited by: Somar on Mar 6, 2009 10:37 PM -
Gurus,
How to add and remove the fields from Layout key SAPSFCAS27.
I wants to add MATNR and to remove some fileds.
It is under Overall profile SAPSFCG014 >> Table SAPSFCL015 >> Layout ID >> SAPSFCLA24 >> Chart No 02 2nd chart (dispatched) >> Grouping SAPSFCGR02 >> Layout key SAPSFCAS27.
Thanks
SureshGurus,
Can any body please look in to this issue.
Thanks
Suresh -
Transfer material number to FICA document
Hi there,
I need to transfer the material number when the invoce is created to FICA document, Account Assignment.
The WBS Element is transferred correctly, but I haven't been able to transfer the Material Number so far.
What I've done is add MATNR to the tables:
- FKKOPK
- ACCIT
Thanks for your input and time.
Kind regards,
Andrés.Note 439192 solved this.
The next step is to move the Material Number from FI-CA documents to FI-GL during the "Transfer Posting Totals to G/L" (FPG1).
I achieve this by using the Event 940, but I don't know how to link the items from DFKKSUM to the corresponding FI-CA documents in order to retrieve the material Number from the second ones and assign it to the the corresponding posting.
Thanks.
Andrés. -
0FI_GL_4..How can I add G/L account to the selection
Hello,
I have a need to add aditional selection for G/L account to the 0FI_GL_4. By default it has FiscalYear/Period and Company Code.
I wrote a program to update the the table ROOSFIELD so that the selection field for this dataSourece are enabled for G/L account and Controlling area.
The data source now looks good in RSA3. I can see G/L account and Controlling area as selection. However these 2 new selections are not recognized. I mean the retured records are not restricted with either of these 2 new selections.
Any help will be deeply appreciated.
Thanks.Hi Arvind
Definately you can do it but you should have access to change the value in ABAP code..
1. Open table ROOSFIELD and view its content for ur data source
2. go to debug mode by putting /h in Tcode execution bar
3. select the record and execute, it will take u to ABAP code
4. While debugging u will see CODE = SHOW ( Only display)
Change it to EDIT and then Press F7
5. You will be in change mode to edit the record
6. Set the value of selection flag for particular field which u want
7. Save and exit, field will be available for selection..
Thanks
Tripple k -
Add leading zero to matnr in a conversion program
Hi All,
When uploading matnr from a text legacy file , should i add leading zeroes to the sku value. For ex the data from the lagacy is 1000123456 (10 digits length). The values are always numbers. The matnr in SAP is 18 chars. Should my program transform it into 000000001000123456 before saving it into mara-matnr?
Regards, OliAre you sure that in configuration, the Indicator for lexicographical material numbers is unchecked? If it checked, then SAP will not then the all numeric material numbers will not get leading zeros by default. =====>
Indicator for lexicographical material numbers
Defines the way numeric material numbers are stored in the database.
Use
Caution
It is only possible to set or reset (cancel) this indicator if no numeric material numbers have been used yet in the system since they would no longer be interpretable after setting or resetting this indicator.
If this indicator is not set, numeric material numbers are padded with leading zeros and stored right-justified -
How to add prefix zero to all matnr fields in itab
Hi,
I ve a internal table with following fields
Matnr bwkey
6 678
67 rty
678 78k
How to add prefix zero to all tha matnr fields.
like
matnr bwkey
00000000000000006 678
00000000000000067 rty
00000000000000678 78k
Thanks in advanceHi,
commonly used conversion routine is ALPHA.
It is conversion used to insert leading zero for document number.
For example, in sales order (VBAK-VBELN length 10),
when we key in order no, for example we key in '4302',
conversion routine input will automatically add leading zero,
so it will become '0000004302', this is real value stored in table VBAK.
On conversion routine output, it will delete leading zero
function CONVERSION_EXIT_ALPHA_INPUT, this will add leading zeros to a character based field of any length.
Ex:
data: lv_c(10) type c value '123'.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = lv_c
importing
output = lv_c.
write:/ lv_c.
Regards. -
How to add new cols to ALV ?
Hi,
in a report , we have a some fields in the table it_data and avaiable fielcat table.
But while running , we need to add some new colunms to the it_table ( data to be displayed ) , So how can we do this ?
For example :
I have the field : matnr & maktx
But then Before displaying i will get all the characteristics of this materail and with each characteristics i will add a new column.
So would you please tell me the way of doing this
ThanksAdd the same fields to field catalog and add them to final internal table if you know the fields and have the same in your final internal table or You have to create dynamic internal table with the output internal table.
Search forums for dynamic internal table.
Edited by: abap technical on Jan 28, 2008 9:38 AM -
How can I add a new field in selection screen for this report
*& Report ZGS_BARKODLA_HIZLI_GIRIS
report zgs_barkodla_hizli_giris.
tables: mara,
mseg,
mch1,
*mch1,
mkpf,
mchb ,
makt.
type-pools: esp1.
data: i_message_tab type esp1_message_tab_type,
wa_message_tab type esp1_message_wa_type ,
sc_count type i.
ALV
type-pools: slis, kkblo.
data: gs_layout type slis_layout_alv ,
gt_fldcat type slis_t_fieldcat_alv with header line,
gt_header type slis_t_listheader with header line,
gt_sortin type slis_t_sortinfo_alv with header line,
g_repid like sy-repid .
define add-fieldcat.
gt_fldcat-fieldname = &1.
gt_fldcat-ref_tabname = &2.
gt_fldcat-seltext_s = &3.
gt_fldcat-seltext_m = &3.
gt_fldcat-seltext_l = &3.
gt_fldcat-reptext_ddic = &3.
gt_fldcat-ddictxt = 'M'.
append gt_fldcat.
clear gt_fldcat.
end-of-definition.
types: begin of titab,
sel type xfeld,
matnr type matnr,
maktx type maktx,
charg type charg_d,
menge type menge_d,
erfmg type erfmg,
end of titab.
data : witab type titab.
data : itab type table of titab.
data : ok_code type sy-ucomm.
controls: tc_itab type tableview using screen 0100.
data: gv_header like bapi2017_gm_head_01,
gv_code like bapi2017_gm_code.
BAPI export parameters
data: gv_headret type bapi2017_gm_head_ret,
gv_matdoc type bapi2017_gm_head_ret-mat_doc,
gv_matyear type bapi2017_gm_head_ret-doc_year.
data : lv_objek like inob-objek .
data : ls_inob like inob .
data : imseg type ty_t_mseg.
data : wmseg type mseg.
data : answer.
data : count type i.
data : v_atinn type atinn.
BAPI movement details
data: i_goodsmvt_items type bapi2017_gm_item_create occurs 0
with header line.
data: i_return type bapiret2 occurs 0 with header line.
start-of-selection.
call function 'CONVERSION_EXIT_ATINN_INPUT'
exporting
input = 'Z_ORAN'
importing
output = v_atinn.
call screen 100.
*& Module status_0100 OUTPUT
module status_0100 output.
set pf-status '100'.
set titlebar '100'.
mseg-werks = 1000.
mseg-umwrk = 1000.
**added
sc_count = sc_count + 1.
if sc_count eq 1.
mseg-bwart = 313.
endif.
mkpf-budat = sy-datum.
**added
describe table itab lines tc_itab-lines.
endmodule. " status_0100 OUTPUT
*& Module user_command_0100 INPUT
module user_command_0100 input.
data field(20).
data: line_t like sy-index.
data: lines like sy-index.
data line_count like sy-loopc.
data: begin of cols,
screen like screen,
index type i,
selected(1) type c,
vislength like icon-oleng,
invisible(1) type c,
end of cols.
case ok_code.
when 'DELE'.
delete itab where sel eq 'X'.
when 'ENTE'.
check *mch1-charg is not initial.
read table itab into witab with key charg = *mch1-charg.
if not sy-subrc is initial.
witab-charg = *mch1-charg.
select single matnr from mch1 into witab-matnr
where charg eq witab-charg.
if not syst-subrc is initial.
set cursor field '*MCH1-CHARG'.
message e115(12) with *mch1-charg.
endif.
select single maktx from makt into witab-maktx
where matnr eq witab-matnr
and spras eq syst-langu.
witab-erfmg = 1.
concatenate witab-matnr witab-charg into lv_objek .
clear ls_inob .
select single * into ls_inob
from inob
where objek = lv_objek and
klart = '023' and
obtab = 'MCH1' .
select single atflv from ausp into witab-menge
where objek = ls_inob-cuobj and
klart = '023' .
append witab to itab.
**added
clear *mch1-charg.
**added
endif.
when 'SAVE'.
if mkpf-budat is initial.
set cursor field 'MKPF-BUDAT'.
message e055(00).
endif.
if mseg-lgort is initial.
set cursor field 'MSEG-LGORT'.
message e055(00).
endif.
if mseg-umlgo is initial.
set cursor field 'MSEG-UMLGO'.
message e055(00).
endif.
if mseg-bwart is initial.
set cursor field 'MSEG-BWART'.
message e055(00).
endif.
refresh imseg.
loop at itab into witab.
move-corresponding witab to wmseg.
append wmseg to imseg.
endloop.
call function 'ZMM_POPUP_WITH_DATA'
exporting
imseg = imseg
importing
answer = answer.
if answer eq 'Y'.
perform create_goods_movement.
endif.
when 'P--'.
clear ok_code.
perform paging using 'P--'.
set cursor field 'MARA-MATNR' line 1.
when 'P-'.
clear ok_code.
perform paging using 'P-'.
set cursor field 'MARA-MATNR' line 1.
when 'P+'.
clear ok_code.
clear lines.
perform paging using 'P+'.
set cursor field 'MARA-MATNR' line 1.
when 'P++'.
clear ok_code.
perform paging using 'P++'.
set cursor field 'MARA-MATNR' line 1.
when 'SORA'.
read table tc_itab-cols into cols with key selected = 'X'.
if sy-subrc is initial.
field = cols-screen.
field = field+5(10).
sort itab ascending by (field).
endif.
when 'SORZ'.
read table tc_itab-cols into cols with key selected = 'X'.
if sy-subrc is initial.
field = cols-screen.
field = field+5(10).
sort itab descending by (field).
endif.
when 'PRNT'.
perform write_alv.
endcase.
endmodule. " user_command_0100 INPUT
*& Module read_table OUTPUT
module read_table output.
mara-matnr = witab-matnr.
makt-maktx = witab-maktx.
mch1-charg = witab-charg.
mseg-menge = witab-menge.
mseg-erfmg = witab-erfmg.
line_count = sy-loopc.
endmodule. " read_table OUTPUT
*& Module write_table INPUT
module write_table input.
witab-matnr = mara-matnr.
witab-maktx = makt-maktx.
witab-charg = mch1-charg.
witab-menge = mseg-menge.
witab-erfmg = mseg-erfmg.
modify itab from witab index tc_itab-current_line.
endmodule. " write_table INPUT
*& Module exit INPUT
module exit input.
leave to screen 0 .
endmodule. " exit INPUT
*& Form create_goods_movement
form create_goods_movement .
clear : gv_header, i_return[], i_goodsmvt_items[].
gv_header-doc_date = gv_header-pstng_date = mkpf-budat.
gv_header-pr_uname = sy-uname.
GM with reference to reservation
loop at itab into witab.
i_goodsmvt_items-material = witab-matnr.
i_goodsmvt_items-entry_qnt = witab-erfmg.
i_goodsmvt_items-entry_uom = 'ST'.
i_goodsmvt_items-move_type = mseg-bwart.
i_goodsmvt_items-plant = mseg-werks.
i_goodsmvt_items-stge_loc = mseg-lgort.
i_goodsmvt_items-move_plant = mseg-umwrk.
i_goodsmvt_items-move_stloc = mseg-umlgo.
i_goodsmvt_items-batch = witab-charg.
append i_goodsmvt_items.
endloop.
find BAPI processing transaction
if gv_code is initial.
perform determine_bapi_code using mseg-bwart
changing gv_code.
endif.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gv_header
goodsmvt_code = gv_code
importing
goodsmvt_headret = gv_headret
materialdocument = gv_matdoc
matdocumentyear = gv_matyear
tables
goodsmvt_item = i_goodsmvt_items
return = i_return[].
cancel blocking process
loop at i_return where type eq 'E' or type eq 'A' or type eq 'X'.
exit.
endloop.
if sy-subrc ne 0.
refresh i_message_tab.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
wa_message_tab-msgid = 'M7'..
wa_message_tab-msgty = 'S'.
wa_message_tab-msgno = '060'.
wa_message_tab-msgv1 = gv_matdoc.
wa_message_tab-msgv2 = ''.
wa_message_tab-msgv3 = ''.
wa_message_tab-msgv4 = ''.
append wa_message_tab to i_message_tab.
else.
refresh i_message_tab.
call function 'BAPI_TRANSACTION_ROLLBACK'.
write a message as there is an unexpected error.
loop at i_return.
wa_message_tab-msgid = i_return-id.
wa_message_tab-msgty = i_return-type.
wa_message_tab-msgno = i_return-number.
wa_message_tab-msgv1 = i_return-message_v1.
wa_message_tab-msgv2 = i_return-message_v2.
wa_message_tab-msgv3 = i_return-message_v3.
wa_message_tab-msgv4 = i_return-message_v4.
append wa_message_tab to i_message_tab.
endloop.
endif.
call function 'C14Z_MESSAGES_SHOW_AS_POPUP'
tables
i_message_tab = i_message_tab.
endform. " create_goods_movement
*& Form determine_bapi_code
form determine_bapi_code using p_bwart type bwart
changing p_code type bapi2017_gm_code.
data: lt_t158b type table of t158b with header line.
clear p_code.
select tcode from t158b into corresponding fields of table lt_t158b
where bwart eq p_bwart.
loop at lt_t158b.
select single gmcode from t158g into p_code
where tcode eq lt_t158b-tcode.
if sy-subrc is initial.
exit.
endif.
endloop.
endform. " determine_bapi_code
*& Form paging
form paging using code.
data: i type i,
j type i.
case code.
when 'P--'. tc_itab-top_line = 1.
when 'P-'.
tc_itab-top_line = tc_itab-top_line - line_count.
if tc_itab-top_line le 0.
tc_itab-top_line = 1.
endif.
when 'P+'.
i = tc_itab-top_line + line_count.
j = tc_itab-lines - line_count + 1.
if j le 0.
j = 1.
endif.
if i le j.
tc_itab-top_line = i.
else.
tc_itab-top_line = j.
endif.
when 'P++'.
tc_itab-top_line = tc_itab-lines - line_count + 1.
if tc_itab-top_line le 0.
tc_itab-top_line = 1.
endif.
endcase.
endform. " paging
*& Form write_alv
form write_alv .
perform find_list_header.
perform fill_field_cat.
perform fill_sortinfo.
g_repid = sy-repid.
gs_layout-colwidth_optimize = 'X'.
gs_layout-zebra = 'X'.
answer = 'Y'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_buffer_active = ''
i_callback_program = g_repid
i_save = 'A'
i_callback_top_of_page = 'TOP_OF_PAGE'
is_layout = gs_layout
it_fieldcat = gt_fldcat[]
it_sort = gt_sortin[]
tables
t_outtab = itab[].
endform. " write_alv
Form find_list_header
form find_list_header.
data : v_datum(10),
v_datlo(10),
v_dathi(10),
v_uzeit(8).
clear: gt_header, gt_header[].
gt_header-typ = 'H'.
gt_header-info = sy-title.
append gt_header.
clear gt_header.
gt_header-typ = 'S'.
gt_header-key = 'Çalıştırma Zamanı : '.
write syst-datum to v_datum.
write syst-uzeit to v_uzeit.
concatenate v_datum '/' v_uzeit into gt_header-info.
append gt_header.
endform. " find_list_header
Form fill_field_cat
form fill_field_cat.
refresh gt_fldcat.
clear gt_fldcat.
gt_fldcat-key = 'X'.
add-fieldcat 'MATNR' 'MARA' ''.
add-fieldcat 'MAKTX' 'MAKT' ''.
add-fieldcat 'CHARG' 'MSEG' ''.
gt_fldcat-do_sum = 'X'.
add-fieldcat 'MEINS' 'MARA' 'Olcu Birimi '.
gt_fldcat-do_sum = 'X'.
add-fieldcat 'ERFMG' 'MSEG' 'Adet'.
endform. " fill_field_cat
Form fill_sortinfo
form fill_sortinfo.
gt_sortin-up = 'X'.
gt_sortin-fieldname = 'MATNR'. append gt_sortin.
endform. " fill_sortinfo
Form top_of_page *
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ZKUTAS'
it_list_commentary = gt_header[].
endform. " top_of_pageHI,
if it is a normal report program then you can directly create a Selection screen field.
After the Type-pool you can use Parameters or Select-options to create the selection screen field..
If it is a Modulpool program then you can create a selection scren field like
SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN.
PARAMETERS: p1(10) TYPE c.
SELECTION-SCREEN END OF SCREEN 1100.
defines a selection screens 1100 as subscreens.
The next screen number of screen 100 is 100 (statically-defined).
PROCESS BEFORE OUTPUT.
MODULE status_0100.
CALL SUBSCREEN area INCLUDING sy-repid number.
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
CALL SUBSCREEN area.
MODULE user_command_0100.
look at the below link
http://help.sap.com/saphelp_nw2004s/helpdata/en/e7/deb237b9a9a968e10000009b38f8cf/content.htm
Regards
Sudheer -
How to Add Checkbox and icon in ALVGRID
Hi Experts,
i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
Thanks,
Venkat.Hi
For check box
At declaring field catalog using structure LVC_S_FCAT
mark CHECKBOX = 'X' and also EDIT = 'X'.
For reference check below subroutine in program BCALV_EDIT_05.
form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
data ls_fcat type lvc_s_fcat.
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'SFLIGHT'
changing
ct_fieldcat = pt_fieldcat.
*§A2.Add an entry for the checkbox in the fieldcatalog
clear ls_fcat.
ls_fcat-fieldname = 'CHECKBOX'.
* Essential: declare field as checkbox and
* mark it as editable field:
ls_fcat-checkbox = 'X'.
ls_fcat-edit = 'X'.
* do not forget to provide texts for this extra field
ls_fcat-coltext = text-f01.
ls_fcat-tooltip = text-f02.
ls_fcat-seltext = text-f03.
* optional: set column width
ls_fcat-outputlen = 10.
append ls_fcat to pt_fieldcat.
endform.
For Icon:
CONSTANTS:
icon_id_failure LIKE icon-id VALUE ' ((Content component not found.)) @',
icon_id_okay LIKE icon-id VALUE ' ((Content component not found.)) @'.
TYPES: BEGIN OF ls_tab,
matnr LIKE equi-matnr,
maktx LIKE makt-maktx,
b_werk LIKE equi-werk,
b_lager LIKE equi-lager,
lgobe LIKE t001l-lgobe,
sernr LIKE equi-sernr,
icon LIKE icon-id,
objnr LIKE equi-objnr,
END OF ls_tab.
*Table that display the data for the ALV.
DATA: itab TYPE ls_tab OCCURS 0 WITH HEADER LINE.
PERFORM get_h_date .
IF h_date => sy-datum .
itab-icon = icon_id_okay.
ELSE .
itab-icon = icon_id_failure.
ENDIF.
Regards
Sudheer -
Merging two records in a single record for the same matnr,werks and bwart.
Hi I have a requirement to merge two records into one single record using the quantity field from MSEG table.
I am selecting two records from the table MSEG. Now for these two records i have to add the quantity values into one variable.
Then there should be only one record for the same matnr,werks,bwart.
Any suggestion would be appreciated.
Regards,
Amithi,
You can COLLECT statement only if all non key fields are numeric.
This statement Adds all such fields and give us a single record.
Regards
Sumit Agarwal -
How to add coloum name in a exel sheet download file?
Dear all,
I amdownloading a excel sheet from a internal table.I am getting all data correctly.
but now i want to add coloumn name for each coloumn.
How can I do it?
i had try from work area and insert at first index but not get proper result.....
so if possible plz suggest sampl code also.
Regards
RickyHi Ricky Maheswari,
I will send a sample code for u.check it once.I execute the below code that is executed successfully.
In my report u have check these things carefully "PEFORM APPEND_HEADER " and SELECT STATEMENT(I use appending table stmt there).Then ur problem will be resolved.
code:
*& Report YBDC_DOWNLOAD_MM01_XLS *
*& DEVELOPER : KIRAN KUMAR.G *
*& PURPOSE : FETCH DATA FROM DB AND PLACE THEM IN .XLS FILE *
*& CREATION DT : 2/12/2007 *
*& REQUEST : ERPK900035 *
*& NOTE : MENTION PATH & MENTION FILE.XLS IN THE SELE-SCREEN *
REPORT ybdc_download_mm01_xls MESSAGE-ID zbdcmsg.
Tables
TABLES: mara, "General Material Data
makt. "Material Descriptions
Global Variables
DATA: gv_path TYPE string. "Hold Path Selection Information
Internal Table
DATA : BEGIN OF gt_data OCCURS 0,
matnr(20), " Material Number
mbrsh(20), " Industry Sector
mtart(20), " Material Type
meins(20), " Base Unit Of Measure
maktx(20), " Material Description
END OF gt_data.
Selection-Screen
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file(90).
SELECTION-SCREEN : END OF BLOCK b1.
SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS : s_matnr FOR mara-matnr,
s_mbrsh FOR mara-mbrsh,
s_mtart FOR mara-mtart,
s_maktx FOR makt-maktx,
s_meins FOR mara-meins.
SELECTION-SCREEN : END OF BLOCK b2.
Initialization
INITIALIZATION.
PERFORM initial.
Placing A File In The Directory
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM path_directory.
START-OF-SELECTION.
Append Some Header Information To XLS File
PERFORM append_header.
Fetching The Data
PERFORM fecth_data.
END-OF-SELECTION.
GUI_DOWNLOAD
PERFORM gui_download.
*& Form path_directory
text
--> p1 text
<-- p2 text
FORM path_directory .
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Download A File'
initial_folder = 'c:/'
CHANGING
selected_folder = gv_path
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
p_file = gv_path.
CLEAR gv_path.
ENDFORM. " path_directory
*& Form fecth_data
text
--> p1 text
<-- p2 text
FORM fecth_data .
SELECT a~matnr
a~mbrsh
a~mtart
a~meins
b~maktx
FROM mara AS a
INNER JOIN makt AS b ON amatnr = bmatnr
APPENDING TABLE gt_data
WHERE a~matnr IN s_matnr
AND a~mbrsh IN s_mbrsh
AND a~mtart IN s_mtart
AND b~maktx IN s_maktx
AND a~meins IN s_meins.
IF sy-subrc = 0.
MESSAGE s000.
ENDIF.
ENDFORM. " fecth_data
*& Form gui_download
text
--> p1 text
<-- p2 text
FORM gui_download .
gv_path = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = gv_path
filetype = 'ASC'
APPEND = ' '
write_field_separator = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = gt_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " gui_download
*& Form append_header
text
--> p1 text
<-- p2 text
FORM append_header .
REFRESH : gt_data.
CLEAR : gt_data.
gt_data-matnr = 'MATERIAL NUMBER'.
gt_data-mbrsh = 'INDUSTRY SECTOR'.
gt_data-mtart = 'MATERIAL TYPE'.
gt_data-maktx = 'MATERIAL DESCRIPTION'.
gt_data-meins = 'BASE UNIT OF MEASURE'.
APPEND gt_data.
CLEAR gt_data.
ENDFORM. " append_header
*& Form initial
text
--> p1 text
<-- p2 text
FORM initial .
s_matnr-sign = 'I'.
s_matnr-option = 'BT'.
s_matnr-low = '800'.
s_matnr-high = '100-200'.
APPEND s_matnr.
s_mbrsh-sign = 'I'.
s_mbrsh-option = 'BT'.
s_mbrsh-low = 'M'.
s_mbrsh-high = ''.
APPEND s_mbrsh.
s_mtart-sign = 'I'.
s_mtart-option = 'BT'.
s_mtart-low = 'FERT'.
s_mtart-high = 'HALB'.
APPEND s_mtart.
s_maktx-sign = 'I'.
s_maktx-option = 'BT'.
s_maktx-low = 'IRON'.
s_maktx-high = 'STEEL'.
APPEND s_maktx.
s_meins-sign = 'I'.
s_meins-option = 'BT'.
s_meins-low = 'CM'.
s_meins-high = 'KG'.
APPEND s_meins.
ENDFORM. " initial
Award points if helpful.
Kiran Kumar.G
Have a Nice Day..
Maybe you are looking for
-
Manually Manage Music and Videos - Changes on it's own
Why does this happen? I've set this continually over the past year and every once in a while, it comes back as unchecked. I have some WMA files in my library and once this is checked, iTunes starts moving stuff around. I love the iPod but iTunes has
-
How to apply context change explicitly?
-
HT4061 My IPAD has frozen and won't respond to any commands
My Ipad has frozen on me and I can't get it to respond.
-
I downlouded the extra material there it was buttoms but not the firefox uploading buttom I did not find. I have a mac.
-
HT1338 i can't update my Mac OS X v10.5.8
i just got the iphone5 and cant put my music into it as my operating sytem wont update. ive tried to update it via the software update and through itunes but no dice, help please