Problem while placing a button in the Output using ALV OOPs
Hi,
I am using ALV OOPs to display report output.
In the toolbar i have to palce an update button and if i click on that update it should then call the selection screen 500 .
So,please help me to achieve this using ALV OOPs.
THANKS & REGARDS,
Kiranmai.
Hi,
you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
Regards,
Siddarth
Similar Messages
-
Wan to add push button in the output of ALV Grid display.
Hi Friends,
I wan to add a Push button in the output of ALV GRID display with STANDARD ikons.
How to copy standard ikons of GRID output.
How to apply the copied status into my code.
Regards,
VijiHi,
Goto SE41, create a pf-status for your alv report program.
On the next screen, click menu EXTRAS --> click option ADJUST TEMPLATES and select radiobutton LIST VIEWER --> you will get all standard buttons of alv in the pf-status.
Delete the unwanted buttons and also you can add new buttons if reqd.
Activate pf-status --> and apply in alv program.
Now to apply this pf-status in your alv report follow code:-
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_rep_id " report id
i_callback_pf_status_set = 'PF' " for PF-STATUS
i_callback_user_command = 'USER_COMMAND' " for User-Command
is_layout = wa_layout " for layout
it_fieldcat = it_field " field catalog
it_sort = it_sort " sort info
TABLES
t_outtab = it_final " internal table
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*& Form pf
* SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
* ON WHICH THE ALV GRID IS DISPLAYED
* -->RT_EXTAB
FORM pf USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'ZTG_STAT'. "<--pass pf-status name here
ENDFORM. "pf
*& Form USER_COMMAND
* SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
* AND EXECUTE THE APPROPIATE CODE
* -->LV_OKCODE used to capture the function code
* of the user-defined push-buttons
* -->L_SELFIELD text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
CASE lv_okcode.
WHEN '<function_code>'. "<--to handle user actions
ENDCASE.
ENDFORM. "USER_COMMAND
Hope this helps you.
Regards,
Tarun -
ALV GRID - to include user defined buttons in the output
Hi,
Currently I am working on ALV grid output.
Along with the standard buttons, I need to include my own push buttons.
When I try to include it using pf-status like this,
passing parameter in alv
I_callback_pf_status_set = G_status
FORM STANDARD_02 USING EXTAB USING SLIS_T_EXTAB
set pf-status 'PF_STATUS' EXCLUDING EXTAB.
ENDFORM
I have included Confirm and exit buttons
In the output it shows only the button which I created .
I want to get both standard buttons which gets displayed when using REUSE_ALV_GRID_DISPLAY and the newly created one .
Plz help me to resolve this .
I am just passing my own internal table values to the grid .
Thanks in advance.
Regards,
Umahi
good
create ur own GUI status in ur program using SET PF-STATUS '--'. now give that program name and pf status name while u r copying that standard status ie.,of ALV grid Go to transaction SE41 (Menu painter). In the initial screen give the program name SAPLKKBL In the status give STANDARD Then go to the menu bar.in that follow this menu User Interface>Copy--->Status. Then a pop up will appear to give ur program name and the status name.
thanks
mrutyun^ -
How to get the record selected in ztable based record in the output of alv
Hi All,
I have developed a report, it is displaying the output in ALV format.The list contained some 20 fields along with MATERIAL and BATCH. I have provided menu bar as extras -> ztable(it also contained MATERIAL and BATCH). But I have some issue when I select any record in the output then go to
path extras -> ztable, it has to select the record in ztable based MATERIAL and BATCH which i have selected in the output, then can you please provide solution for the above problem.
Thanks in advanceHi Dolly,
you can do this by,
data: index_rows type lvc_t_row,
index like line of index_rows.
* Get Selected rows from alv grid
clear index_rows. refresh index_rows.
"When you choose extras->ztable
call method alv_grid->get_selected_rows
importing
et_index_rows = index_rows.
* Now delete those rows from the ALV grid
loop at index_rows into index.
read table itab index index-index. "Lets say itab is the table you are displaying
if sy-subrc = 0.
perform bdc_sm30. "do simple bdc for sm30 with tab name and selected values
endif.
endloop.
Regards,
Manoj Kumar P
Edited by: Manoj Kumar on Feb 23, 2009 2:49 PM -
How to get the output in ALV format
Hi All,
this is my program, in this i want to get the output in ALV, i hv created two containers and m able to get the ALV layout successfully but i am not able to fetch the correct data.
the output it is showing is some RFC value.
here we have used - abaplist, soli.
Please provide me the solution.
SELECT * FROM varid INTO CORRESPONDING FIELDS OF TABLE t_varid WHERE report in s_report.
LOOP AT t_varid .
SUBMIT (t_varid-report) USING SELECTION-SET t_varid-variant
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
**************Old System Entry********
CALL FUNCTION 'Z_GET_DETAILS'
DESTINATION 'BWDCLNT900'
EXPORTING
report = t_varid-report
variant = t_varid-variant
TABLES
listtab = list_tab.
IF sy-subrc EQ 0.
CALL FUNCTION 'LIST_TO_TXT'
TABLES
listtxt = listtxt1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2.
ENDIF.
if p_flag eq 'X'.
clear p_flag.
write : / 'Program Name',
41 'Variant Name',
66 'Output Match'.
endif.
IF listtxt EQ listtxt1.
WRITE : / t_varid-report,
41 t_varid-variant,
66 icon_green_light AS ICON HOTSPOT.
ELSE.
WRITE : / t_varid-report,
41 t_varid-variant,
66 icon_red_light AS ICON HOTSPOT.
ENDIF.
CLEAR : listtab,list_tab,listtxt,listtxt1.
REFRESH : listtab[],list_tab[],listtxt[],listtxt1[].
ENDLOOP.
AT line-selection.
v_report = sy-lisel(40).
v_variant = sy-lisel+40(14).
call SCREEN 400.
module STATUS_0400 output.
SUBMIT (v_report) USING SELECTION-SET v_variant
EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CALL FUNCTION 'LIST_TO_TXT'
TABLES
listtxt = listtxt1
listobject = list_tab
EXCEPTIONS
empty_list = 1
list_index_invalid = 2.
**************Old System Entry********
CALL FUNCTION 'Z_GET_DETAILS'
DESTINATION 'BWDCLNT900'
EXPORTING
report = v_report
variant = v_variant
TABLES
listtab = list_tab.
CREATE OBJECT CCONT1
EXPORTING
CONTAINER_NAME = 'C1'.
CREATE OBJECT CCONT2
EXPORTING
CONTAINER_NAME = 'C2'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = CCONT1.
CREATE OBJECT GRID2
EXPORTING
I_PARENT = CCONT2.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'abaplist'
CHANGING
IT_OUTTAB = list_tab.
CALL METHOD GRID2->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'abaplist'
CHANGING
IT_OUTTAB = listtab.
SET PF-STATUS 'ZUTDEMO2'.
endmodule.
module USER_COMMAND_0400 input.
IF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
endmodule. " USER_COMMAND_0400 INPUTsolved
-
How can i get the Icons in the output of ALV?
Hi,
I am trying to get the Icons in my report output using ALVs.
i am adding the following line
line_fieldcat-icon = 'ICON_GREEN_LIGHT'. in my field catalog for getting the respective Icon in the list. but the Icon is not getting displayed?
May i know whether the above specified line is correct or not? if not, how can i get the Icons in my output using ALVs?
Thanks and regards,
Ramesh.Hi,
take idea from this code :
INCLUDE ICONs.
WRITE : / icon_green_light AS ICON.
WRITE : / icon_red_light AS ICON.
write : / icon_yellow_light AS ICON.
OR
add code as per steps below in your ALV report :
<b>FIRST :</b>
INCLUDE ICONs.
<b>Second :</b> in your internal table add :
icon type icon-id,
<b>Third :</b>
add this value in icon field for green light.
itab-icon = '@08@'.
append itab.
<b>Fourth :</b> display
is_fieldcat-tabname = 'IT_FINAL'.
is_fieldcat-fieldname = 'ICON'.
is_fieldcat-col_pos = '1'.
is_fieldcat-outputlen = '12'.
is_fieldcat-seltext_l = 'ICON'.
APPEND is_fieldcat TO it_fieldcat.
CLEAR is_fieldcat.
Reward points, if helpful,
Sandeep Kaushik
Message was edited by:
Sandeep Kaushik
null -
Selecting a row in the output of alv grid
hi,
how do i select a row in the output of alv grid?plz help...
regards,
sheeba.Hi,
Please refer the code below:
*& Report ZDEMO_ALVGRID_SELROW *
*& Example of a simple ALV Grid Report *
*& The basic ALV grid, Enhanced to display capture each row a user has *
*& selected *
REPORT zdemo_alvgrid_selrow .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
SEl, "stores which row user has selected
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
* Build Fieldcatalog for ALV Report
form build_fieldcatalog.
* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you more control of the final product.
* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
* I.e. Field type may be required in-order for
* the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
* fieldcatalog-do_sum = 'X'.
* fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'. "Display column total
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
* Build layout for ALV grid report
form build_layout.
gd_layout-box_fieldname = 'SEL'.
"set field name to store row selection
gd_layout-edit = 'X'. "makes whole ALV table editable
gd_layout-zebra = 'X'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
* Display report using ALV grid
form display_alv_report.
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
* it_special_groups = gd_tabgroup
* IT_EVENTS = GT_XEVENTS
i_save = 'X'
* is_variant = z_template
tables
t_outtab = it_ekko
exceptions
program_error = 1
others = 2.
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
* Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into corresponding fields of table it_ekko.
endform. " DATA_RETRIEVAL
* FORM USER_COMMAND *
* --> R_UCOMM *
* --> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
* Check function code
CASE r_ucomm.
WHEN '&IC1'.
* Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
* Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
* Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
* Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
WHEN '&DATA_SAVE'. "user presses SAVE
loop at it_ekko into wa_ekko.
if wa_ekko-sel EQ 'X'.
* Process records that have been selected
endif.
endloop.
ENDCASE.
ENDFORM.
Thanks,
Sriram Ponna. -
Problem while opening Bex query on the web
Hello BW experts,
I have a problem while opening Bex query from my SAP Favorites.See below.
When i double click on the query, i get the following page, with the server name KBWS01QX.
But, from RSRT Tcode, select the query > query display as HTML > Click on ABAP Web , click execute as shown below, it is going to the correct URL as in the 2nd screen shot below.
My question is why is it going to the wrong URL when i open it from SAP Favorites menu?
I want it to open the same URL as it opened from RSRT(which is the right one)
What is the Config needed to make it to work from SAP favorites.
Any help would be appreciated.
Thanks alot.
SVHello,
Thank you all for your responses.
See below some additional info.
From RSRT, this time I clicked on JAVA WEB, and i get the below URL, which is the same URL i was getting when i executed the query from SAP favorites.
http://kbws01qx.xxxxxxx.com:50000/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?QUERY=ZCONSUMPTION
Also, i have executed the Function module : RSBB_URL_PREFIX_GET and i get the below values.
It seems that it is trying to connect to Java portal something services may be, but i want it to open in ABAP web only.
Please help. -
Issues while generating the output(using VF02- header- output)
Hi Group,
I have issues while generating output using the tcode VF02.
the issue is that, I have got an output type which is configured for the medium "Special Function" and the o/p program generates PDF depending on certain criteria.
now, when I try to "repeat output" option to generate output again, I was getting errors. it works sometimes by choosing the option "Successfully processed" then selecting the record and then saving it. if I do the same thing again, the output make be running into error or success, it is varying everytime.
I am not able to understand why the process is not working correctly, when doing the "Repeat output" option on the "Successfully processed" record, the system is giving error instead of a Successful message. it is succeeding once and sometimes not.
Kindly let me know your inputs if you have encountered same kind of issue.
Regards,
Vishnu.hi Group,
when I checked the configuration part of the o/p type I am currently processing, I could see that, in customizing part of this o/p type, there was a checkbox for Multiple Issuing - which is not checked.
when it is not checked, it should not be possible to run the o/ps for multiple times, but when I tried to generate o/ps again and again, in a few attempts I could to generate the PDFs and in some cases not. I don't know why there is no relevance for this check box Multiple Issuing.
Could you please let me know why this issuing of o/p is working in some occassions and not working work sometimes, which is having the configuration of checkbox Multiple Issuing - not being checked.
thanks for your help in advance.
Regards,
Vishnu. -
Problem while closing IE which displays the PDF
Hi,
I have an application in which a PDF form is displayed through the portal on an IE instance.
The IE works fine until I open the pdf. Once I open the pdf im not able to close the IE. I have ti forcefully close it using the task manager.
If I try navigating to another view from that PDF view ( Same IE instance) , the IE closes automatically throwing the 'Microsoft error' message.
How do I avoid this??? What might be the problem?
I use IE version 6.0
Thanks in Advance,
ReenaHi Reena,
I am not sure, please try these solutions.
1. Try to display the Adobe Interactive Form by adding the URL (of the Adobe Document Server) to the Trusted Sites of your MS Internet Explorer.
2. If you are experiencing problems opening pdf documents in IE,
then you need to disable compression for pdf documents
To disable the compression. please follow the steps :
1. start the Visual Administrator in <J2EE Home>/admin directory from the go script
2. In the Left pane :
Click on the "Cluster" tab.
Browse <System name> -> Server -> Services -> HTTP Provider
3. In the right pane
- Make sure the "AlwaysCompressed" property does not contain any
of the values
*.pdf
application/pdf
- Make sure the "NeverCompressed" property contains both values
*.pdf
application/pdf
4. Click the save button on the top of the right pane. The new setting will have effect on all servers in the cluster.
configuration if you have made changes to the "AlwaysCompressed" or "NeverCompressed" properties.
In such case you will need to perform the described above configuration manually.
II. If you have been running custom code that relies on the pdf compression
then you will need to maintain the "AlwaysCompressed" or "NeverCompressed" properties back to their previous values ("AlwaysCompressed" including *.pdf and application/pdf and "NeverCompressed" excluding both entries) after upgrade but you may face problems with opening of pdf files in IE as a side effect.
//Raj -
Need To Add One Button in The Output
Hi Freinds,
can any one tell how to add one button in the application
tool bar, that is at the final ALV out put screenHi,
you just create a pf status and add buttons to it.
then you include that pfstatus in your function module in the
export parameter 'i_callback_pf_status_set'
i found this sample code somewhere you just see how this is done:
create one pfstatus. for example znewstatus is the created
pfstatus. double click on the pfstatus that was created then add the buttons that you require in the appilication tool bar.
pass the form names to the I_CALLBACK_PF_STATUS_SET and I_CALLBACK_USER_COMMAND in grid as shown below.
example for reference:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
FORM SET_PF_STATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'ZNEWSTATUS'.
ENDFORM.
FORM USER_COMMAND USING R_UCOM TYPE SY-UCOMM R_SELFIELD TYPE SLIS_SELFIELD.
case R_UCOM
when 'PRINT'. (print is the function code name given to the icon created)
leave to list-processing.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = pass the form name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FMNAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 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.
CALL FUNCTION FMNAME.
reward if useful.
Nishant Rana -
Problems while playing CD's in the HiFi mode Mega PC 865
Do anyone has the solution!
I'll tried the Nec ND3500A, Pioneer DVR-105, MSI DR8-A2, MSI MS-8216S and 4 different BenQ DVD writers bud none of them works correct.
The player stops after 2-3 minutes or skip 1-2 seconds while playing CD's in the HiFi mode.
Mega PC 865.
Can someone help me!!!!Quote from: djdennis on 12-July-05, 05:31:25
Do anyone has the solution!
I'll tried the Nec ND3500A, Pioneer DVR-105, MSI DR8-A2, MSI MS-8216S and 4 different BenQ DVD writers bud none of them works correct.
The player stops after 2-3 minutes or skip 1-2 seconds while playing CD's in the HiFi mode.
Mega PC 865.
Can someone help me!!!!
I had the same hassle but with 865 pro. I jsut link my Plextor Multirecorder with Motherboard via simple audio cable. This cable 4 pin socket with only 3 cords connected. Take a look on the back of your drive - there should be proper socket.
But in Instant-on mode cd-player has very slow navigation - i have to wait up to 7-10 seconds when switching tracks! -
Regarding downlaod the output from ALV grid format
Hi
i want to download the output ALV grid format into excel sheet .
but condition is when ever user press the button (&ZDL) the should be downloaded.
and also how to convert the output into CSV format.hi,
when '&ZDL'.
use this condition
check this one for down loading
try to download an ALV report in excel format using (list ->export -> local file-> soread sheet )
Re: advantages of alv reports
Excel Download to ALV report
hi this is full program
REPORT ZCR_BOMPLANT_DOWNLOAD.
TABLES : MAST , "Material to BOM Link
STKO , "BOM Header
MARA . "General Material Data
TYPES : BEGIN OF TY_MASTER ,
MATNR TYPE MAST-MATNR , "Material Number
WERKS TYPE MAST-WERKS , "Plant
STLAN TYPE MAST-STLAN , "BOM Usage
STLNR TYPE MAST-STLNR , "Bill of material
STLAL TYPE MAST-STLAL , "Alternative BOM
ANDAT TYPE MAST-ANDAT , "Date record created on
AEDAT TYPE MAST-AEDAT , "Date of Last Change
AENAM TYPE MAST-AENAM , "Name of Person Who Changed Object
STLST TYPE STKO-STLST , "BOM status
ZPLP1 TYPE MBEW-ZPLP1 , "Future Planned Price 1
DWERK TYPE MVKE-DWERK , "Delivering Plant (Own or External)
END OF TY_MASTER .
TYPES : MY_TYPE(20) TYPE C.
DATA : IT_MASTER TYPE STANDARD TABLE OF TY_MASTER,
WA_MASTER TYPE TY_MASTER .
DATA : IT_HEADER TYPE TABLE OF MY_TYPE.
DATA : W_PTH TYPE RLGRAP-FILENAME.
DATA : W_FILE TYPE RLGRAP-FILENAME.
*--- Add Header Fields to Header Table ---
APPEND 'Material Number' TO IT_HEADER .
APPEND 'Plant' TO IT_HEADER .
APPEND 'BOM Usage' TO IT_HEADER .
APPEND 'Bill Code' TO IT_HEADER .
APPEND 'Alternative BOM' TO IT_HEADER .
APPEND 'Created On' TO IT_HEADER .
APPEND 'Changed On' TO IT_HEADER .
APPEND 'Changed By' TO IT_HEADER .
APPEND 'BOM Status' TO IT_HEADER .
APPEND 'Planned Price' TO IT_HEADER .
APPEND 'Delivery Plant' TO IT_HEADER .
IF SY-MANDT = '700'.
W_PTH = '
lkdb01\ISD\IS\Software Developments\Developments\Data Files\SAP Dumps\BOM_Available\'.
ELSE.
W_PTH = 'C:\'.
ENDIF.
START-OF-SELECTION.
*--- Load Data to Internal Table ---
SELECT MASTMATNR MASTWERKS MASTSTLAN MASTSTLNR MASTSTLAL MASTANDAT MASTAEDAT MASTAENAM STKO~STLST
INTO TABLE IT_MASTER
FROM MAST
INNER JOIN STKO ON STKOSTLNR EQ MASTSTLNR
AND STKOSTLAL EQ MASTSTLAL
INNER JOIN MARA ON MARAMATNR EQ MASTMATNR
WHERE MARA~MTART LIKE 'ZFG%'
AND STKO~LKENZ NE 'X'
AND STKO~LOEKZ NE 'X'
AND STKO~STLST EQ '1'.
SELECT MAST~MATNR MAST~WERKS MAST~STLAN MAST~STLNR MAST~STLAL MAST~ANDAT MAST~AEDAT MAST~AENAM STKO~STLST MBEW~ZPLP1 MVKE~DWERK
INTO TABLE IT_MASTER
FROM MAST
INNER JOIN STKO ON STKO~STLNR EQ MAST~STLNR
AND STKO~STLAL EQ MAST~STLAL
INNER JOIN MARA ON MARA~MATNR EQ MAST~MATNR
INNER JOIN MBEW ON MBEW~MATNR EQ MAST~MATNR
AND MBEW~BWKEY EQ MAST~WERKS
INNER JOIN MVKE ON MVKE~MATNR EQ MAST~MATNR
WHERE MARA~MTART LIKE 'ZFG%'
AND STKO~LKENZ NE 'X'
AND STKO~LOEKZ NE 'X'
AND STKO~STLST EQ '1'.
IF SY-SUBRC <> 0.
MESSAGE I014(ZLOAD).
ENDIF.
*--- Set Path to Function Module ---
CONCATENATE W_PTH SY-DATUM ' - ' 'BOM_AVAILABLE_PLANT.XLS' INTO W_FILE.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = W_FILE
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_MASTER
FIELDNAMES = IT_HEADER
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_EIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC = 0.
SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N.
MESSAGE I023(ZLOAD) WITH text-001.
ELSE.
MESSAGE I022(ZLOAD) WITH W_FILE. "Errors while downloading.
ENDIF.
END-OF-SELECTION.
SUBMIT ZI005_MARA_DUMP_SOLIDEAL_N. -
To download the Output of ALV to Excel file with Marco
Hello Masters ,
I m working on a ALV report in which either we can see the output or can download the ouptput and format that file before sending by mail..
the following steps are currently used to download and format the ALV output .
1. Save file form unix server
2. Download the file to computer.
3. Run a macro to format the execl file and
4. Send the file by mail.
Apart from this I have to implement a new functionality by which we can directly send the result to spool so that it can be sent directly by mail .
Can Anyone help me out????????
Thanks & Regards
Varlani AmitYou will be having all data to be send in an internal table, same as your ALV internal table.
you can provide a button or menu in alv screen to send directly without storing.
for this you
1. first write spool
2. send it through mail.
1. Writting a spool
*Get the printer name from TVARVC table.
select single low from tvarvc into l_destination
where name = 'PRINTER'
and type = 'P'
and numb = '0000'.
if sy-subrc ne 0.
l_destination = 'LOCL'.
endif.
*Get the print parameters.
call function 'GET_PRINT_PARAMETERS'
EXPORTING
copies = 1
department = 'SYSTEM'
destination = l_destination
expiration = 2
immediately = ' '
layout = 'X_65_255'
line_count = 65
line_size = 255
list_name = 'ABC'
list_text = 'XYZ
mode = ' '
new_list_id = 'X'
no_dialog = 'X'
receiver = 'SAP*'
release = 'X'
sap_cover_page = 'X'
user = sy-uname
IMPORTING
out_parameters = l_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
case sy-subrc.
when 1.
raise get_print_info_not_found.
when 2.
raise get_print_invalid_prt_params.
when 3.
raise get_print_invalid_arch_params.
when 4.
raise get_print_others.
endcase.
*start spool writing.
new-page print on parameters l_params no dialog.
uline.
skip.
write: 27 text-022 centered. "report name
skip.
uline.
Do formatting as you want.
loop at ALV_OUTPUT_INTERNAL TABLE..
write:/ ALV_OUTPUT_INTERNAL TABLE-fileds...
endloop.
uline.
*end spool writing.
new-page print off.
2. Sending a mail.
Use FM 'SO_DOCUMENT_SEND_API1' for sending a mail -
Printing the Output of ALV with out page breaks
Dear all,
I had a problem while taking printout in FBL1N transaction . wheever i am taking a printout one block of ALV is coming in one page. The alv is grouped according to vendor and Company code. with is_sort-group = '*'. I read so many forms and found that whenver a list is grouped with something then automatically it will be divided ino pages according to that. But my client requirement is if there are four records in the first group. the system will print the 4 records in the first page then the other records in another group are printed in the next page. but it should be printed like after the 4 records of the first group is over then it should start printing the next group records in the same page.
I tried using the is_sort-group = 'UL' but the header of the list is getting suppressed with that.
the variant is 1SAP
can any one tell me how to handle the situation
Thanks & regards
sreehari pit is normal
with * in group you generate a NEW-PAGE event which in turn executes the TOP-OF-PAGE (and print list header)
with UL in group you don't generate a NEW-PAGE so no list header
there is no other option
Maybe you are looking for
-
FLV components work one at a time, but not in unison!
I've done this before so I don't know why it's happening. I have an FLV component and 3 other FLV player components: Volume bar, play/pause button, and seek bar. They all have instance names and control the FLV correctly, but the seek bar and volume
-
Disk Utility - Format Time for 500GB (Zero Out Data)
Hello. Is there one length of time for formatting a hard drive with one pass of Zero Out Data? For instance, does the length of time change depending if you format with zeros using USB2, FW400, FW800, or eSATA? *My Format Setup* LaCie Rugged 500GB Al
-
M1217mfw with readiris device not installing correctly
I run Win7/64 bit. M1217nfw device. trying to download Readiris. It downloaded (4 times actually) and each time hangs on setting the scanner. I tried reinstalling my printer (don't have the CD, but downloaded and installed M1210 series printer s
-
Update fiel "parentId" table OCLG
When trying to update a table "OCLG" parentId field, returns me the following error: "Field parentId is read-only". How to do the update in this field? The field still has no value and want to include this value in this column. Here's how I'm doing:
-
Dear Expert, I meet a problem about the ATP check in CRM when create a service order. We need check the ATP when we create service order with spare parts.But for CRM, there is not any stock information. It is possible to use BAPI call to do ATP check