Oops ALV in background mode
Hi Experts,
I know this topic is discussed several times but I still have a confusion.
I have created one ALV report using custom container like the usual way. As per my understanding this report shouldn't execute in background
but when I execute the report in background in development system, it's not throwing any error and I am able to get the spool.
Why is this happening? Is there a possibility that if I transport the object to other system I may get error?
Please share your thoughts.
Thanks,
Tiki
This is my "common code" i use to manage CL_GUI_GRID in background without touching the output screen to define a container
CLASS lcl_event_handler DEFINITION DEFERRED.
DATA: gr_event_handler TYPE REF TO lcl_event_handler.
*---- ALV Grid instance reference
DATA: gr_alvgrid TYPE REF TO cl_gui_alv_grid.
*---- Custom container instance reference
DATA: gr_splitter_container TYPE REF TO cl_gui_splitter_container,
gr_container TYPE REF TO cl_gui_container.
*---- Header container
DATA: gr_docking_container TYPE REF TO cl_gui_docking_container,
gr_document TYPE REF TO cl_dd_document.
IN PBO
IF sy-batch = 'X'.
*---- Creating ALV grid within a docking container
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_docking_container.
ELSE.
*---- Creating Splitted Containers
CREATE OBJECT gr_splitter_container
EXPORTING
parent = cl_gui_container=>screen0
rows = 1
columns = 1.
CALL METHOD gr_splitter_container->set_border
EXPORTING
border = cl_gui_cfw=>false.
CALL METHOD gr_splitter_container->set_row_mode
EXPORTING
mode = gr_splitter_container->mode_relative.
gr_container =
gr_splitter_container->get_container( row = 1 column = 1 ).
*---- Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_container.
*---- Preparing document header
PERFORM prepare_header.
ENDIF.
*-- Creating an instance for the event handler
CREATE OBJECT gr_event_handler.
*-- Registering handler methods to handle ALV Grid events
* NOTA: Qua vanno registrati eventuali metodi aggiunti per gestire
* altri eventi della classe CL_GUI_ALV_GRID.
SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_data_changed FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_data_changed_finished
FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
*-- Preparing layout structure
PERFORM prepare_layout.
*-- Preparing print structure
PERFORM prepare_print.
*-- Preparing field catalog
PERFORM prepare_field_catalog.
*-- Preparing sort criteria table
PERFORM prepare_sort_criteria.
*-- Prepating filter criteria table
PERFORM prepare_filter_criteria.
*-- Preparing function codes to exclude from the toolbar
PERFORM prepare_toolbar_exclude.
*-- Preparing the output for the ALV grid list
*-- NOTE: set I_BUFFER_ACTIVE = 'X' to speed to the list display
*-- if the ALV grid uses statically always the same field catalog
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
* i_buffer_active = 'X'
* i_structure_name = 'GS_OUTTAB'
is_variant = gs_variant
i_save = 'A'
i_default = 'X'
is_layout = gs_layout
is_print = gs_print
* IT_SPECIAL_GROUPS =
it_toolbar_excluding = gt_exclude[]
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
CHANGING
it_outtab = gt_outtab[]
it_fieldcatalog = gt_fieldcat[]
it_sort = gt_sort[]
it_filter = gt_filter[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
*-- Allows to edit the toolbar
CALL METHOD gr_alvgrid->set_toolbar_interactive.
Similar Messages
-
If i run oops alv in background, its going dump
If I run oops alv in background its going dump?
can any one suggest me to do this or to overcome
thanks and regards
settyALV's can be run in background if you use a docking container instead of a custom container.
Please search the forum for "ALV in background". You will find tons of threads with solutions.
Re: How to run ALV reports in batch
Sample code to have ALV Grid in Background -
Multiple Alv in background mode
Hi all,
I am executing a program with two ALV's using a splitter container in background mode..It generates a spool with the data of only one alv..It never reflects both the alv's together..
Please provide with a solution..
Points will be rewarded...
Thanks in advance..
ArunUnfortunately, ALV functionality is lost when the program is executed in the background. You'll have to modify the program to use plain WRITE, for example, or run it in the foreground.
-
In OOPS ALV docking container gives error while execute in Background.
When i try to use Docking container to execute OOPS ALV in background the jobs still fails with Switch framework error.
Kindly let me know your inputs to resolve the same.
Thank you !!Hello Nalini,
Yes, it is possible to schedule background.
data: or_doc type ref to cl_gui_docking_container .
if cl_gui_alv_grid=>offline( ) is initial.
create object or_custom_container
exporting container_name = cust_container.
create object or_grid
exporting i_parent = or_custom_container.
else .
create object or_grid
exporting i_parent = or_doc .
endif .
Regards,
Vadamalai A.
Message was edited by: Matthew Billingham -
ALV last 10 columns are truncating in background mode
I am using Reuse_alv_list_display function module and running the report in the background mode, the spool is generating fine but the problem is that the last 10 columns of the report are truncating.what will be the possible solution.
The default maximum line width of the spool is 255 characters which means anything more the 255 will be truncated, To display more the 255 characters you have to do two things:
1] select a printer format which outputs more than 255 characters for eg x_65_512 or x_65_1023. If you cannot find any printer which has these formats then you have to ask the basis guys to create Z format for you like Z_65_1023.
2] After you use the above format of the printer when you display the spool there is an option of "DISPLAY IN MAXIMUM WIDTH" in the tool bar. Choose that it will show you the entire output. -
Spool not generated in background mode
Hi ,
I am fine tuning a report.
I am working on a program which is collecting data and exporting data into memory id. then two other reports, are importing data from memory and displaying in AlV/list.
When i execute this report in background the spool is not getting generated.
is there any way to generate the spool?
How to measure the execution time, as the program is taking much time and some times going to dump in case of time limit.
Thanks ,
KiranHi Kiran,
For measuring runtime use SE30 transaction. When u run in back ground it wont go to Dump. It may happen only in fore ground. If at all it happend in back ground, the reason might be different. Analyze that dump n see what is going wrong. Also i dont think there is any time limit in back ground as i executed jobs that ran for 11 days!!!!. U can alos debug the batch job.
put break point in ur program, Select that batch job in SE37, enter jdbg in command promt and press enter. Control will go to debug mode.
Which ALV u r using. I think through OOPS ALV batch job will not create spool i guess. Not sure on this.
Thanks,
Vinod. -
Problem while displaying data in spool using oops alv
Hi,
I have created a oops alv, in which iam displaying 2 ALV's on 2 containers..
Iam able to display the data which i need when i execute the program in foreground , But when i execute the program in background iam not able to see the 2nd ALV in the spool....
The ALV displays one below the other.
How i can i correct it..?
VishwaHi,
The container created in ALV will work only in foreground as this is the framework the background cannnot initiate the container object and assign the ALV to the container.
Hence you cannot create the container object and assign the same to the ALV screen in background. Instead you need to use the factory method/ALV FM to display in background mode.
For background ALV processing, don't use OOPS! U can use this fm : REUSE_ALV_GRID_DISPLAY.
You can also refer below threads:
Re: ALV: Foreground Vs Background
Re: OO ALV in background job
Regards
Shiva -
Using a report layout in background mode
Is is possible to apply a saved report layout like you apply to the alv grid to a csv file run in background mode?
Hi Cynthia ,
I can figure out one way :
SUBMIT ZREPORT TO SAP-SPOOL LAYOUT 'ZLAYOUT'
VIA SELECTION-SCREEN
DESTINATION 'locl'
KEEP IN SPOOL 'X'
IMMEDIATELY 'X'
WITHOUT SPOOL DYNPRO
AND RETURN.
This will return the report in your layout to the spool and can be downloaded as well.
Thanks
Naresh -
Perform setting OOP ALV for multiple reports using Field Symbols
Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc) for 2 different reports. this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
*&this report experimental how to print into ONE alv
*&with 2 diffrent structure internal table
REPORT zfiroopalv.
SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
PARAMETERS r_kpi RADIOBUTTON GROUP mode.
SELECTION-SCREEN END OF BLOCK mode.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
CLASS-DATA: md_wbs TYPE c LENGTH 1.
METHODS: process,
write.
DATA: mdo_data TYPE REF TO data.
TYPES: BEGIN OF st_wbs,
rsnum TYPE zmeime002a-rsnum,
rspos TYPE zmeime002a-rspos,
a TYPE zmmgitab01-menge,
b TYPE zmeime002a-bdmng,
c TYPE zmeime002a-bdmng,
d TYPE zmeime002a-bdmng,
e TYPE zmeime002a-bdmng,
f TYPE zmmgitab01-menge,
g TYPE zmmgitab01-menge,
END OF st_wbs.
TYPES: BEGIN OF st_kpi,
regio TYPE zmeime002a-regio,
gsber TYPE zmeime002a-gsber,
gtext TYPE zmeime002a-gtext,
x TYPE zmmgitab01-menge,
y TYPE zmmgitab01-menge,
z TYPE zmmgitab01-menge,
END OF st_kpi.
CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
wa_wbs LIKE LINE OF it_wbs.
CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
wa_kpi LIKE LINE OF it_kpi.
PRIVATE SECTION.
DATA: set_display_setting TYPE REF TO cl_salv_table.
DATA: display_settings TYPE REF TO cl_salv_display_settings.
DATA: salv_table TYPE REF TO cl_salv_table.
DATA: error TYPE REF TO cx_root.
DATA: errtext TYPE string.
ENDCLASS.
CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_kpi.
PRIVATE SECTION.
ENDCLASS.
* C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: process_wbs.
PRIVATE SECTION.
ENDCLASS.
* m.a.i.n. .p.r.o.g.r.a.m.
START-OF-SELECTION.
DATA: o_main TYPE REF TO lcl_main.
DATA: p_wbs TYPE c.
CREATE OBJECT o_main.
CASE 'X'.
WHEN r_wbs.
o_main->md_wbs = 'X'.
WHEN r_kpi.
o_main->md_wbs = ' '.
ENDCASE.
o_main->process( ).
o_main->write( ).
CLASS lcl_main IMPLEMENTATION.
*ENDMETHOD.
METHOD process. " NOTE: public method
DATA: o_main TYPE REF TO lcl_main,
o_wbs TYPE REF TO lcl_wbs,
o_kpi TYPE REF TO lcl_kpi.
CREATE OBJECT: o_wbs,o_kpi.
IF ( me->md_wbs = 'X' ).
CALL METHOD o_wbs->process_wbs( ). " NOTE: private method
GET REFERENCE OF me->it_wbs INTO me->mdo_data.
ELSE.
CALL METHOD o_kpi->process_kpi( ). " NOTE: private method
GET REFERENCE OF me->it_kpi INTO me->mdo_data.
ENDIF.
ENDMETHOD.
METHOD write.
FIELD-SYMBOLS:
<lt_outtab> TYPE table.
ASSIGN me->mdo_data->* TO <lt_outtab>.
cl_salv_table=>factory(
EXPORTING
list_display = if_salv_c_bool_sap=>false
IMPORTING
r_salv_table = salv_table
CHANGING
t_table = <lt_outtab>
salv_table->display( ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_kpi IMPLEMENTATION.
METHOD process_kpi.
*********** run some select statement into it_kpi*******
ENDMETHOD.
ENDCLASS.
CLASS lcl_wbs IMPLEMENTATION.
METHOD process_wbs.
*********** run some select statement into it_wbs*******
ENDMETHOD.
ENDCLASS.Hi,
I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
MODULE USER_COMMAND_9003 INPUT.
CASE OK_CODE.
WHEN 'DETAIL'.
GV_RPT = OK_CODE.
PERFORM F_GET_DETAIL_DATA.
WHEN 'REPORT'.
GV_RPT = OK_CODE.
PERFORM F_GET_REPT_DATA.
ENDCASE.
ENDMODULE. " USER_COMMAND_9003 INPUT
2. Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
MODULE DISPLAY_ALV OUTPUT.
IF GV_RPT EQ 'DETAIL'.
PERFORM F_FIELDCAT_DETAIL.
PERFORM F_LAYOUT_DETAIL.
PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
PERFORM F_DISPLAY_ALV_DETAIL.
ELSEIF GV_RPT EQ 'REPORT'.
PERFORM F_FIELDCAT_REPT.
PERFORM F_LAYOUT_REPT.
PERFORM F_EXCLUDE_TOOLBAR_REPT.
PERFORM F_DISPLAY_ALV_REPT.
ENDIF.
ENDMODULE. " DISPLAY_ALV OUTPUT
3. Before displaying ALV you need to free the container and ALV.
FORM F_DISPLAY_ALV_DETAIL .
IF GC_CONTAINER_ES IS NOT INITIAL.
CALL METHOD GC_CONTAINER_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_ALV_GRID_ES IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_ES->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_CONTAINER_TB IS NOT INITIAL.
CALL METHOD GC_CONTAINER_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
IF GC_ALV_GRID_TB IS NOT INITIAL.
CALL METHOD GC_ALV_GRID_TB->FREE
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_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.
ENDIF.
CREATE OBJECT GC_CONTAINER_ES
EXPORTING
CONTAINER_NAME = 'CC_9003'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6.
CREATE OBJECT GC_ALV_GRID_ES
EXPORTING
I_PARENT = GC_CONTAINER_ES
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_LAYOUT = GS_LAYOUT_ES
IT_TOOLBAR_EXCLUDING = GT_TOOLBAR_ES
CHANGING
IT_OUTTAB = GT_ES_REPT
IT_FIELDCATALOG = GT_FIELDCAT_ES
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
ENDFORM. " F_DISPLAY_ALV_DETAIL
Similarly define the FORM F_DISPLAY_ALV_REPT.
Hope this will be useful for you. If you have any more queries let me know. -
Radio buttons disabling functionality in OOPS ALV
Hi,
I am facing this peculiar problem in OOPS ALV. the requirement was to have a field and 2 radio buttons in ALV as editable when user clicks on CHANGE mode. but initially the table should be in display mode.
I have used the icons in ALV to provide the radio button functioanlity and its working.. but cant find solution to these 2 issues:
1) how to make radio button display only ?
2) when appending a new row in the ALV, its just appending a row with 4 columns ( 2 of field and 2 of radio button), but it is not able to append icons by default.
KIndly provide help on this. let me know if u need to clarify anything..
Thankx in advance,
Rohan MalikHi Rohan,
Not sure whether I understood your question correctly. I cant visualise your output .
To add icons while appending a new row to the output
First of all you need to have a field icon ( of type icon_d ) in your output table.
While appending the row you have to explicitly right the icon name to that field
l_record-icon = '@#12' something like that which you get from the type pool icons -
Passing Variables Between Programs in Background Mode
Hello,
Can you pls. suggest how I can pass a variable from one program to the other while in the background mode.
The Export and Import parameters do not work while in the background.
Thanks.
AmitHi Amit,
EXPORT/IMPORT works in Background mode provided the export & import both are done in background.
Refer this program: it has export/import in background
/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job
<b>*----
Before the export, fill the data fields before CLUSTR
</b>
wa_index-aedat = sy-datum.
wa_index-usera = sy-uname.
EXPORT s_matnr
TO DATABASE indx(st) FROM wa_index ID wa_index_key.
<b>*----
Before the import, fill the data fields before CLUSTR.
</b>
wa_index1-aedat = sy-datum.
wa_index1-usera = sy-uname.
To Import the selection screen data from Calling Program
IMPORT i_mara
FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
FREE MEMORY ID wa_index_key1.
Message was edited by:
Prashant Patil -
How do I define Field-Catalog and Event-Catalog in OOPs ALV
Hi All,
This is the piece of the code on which I'm working upon. This program is giving an exception "No Field-Catalog Found".
I'm new to OOPs ALV. Could anybody please tell me how to define the field-catalog and event-catalog in this.
module PBO output.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container EXPORTING CONTAINER_NAME = 'CCCONTAINER'.
CREATE OBJECT g_grid EXPORTING I_PARENT = g_custom_container.
CALL METHOD g_grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'IT_MATERIAL'
is_layout = layout
CHANGING IT_OUTTAB = gt_it_material.
ENDIF.
endmodule.
Regards,
Saurabhhi,
chk this sampl ceode.
TYPE-POOLS: slis.
CLASS lcl_event_receiver DEFINITION DEFERRED.
TABLES : zmpets_shipactiv, zmpets_chargebk, zmpets_shiphdr.
DATA : BEGIN OF int_crb OCCURS 0,
sel TYPE char1,
icon TYPE icon_d,
pernr LIKE zmpets_cil-pernr,
vorna LIKE pa0002-vorna,
movreason LIKE zmpets_shiphdr-movreason,
shipdocnum LIKE zmpets_chargebk-shipdocnum,
createdon LIKE zmpets_chargebk-createdon,
chargeamount LIKE zmpets_chargebk-chargeamount,
version LIKE zmpets_shipactiv-version,
activity LIKE zmpets_shipactiv-activity,
vendor LIKE zmpets_shiphdr-vendor,
smtp_addr LIKE adr6-smtp_addr,
empperid LIKE zmpets_167doc-empperid,
celltab TYPE lvc_t_styl,
END OF int_crb.
DATA : int_crb_ver LIKE int_crb OCCURS 0 WITH HEADER LINE.
DATA : int_crb_mail LIKE int_crb OCCURS 0 WITH HEADER LINE.
DATA : int_shipactiv LIKE zmpets_shipactiv OCCURS 0 WITH HEADER LINE.
DATA: gt_fieldcatalog TYPE lvc_t_fcat.
DATA : wf_flag TYPE i.
DATA : wf_res TYPE c.
DATA : wf_tabix TYPE sy-tabix.
DATA: BEGIN OF int_sin OCCURS 0,
shipdocnum LIKE zmpets_chargebk-shipdocnum,
shipdocnum LIKE zmpets_shipactiv-petsdocnumber,
END OF int_sin.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA l_num(3).
DATA: ok_code LIKE sy-ucomm,
w_repid LIKE sy-repid,
wl_sno TYPE i VALUE 0,
w_max TYPE i VALUE 100,
wf_layout TYPE lvc_s_layo,
cont_on_main TYPE scrfname VALUE 'GRID_CONTROL',
cont_on_dialog TYPE scrfname VALUE 'GRID_CONTROL',
grid1 TYPE REF TO cl_gui_alv_grid,
grid2 TYPE REF TO cl_gui_alv_grid,
custom_container1 TYPE REF TO cl_gui_custom_container,
custom_container2 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO lcl_event_receiver,
lt_exclude TYPE ui_functions,
ls_celltab TYPE lvc_s_styl,
lt_celltab TYPE lvc_t_styl.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-001.
PARAMETERS : p_cash AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK b3.
PERFORM fieldcatalog_init USING gt_fieldcatalog[].
Selection-Screen----
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
SELECT-OPTIONS:s_chdate FOR zmpets_chargebk-createdon,
s_pernr FOR zmpets_shiphdr-pernr,
s_mvrsn FOR zmpets_shiphdr-movreason,
s_sin FOR zmpets_chargebk-shipdocnum NO INTERVALS
NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK b1.
PERFORM f_clear_fields.
CALL SCREEN 100.
CLASS lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
handle_user_command
FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
PRIVATE SECTION.
ENDCLASS. "lcl_event_receiver DEFINITION
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
§ 2.In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
DATA: ls_toolbar TYPE stb_button.
append a separator to normal toolbar
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
new button -
MOVE 'PROCESSED' TO ls_toolbar-function.
MOVE icon_execute_object TO ls_toolbar-icon.
MOVE 'Process the Record'(110) TO ls_toolbar-quickinfo.
MOVE ' Process '(200) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD. "handle_toolbar
METHOD handle_user_command.
§ 3.In event handler method for event USER_COMMAND: Query your
function codes defined in step 2 and react accordingly.
DATA: lt_rows TYPE lvc_t_row.
CASE e_ucomm.
WHEN 'PROCESSED'.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
defaultoption = 'N'
textline1 = 'Do you want to process the selected documents?'
TEXTLINE2 = ' '
titel = 'Process Documents'
START_COLUMN = 25
START_ROW = 6
CANCEL_DISPLAY = 'X'
IMPORTING
answer = wf_res.
*--IF THE USER CONFIRMS 'YES',
IF wf_res = 'J'.
PERFORM f_modify_activity.
CALL METHOD grid1->refresh_table_display.
PERFORM SENDINGMAIL.
ENDIF.
ENDCASE.
ENDMETHOD. "handle_user_command
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
MODULE pbo_100 OUTPUT
MODULE pbo_100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
w_repid = sy-repid.
IF custom_container1 IS INITIAL.
*get the data from charge back table
PERFORM select_table_chb.
create a custom container control for our ALV Control
CREATE OBJECT custom_container1
EXPORTING
container_name = cont_on_main
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
add your handling, for example
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = w_repid
txt2 = sy-subrc
txt1 = 'The control could not be created'(510).
ENDIF.
CREATE OBJECT grid1
EXPORTING i_parent = custom_container1.
Set a titlebar for the grid control
wf_layout-grid_title = 'Charge Back'(100).
allow to select multiple lines
wf_layout-sel_mode = 'C'.
wf_layout-stylefname = 'CELLTAB'.
Exclude all edit functions in this example since we do not need them:
PERFORM exclude_tb_functions CHANGING lt_exclude.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = wf_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
it_toolbar_excluding = lt_exclude
IT_HYPERLINK =
IT_ALV_GRAPHICS =
CHANGING
it_outtab = int_crb[]
it_fieldcatalog = gt_fieldcatalog.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_user_command FOR grid1.
SET HANDLER event_receiver->handle_toolbar FOR grid1.
CALL METHOD grid1->set_toolbar_interactive.
ENDIF. "IF grid1 IS INITIAL
CALL METHOD cl_gui_control=>set_focus
EXPORTING
control = grid1.
ENDMODULE. "pbo_100 OUTPUT
MODULE pai_100 INPUT
MODULE pai_100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
PERFORM f_clear_fields.
LEAVE PROGRAM.
WHEN 'CANCEL'.
PERFORM f_clear_fields.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
PERFORM f_clear_fields.
LEAVE TO SCREEN 0.
ENDCASE.
CLEAR ok_code.
ENDMODULE. "pai_100 INPUT
**& Form select_table_chb
text
FORM select_table_chb.
IF p_cash = 'X'.
*Consider the pending documents also.
*get the documents which are not processed yet,
*Doctype -> 06 = Charge Back document type.
SELECT zmpets_shiphdrpernr pa0002vorna
zmpets_shiphdrmovreason zmpets_chargebkshipdocnum
zmpets_chargebkcreatedon zmpets_chargebkchargeamount
zmpets_shipactivversion zmpets_shipactivactivity
zmpets_shiphdr~vendor
adr6~smtp_addr
zmpets_167doc~empperid
INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
FROM zmpets_chargebk
JOIN zmpets_shiphdr
ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
JOIN zmpets_shipactiv
ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
JOIN pa0002
ON zmpets_shiphdrpernr = pa0002pernr
JOIN lfa1
ON lfa1lifnr = zmpets_shiphdrvendor
JOIN adr6
ON adr6addrnumber = lfa1adrnr
JOIN zmpets_167doc
ON zmpets_167docpernr = pa0002pernr
WHERE zmpets_shipactiv~doctype = '06'
zmpets_shipactiv~activity NE '30'
ZMPETS_CHARGEBK~CREATEDON IN s_chdate
AND ZMPETS_SHIPHDR~pernr IN s_pernr
AND ZMPETS_SHIPHDR~MOVREASON IN s_mvrsn
AND ZMPETS_CHARGEBK~SHIPDOCNUM IN s_sin
AND zmpets_chargebk~loekz NE 'X'
AND zmpets_shipactiv~loekz NE 'X'
AND zmpets_shiphdr~loekz NE 'X'.
IF sy-subrc <> 0.
*Message is 'No Pending Documents Available.'.
MESSAGE s196(zm050).
ELSE.
LOOP AT int_crb_ver.
*Not yet processed. set to red
int_crb_ver-icon = '@0A@'.
MODIFY int_crb_ver.
ENDLOOP.
PERFORM f_filter_data_pending.
ENDIF.
ELSE.
*Get the document details from pa0002,zmpets_shipactiv,ZMPETS_CHARGEBK
*table.
*Consider document type as '01' during the selection.
*Doctype -> 06 = Charge Back document type.
SELECT zmpets_shiphdrpernr pa0002vorna zmpets_shiphdr~movreason
zmpets_chargebkshipdocnum zmpets_chargebkcreatedon
zmpets_chargebkchargeamount zmpets_shipactivversion
zmpets_shipactivactivity zmpets_shiphdrvendor
*adr6~smtp_addr
zmpets_167doc~empperid
INTO CORRESPONDING FIELDS OF TABLE int_crb_ver
FROM zmpets_chargebk
JOIN zmpets_shiphdr
ON zmpets_chargebkshipdocnum = zmpets_shiphdrshipdocno
JOIN zmpets_shipactiv
ON zmpets_chargebkshipdocnum = zmpets_shipactivpetsdocnumber
JOIN pa0002
ON zmpets_shiphdrpernr = pa0002pernr
JOIN lfa1
ON lfa1lifnr = zmpets_shiphdrvendor
JOIN adr6
ON adr6addrnumber = lfa1adrnr
JOIN zmpets_167doc
ON zmpets_167docpernr = pa0002pernr
WHERE zmpets_chargebk~createdon IN s_chdate
AND zmpets_shiphdr~pernr IN s_pernr
AND zmpets_shiphdr~movreason IN s_mvrsn
AND zmpets_chargebk~shipdocnum IN s_sin
AND zmpets_shipactiv~activity NE '30'
AND zmpets_shipactiv~doctype = '06'
AND zmpets_chargebk~loekz NE 'X'
AND zmpets_shipactiv~loekz NE 'X'
AND zmpets_shiphdr~loekz NE 'X'.
IF sy-subrc <> 0.
*Message is 'No Charge Back Documents Available.'.
MESSAGE s201(zm050).
ELSE.
PERFORM f_filter_data.
ENDIF.
ENDIF.
ENDFORM. "select_table_chb
*& Form UPDATE_RECORDS
text
--> p1 text
<-- p2 text
FORM update_records TABLES p_et_index_rows
STRUCTURE lvc_s_row.
DATA: ls_selected_line LIKE lvc_s_row,
lf_row_index TYPE lvc_index.
LOOP AT p_et_index_rows INTO ls_selected_line.
lf_row_index = ls_selected_line-index.
ENDLOOP.
ENDFORM. " UPDATE_RECORDS
**& Form fieldcatalog_init
text
-->P_GT_FIELDCATALOG[] text
FORM fieldcatalog_init USING lt_fieldcatalog TYPE lvc_t_fcat.
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'SEL'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'C'.
ls_fieldcatalog-col_pos = 1.
ls_fieldcatalog-edit = 'X'.
ls_fieldcatalog-reptext = 'Select for Processing'.
ls_fieldcatalog-coltext = 'Select for Processing'.
ls_fieldcatalog-seltext = 'Select for Processing'.
ls_fieldcatalog-tooltip = 'Select for Processing'.
ls_fieldcatalog-checkbox = 'X'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'ICON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'CHAR'.
ls_fieldcatalog-col_pos = 2.
ls_fieldcatalog-intlen = '4'.
ls_fieldcatalog-reptext = 'Status'.
ls_fieldcatalog-coltext = 'Status'.
ls_fieldcatalog-seltext = 'Status'.
ls_fieldcatalog-tooltip = 'Status'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'PERNR'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-col_pos = 2.
ls_fieldcatalog-intlen = '8'.
ls_fieldcatalog-reptext = 'Employee Number'.
ls_fieldcatalog-coltext = 'Employee Number'.
ls_fieldcatalog-seltext = 'Employee Number'.
ls_fieldcatalog-tooltip = 'Employee Number'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'VORNA'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 3 .
ls_fieldcatalog-datatype = 'CHAR'.
ls_fieldcatalog-outputlen = '20'.
ls_fieldcatalog-reptext = 'Employee Name'.
ls_fieldcatalog-coltext = 'Employee Name'.
ls_fieldcatalog-seltext = 'Employee Name'.
ls_fieldcatalog-tooltip = 'Employee Name'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'MOVREASON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 4.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-outputlen = '10'.
ls_fieldcatalog-reptext = 'Move Reason'.
ls_fieldcatalog-coltext = 'Move Reason'.
ls_fieldcatalog-seltext = 'Move Reason'.
ls_fieldcatalog-tooltip = 'Move Reason'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'SHIPDOCNUM'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-datatype = 'NUMC'.
ls_fieldcatalog-outputlen = '10'.
ls_fieldcatalog-col_pos = 5.
ls_fieldcatalog-reptext = 'Shipping Document Number'.
ls_fieldcatalog-coltext = 'Shipping Document Number'.
ls_fieldcatalog-seltext = 'Shipping Document Number'.
ls_fieldcatalog-tooltip = 'Shipping Document Number'.
ls_fieldcatalog-key = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'CREATEDON'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 6.
ls_fieldcatalog-datatype = 'DATS'.
ls_fieldcatalog-outputlen = '8'.
ls_fieldcatalog-reptext = 'Created On'.
ls_fieldcatalog-coltext = 'Created On'.
ls_fieldcatalog-seltext = 'Created On'.
ls_fieldcatalog-tooltip = 'Created On'.
ls_fieldcatalog-DO_sum = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ls_fieldcatalog-fieldname = 'CHARGEAMOUNT'.
ls_fieldcatalog-tabname = 'INT_CRB'.
ls_fieldcatalog-col_pos = 7.
ls_fieldcatalog-datatype = 'CURR'.
ls_fieldcatalog-outputlen = '13'.
ls_fieldcatalog-reptext = 'Charge Back Amount'.
ls_fieldcatalog-coltext = 'Charge Back Amount'.
ls_fieldcatalog-seltext = 'Charge Back Amount'.
ls_fieldcatalog-tooltip = 'Charge Back Amount'.
ls_fieldcatalog-DO_sum = 'X'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
CLEAR ls_fieldcatalog.
ENDFORM. "fieldcatalog_init
*& Form f_modify_activity
Modify the activity to 79 in zmpets_shipaciv table.
--> p1 text
<-- p2 text
FORM f_modify_activity .
REFRESH int_crb_mail.
int_crb_mail[] = int_crb[].
*All the document number which is to be processed is stored in
*the internel table 'INT_SIN'.
LOOP AT int_crb INTO int_crb.
IF int_crb-sel ='X'.
MOVE int_crb-shipdocnum TO int_sin.
APPEND int_sin.
CLEAR int_sin.
*Removing the processed documents.
DELETE int_crb.
ENDIF.
CLEAR int_crb.
ENDLOOP.
*Get the details from shipactiv table.
IF int_sin[] IS NOT INITIAL.
SELECT * FROM zmpets_shipactiv
INTO TABLE int_shipactiv
FOR ALL ENTRIES IN int_sin
WHERE petsdocnumber = int_sin-shipdocnum.
*Modify the activity code, version, actual date and last changed date.
SORT int_shipactiv BY petsdocnumber version DESCENDING.
CLEAR wf_tabix.
LOOP AT int_shipactiv.
wf_tabix = sy-tabix.
AT NEW petsdocnumber.
READ TABLE int_shipactiv INDEX wf_tabix.
int_shipactiv-activity = '030'.
int_shipactiv-version = int_shipactiv-version + 1.
int_shipactiv-actdate = sy-datum.
int_shipactiv-lastchangedby = sy-uname.
int_shipactiv-lastchangedt = sy-datum.
*Modify the data base table
MODIFY zmpets_shipactiv FROM int_shipactiv.
ENDAT.
CLEAR int_shipactiv.
AT LAST.
*Message is 'Data Processed Successfully.'.
MESSAGE s203(zm050).
ENDAT.
ENDLOOP.
*-send mail to the vendor and employee that the shipment is cleared for
LOOP AT int_crb_mail WHERE sel = 'X'.
PERFORM f_send_mail.
ENDLOOP.
REFRESH int_crb_mail.
CALL SELECTION-SCREEN 1000.
ELSE.
*Message is 'No Data Selected for Processing.'.
MESSAGE s200(zm050).
ENDIF.
ENDFORM. " f_modify_activity
*& Form f_clear_fields
text
--> p1 text
<-- p2 text
FORM f_clear_fields .
CLEAR int_crb.
CLEAR int_crb_ver.
CLEAR int_sin.
REFRESH int_crb.
REFRESH int_crb_ver.
REFRESH int_sin.
CLEAR int_shipactiv.
REFRESH int_shipactiv.
CLEAR wf_flag.
CLEAR wf_tabix.
ENDFORM. " f_clear_fields
*& Form f_filter_data
text
--> p1 text
<-- p2 text
FORM f_filter_data .
*Take the latest Version Data.
*take all the activities, including the activity '30'.
then put the details in internal table 'INT_CRB'.
SORT int_crb_ver BY shipdocnum version DESCENDING.
CLEAR wf_tabix.
CLEAR int_crb.
REFRESH int_crb.
LOOP AT int_crb_ver.
wf_tabix = sy-tabix.
AT NEW shipdocnum.
READ TABLE int_crb_ver INDEX wf_tabix.
MOVE-CORRESPONDING int_crb_ver TO int_crb.
APPEND int_crb.
CLEAR int_crb.
ENDAT.
ENDLOOP.
IF int_crb[] IS INITIAL.
*Message is 'No Records Available.'.
MESSAGE s202(zm050).
ELSE.
CLEAR wf_tabix.
LOOP AT int_crb.
wf_tabix = sy-tabix.
REFRESH lt_celltab.
ls_celltab-fieldname = 'SEL'.
IF int_crb-activity = '030'.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
*status becomes green. ie processed
int_crb-icon = '@08@'. "Green
ELSE.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
*status set to red. ie not yet processed
int_crb-icon = '@0A@'. "Red
ENDIF.
INSERT ls_celltab INTO TABLE lt_celltab.
INSERT LINES OF lt_celltab INTO TABLE int_crb-celltab.
MODIFY int_crb INDEX wf_tabix.
ENDLOOP.
ENDIF.
ENDFORM. " f_filter_data
*& Form f_filter_data
text
--> p1 text
<-- p2 text
FORM f_filter_data_pending.
*Take the latest Version Data.
*take all the activities, including the activity '30'.
*then filter it with out the activities '30' and having the lastest
*version. then put the details in internal table 'INT_CRB'.
SORT int_crb_ver BY shipdocnum version DESCENDING.
CLEAR wf_tabix.
CLEAR int_crb.
REFRESH int_crb.
LOOP AT int_crb_ver.
wf_tabix = sy-tabix.
AT NEW shipdocnum.
READ TABLE int_crb_ver INDEX wf_tabix.
IF int_crb_ver-activity NE '030'.
MOVE-CORRESPONDING int_crb_ver TO int_crb.
APPEND int_crb.
CLEAR int_crb.
ENDIF.
ENDAT.
ENDLOOP.
IF int_crb[] IS INITIAL.
*Message is 'No Records Available.'.
MESSAGE s202(zm050).
ENDIF.
ENDFORM. " f_filter_data_pending
*& Form EXCLUDE_TB_FUNCTIONS
text
<--P_LT_EXCLUDE text
FORM exclude_tb_functions CHANGING pt_exclude TYPE ui_functions.
DATA ls_exclude TYPE ui_func.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
APPEND ls_exclude TO pt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_undo.
APPEND ls_exclude TO pt_exclude.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form f_send_mail
text
--> p1 text
<-- p2 text
FORM f_send_mail .
*store the vendor name, vendor email id , employee name and employee
*email id in the internal table int_crb
Creation of the document to be sent
CLEAR doc_chng.
REFRESH objpack.
REFRESH objhead.
REFRESH reclist.
REFRESH objtxt.
File Name
doc_chng-obj_name = 'SHIPMENT'.
Mail Subject
CONCATENATE 'Shipment Document No.' int_crb_mail-shipdocnum
'Cleared.'
INTO doc_chng-obj_descr SEPARATED BY ' '.
Mail Contents
objtxt-line = 'Hi,'.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CONCATENATE 'Shipment Document Number ' int_crb_mail-shipdocnum
' cleared for move.' INTO objtxt-line SEPARATED BY ' '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
CLEAR objtxt.
objtxt-line = 'Regards '.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
objtxt-line = 'SAP '.
APPEND objtxt.
CLEAR objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
objtxt ).
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Completing the recipient list
target recipent
CLEAR reclist.
reclist-receiver = int_crb_mail-empperid. "employee email ID
"wf_empperid.
reclist-express = 'X'.
reclist-rec_type = 'U'.
APPEND reclist.
copy recipents
CLEAR reclist.
reclist-receiver = 'anversha.shahul@'."int_crb_mail-smtp_addr
reclist-express = 'X'.
reclist-rec_type = 'U'.
reclist-copy = 'X'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
COMMIT WORK.
SUBMIT rsconn01
WITH mode = 'INT'
WITH output = ' '
AND RETURN.
ENDFORM. " f_send_mail
rgds
anver
pls mark hlpful answers -
Suppressed some coloum while executing in Background mode
Hi All
As I am trying to execute report in foreground mode I am getting ALV output properly with all coloum while I am executing the same report in background mode I am getting same output with some of the coloum is not coming properly.
Please guide me to resolve the above issue.
Thanks
KRISHHi All
I am executing the custom report in foreground mode ALV output showing all columns for that same report I am executing in background mode some of the ALV output columns are missed out
For example:
Standard report output showing 10 columns, but I am executing the same report in background some of the columns are suppressed only I am able to view 5 columns remaining I am not able to view.
Please help me to resolve the above issue.
Thanks
KRISH -
Oops alv report not getting displayed
Hi experts,
I have REQUIREMENT WHERE I NEED TO DISPLAY THREE REPORTS USING ALAV OOPS.
I have maintained a FM to call alv rport.
,I have two validations to make at to different location in report. The report needs to be displayed only after I perform two different validations.
Issue is
I call this ALV reprt Fm once at : AT SELECTION SCREEN OUTPUT
and second time at : START OF SELECTION...
Now I can see the ALV report ( oops with three reports in one container) very well when i call it from : AT SECETION SCREEN OUTPUT( Here I perform one of teh two validations which I have mentioned above...The validation performed here is of Selction screen valiudation).
ButNow when I perform another validation at START OF SELECTIOn...here I cannot see the ALV report...TEH screen appearing is blank...
I am calling teh SAME OOPS ALV Function Module from both the locations...( START of SEL and AT selc O/p)..
I have debugged teh code and checked teh feidcatalogue genration as well s output table .and also structure
parameteers .. all of tehm are getting populated in both the cases ,,, but dont know why thye output doesnot appear in th last call..
please help ., I am stuck up...
TX a ton in adv...
Regards,
KTHi Kshitija T,
START-OF-SELECTION is processed in PAI of selection screen - as soon as all processing is done, the program flow will return, initialize your program an all of it's objects and display the selection screen again.
I solved this by disabling the default report status EXECUTE button and used AT-SELECTION-SCREEN events.
Regards,
Clemens -
XLS from Application server in background mode to internal table
Hi,
I need to transfer the content of an excel file in the application server to an internal table while running my program in background. My file is xls, cant use csv. For dataset bin mode, I need to know how to transfer the data to my internal table, already searched on forum but didnt find answer, at least not for background..
ow, I am using v6 here
about the ALSM_EXCEL_TO_INTERNAL_TABLE, I get the upload_ole error all the time, and with TEXT_CONVERT_XLS_TO_SAP, conversion_failed all the time too...
here is the code, just the load part and data declaration:
REPORT zbeto.
TYPE-POOLS: truxs.
TYPES:
BEGIN OF y_cot,
text1(12) TYPE c,
text2(12) TYPE c,
text3(12) TYPE c,
text4(12) TYPE c,
text5(12) TYPE c,
END OF y_cot.
DATA: it_datatab TYPE STANDARD TABLE OF y_cot,
wa_datatab TYPE y_cot,
it_raw TYPE truxs_t_text_data.
DATA:
v_file TYPE rlgrap-filename,
begin_col TYPE i VALUE '1',
begin_row TYPE i VALUE '2',
end_col TYPE i VALUE '5',
end_row TYPE i VALUE '102',
t_ctmp TYPE y_cot OCCURS 0 WITH HEADER LINE,
t_xls TYPE alsmex_tabline OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
PERFORM f_load_xls.
FORM : f_load_xls
FORM f_load_xls.
v_file = '
ZSAPDEV\SAPDEVINTERF$\COTACAO\TESTE.XLS'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = v_file
i_begin_col = begin_col
i_begin_row = begin_row
i_end_col = end_col
i_end_row = end_row
TABLES
intern = t_xls
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 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 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = v_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 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.
t_ctmp[] = it_datatab[].
ENDFORM. "f_load_xls
both FM arent working, and when I try to execute in background mode, before anything, I recieve the following error:
Message text:
Error during import of clipboard contents
Message class:
ALSMEX
Message no.:
037
Message type:
A
and without the ASLM FM, the TEXT_CONVERT give me the conversion_failed exception...
the directories are right, that I am sure, because I just copy&paste it from CG3Z/CG3Y when I uploaded and downloaded to
check the file in the server...
am I missing something?
thanks again,
Roberto Macedo
(PS: I made another topic because none replied the other in 4 days and wasnt solved yet)Hi!
You didn't find answer for this, because it is not possible. If you run your program in background, it is running on the server, and does not have any connection to your local machine. That's why you can't upload/download in background mode.
You might try to address somehow your local PC, with its IP or MAC address, but I don't think does this task worth so much time.
Run your program in online mode, or if you want to run it in background, then upload your file into the SAP server.
Regards
Tamá
Maybe you are looking for
-
Who has a find Open Path plug-in for CS4 Illustrator on WinXP and a close path also?
Can anyone lead me to a plug-ins for finding open paths and closing them in CS4 on WinXP? Thanks
-
Load data only for current month using ABAP Routine
Hi Everyone, I am loading data from R/3 using the 0HR_PA_OS_1 extractor. This requirement is to load the position numbers from R/3. Using the extractor for a given position 28 I get the following dataset results. CALMONTH POSITION 11-2004
-
BPEL PM INSTALL with 10.1.2.0.2
I have just intalled the J2EE and Web Services 10.1.2.0.2 component of the latest Application Server Portal and Wireless download. I have attempted to install the BPEL patch 4343748, I posts and error looking for the J2EE 10.1.2.0.0. version. Has thi
-
Sending a picture through email
how can you send a picture off your phone through email. on most phones it says send via email, but on the nokia 6111 it doesnt supply that option. wb xxx
-
HI, I'm facing a problem with my Availability Status functionality in the member List Iview...it doesnt work properly...meaning, when I choose Auto Detect Status it shows that Im offline while Im online...how to make this functionality work..ple