0% found this document useful (0 votes)
266 views

Alv List Popup Mail Path

The document defines a report that retrieves sales order and material master data from various tables and combines them into a final table for display or export purposes. It includes selection screen parameters and radio buttons to determine the output method, including an ALV grid display, file download, or email output. Data types and internal tables are defined to structure the data for processing.

Uploaded by

Kabil Rocky
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
266 views

Alv List Popup Mail Path

The document defines a report that retrieves sales order and material master data from various tables and combines them into a final table for display or export purposes. It includes selection screen parameters and radio buttons to determine the output method, including an ALV grid display, file download, or email output. Data types and internal tables are defined to structure the data for processing.

Uploaded by

Kabil Rocky
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 16

*&---------------------------------------------------------------------*

*& Report ZALVPROGRAM1


*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zalvprogram1.
TABLES: vbak,vbap,mara.
TYPE-POOLS slis.
TYPES: BEGIN OF ty_vbakvbap,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
netwr TYPE vbak-netwr,
kunnr TYPE vbak-kunnr,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
kwmeng TYPE vbap-kwmeng,
END OF ty_vbakvbap,
ty_t_vbakvbap TYPE STANDARD TABLE OF ty_vbakvbap.
TYPES: BEGIN OF ty_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
END OF ty_mara,
ty_t_mara TYPE STANDARD TABLE OF ty_mara.
TYPES: BEGIN OF ty_final,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
netwr TYPE vbak-netwr,
kunnr TYPE vbak-kunnr,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
kwmeng TYPE vbap-kwmeng,
ersda TYPE mara-ersda,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
w_chek TYPE c,
excpt(2) TYPE c,
sym(4) TYPE c,
icn(4) TYPE c ,
END OF ty_final,
ty_t_final TYPE STANDARD TABLE OF ty_final.
TYPES : t_document_data TYPE sodocchgi1,
t_packing_list TYPE sopcklsti1,

t_attachment TYPE solisti1,


t_body_msg TYPE solisti1,
t_receivers TYPE somlreci1.
DATA: w_document_data TYPE t_document_data,
w_packing_list TYPE t_packing_list,
w_attachment TYPE t_attachment,
w_body_msg TYPE t_body_msg,
w_receivers TYPE t_receivers,
e(10) TYPE C.
DATA: i_document_data TYPE TABLE OF t_document_data,
i_packing_list TYPE TABLE OF t_packing_list,
i_attachment TYPE TABLE OF t_attachment,
i_body_msg TYPE TABLE OF t_body_msg,
i_receivers TYPE TABLE OF t_receivers.
DATA: gt_vbakvbap TYPE ty_t_vbakvbap,
gw_vbakvbap TYPE ty_vbakvbap,
gt_mara TYPE ty_t_mara,
gw_mara TYPE ty_mara,
gt_final TYPE ty_t_final,
gw_final TYPE ty_final,
gt_fcat TYPE slis_fieldcat_alv,
gw_fcat TYPE slis_t_fieldcat_alv,
v_kunnr TYPE vbak-kunnr,
gt_sort TYPE slis_sortinfo_alv,
gw_sort TYPE slis_t_sortinfo_alv,
e_mail TYPE somlreci1-receiver,
g_tab_lines TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.


SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_matnr FOR vbap-matnr.
PARAMETERS: p_kunnr TYPE vbak-kunnr DEFAULT '2200'.
SELECTION-SCREEN END OF BLOCK blk.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
PARAMETER: r1 RADIOBUTTON GROUP grp USER-COMMAND a,
r2 RADIOBUTTON GROUP grp.
PARAMETERS:r3 RADIOBUTTON GROUP grp.
SELECTION-SCREEN BEGIN OF BLOCK r3 WITH FRAME TITLE text-003.
PARAMETERS: v_title TYPE sy-title DEFAULT 'ALV_POPUP' MODIF ID one.
SELECTION-SCREEN END OF BLOCK r3.
.
PARAMETERS:r4 RADIOBUTTON GROUP grp.
SELECTION-SCREEN BEGIN OF BLOCK r4 WITH FRAME TITLE text-004.
PARAMETERS: p_path TYPE ibipparms-path MODIF ID two.
SELECTION-SCREEN END OF BLOCK r4.
PARAMETERS:r5 RADIOBUTTON GROUP grp.
SELECTION-SCREEN BEGIN OF BLOCK r5 WITH FRAME TITLE text-005.
SELECT-OPTIONS : mail_id FOR e_mail NO INTERVALS MODIF ID tre .
SELECTION-SCREEN END OF BLOCK r5.
SELECTION-SCREEN END OF BLOCK blk1.
INITIALIZATION.
PERFORM initilization.
LOOP AT SCREEN.
IF screen-group1 = 'ONE' OR

screen-group1 = 'TWO' OR
screen-group1 = 'TRE'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN OUTPUT.
CASE 'X'.
WHEN r1 .
LOOP AT SCREEN.
IF screen-group1 = 'ONE'
screen-group1 = 'TWO'
screen-group1 = 'TRE'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN r2.
LOOP AT SCREEN.
IF screen-group1 = 'ONE'
screen-group1 = 'TWO'
screen-group1 = 'TRE'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN r3.
LOOP AT SCREEN.
IF screen-group1 = 'TWO'
screen-group1 = 'TRE'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.

OR
or

OR
or

OR

WHEN r4.
LOOP AT SCREEN.
IF screen-group1 = 'ONE' OR
screen-group1 = 'TRE'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN r5.
LOOP AT SCREEN.
IF screen-group1 = 'ONE' OR
screen-group1 = 'TWO'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDCASE.

AT SELECTION-SCREEN.
PERFORM atselection.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name
= 'P_PATH'
IMPORTING
file_name
= p_path.
START-OF-SELECTION.
PERFORM selection.
PERFORM sub_modify_records.
END-OF-SELECTION.
PERFORM diclaration.
IF r1 = 'X'.
PERFORM display.
ELSEIF r2 = 'X'.
PERFORM listdisplay.
ELSEIF r3 = 'X'.
PERFORM popdisplay.
ELSEIF r4 = 'X'.
IF p_path = ''.
MESSAGE 'Enter the Path' TYPE 'I'.
ELSE.
PERFORM guidownload.
ENDIF.
else.
PERFORM f_email.
ENDIF.
*TOP-OF-PAGE.
* PERFORM page.
*&---------------------------------------------------------------------*
*&
Form INITILIZATION
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM initilization .
s_vbeln-sign = 'I'.
s_vbeln-option = 'BT'.
s_vbeln-low = 4969.
s_vbeln-high = 4972.
APPEND s_vbeln.
ENDFORM.
" INITILIZATION
*&---------------------------------------------------------------------*
*&
Form SELECTION
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text

* <-- p2
text
*----------------------------------------------------------------------*
FORM selection .
SELECT vbak~vbeln
vbak~erdat
vbak~ernam
vbak~auart
vbak~netwr
vbak~kunnr
vbap~posnr
vbap~matnr
vbap~kwmeng
INTO TABLE gt_vbakvbap
FROM vbak
INNER JOIN vbap
ON vbak~vbeln = vbap~vbeln
WHERE vbak~vbeln IN s_vbeln .
IF gt_vbakvbap[] IS NOT INITIAL.
SELECT matnr
ersda
ernam
mtart
mbrsh
matkl
meins
INTO TABLE gt_mara
FROM mara
FOR ALL ENTRIES IN gt_vbakvbap
WHERE matnr = gt_vbakvbap-matnr.
ENDIF.
LOOP AT gt_vbakvbap INTO gw_vbakvbap.
MOVE-CORRESPONDING gw_vbakvbap TO gw_final.
READ TABLE gt_mara INTO gw_mara WITH KEY matnr = gw_vbakvbap-matnr.
IF sy-subrc = 0.
MOVE: gw_mara-ernam TO gw_final-ernam,
gw_mara-ersda TO gw_final-ersda,
gw_mara-mtart TO gw_final-mtart,
gw_mara-mbrsh TO gw_final-mbrsh,
gw_mara-matkl TO gw_final-matkl,
gw_mara-meins TO gw_final-meins.
ENDIF.
APPEND gw_final TO gt_final.
CLEAR gw_final.
ENDLOOP.
ENDFORM.
" SELECTION
*&---------------------------------------------------------------------*
*&
Form DICLARATION
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM diclaration .
gt_fcat-col_pos = 0.

gt_fcat-fieldname = 'SYM'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'MY SYMBOL'.
gt_fcat-symbol = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 1.
gt_fcat-fieldname = 'VBELN'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'SALES ORDER'.
gt_fcat-key = 'X'.
gt_fcat-no_zero = 'X'.
* gt_fcat-hotspot = 'X'.
* gt_fcat-SYMBOL = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
APPEND gt_fcat TO
CLEAR gt_fcat.

2.
= 'ERDAT'.
'GT_FINAL'.
= 'Date on Which Record Was Created'.
gw_fcat.

gt_fcat-col_pos = 3.
gt_fcat-fieldname = 'ERNAM'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Name of Person who Created the Object'.
* gt_fcat-emphasize = 'C601'.
* gt_fcat-icon = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 4.
gt_fcat-fieldname = 'AUART'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Sales Document Type'.
* gt_fcat-tech = 'X'.
* gt_fcat-icon = 'X'.
* gt_fcat-symbol = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 5.
gt_fcat-fieldname = 'NETWR'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Net Value of the Sales Order in Document Currency'.
gt_fcat-do_sum = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 6.
gt_fcat-fieldname = 'KUNNR'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Sold-to party'.
gt_fcat-no_zero = 'X'.
gt_fcat-just = 'C'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.

gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
APPEND gt_fcat TO
CLEAR gt_fcat.

7.
= 'POSNR'.
'GT_FINAL'.
= 'Sales Document Item'.
gw_fcat.

gt_fcat-col_pos = 8.
gt_fcat-fieldname = 'MATNR'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Material Number'.
* gt_fcat-key = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 9.
gt_fcat-fieldname = 'KWMENG'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Cumulative Order Quantity in Sales Units'.
gt_fcat-do_sum = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
APPEND gt_fcat TO
CLEAR gt_fcat.

10.
= 'ERSDA'.
'GT_FINAL'.
= 'Created On'.
gw_fcat.

gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
APPEND gt_fcat TO
CLEAR gt_fcat.

11.
= 'MTART'.
'GT_FINAL'.
= 'Material Type'.
gw_fcat.

gt_fcat-col_pos = 12.
gt_fcat-fieldname = 'MBRSH'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Industry sector'.
gt_fcat-just = 'C'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos = 13.
gt_fcat-fieldname = 'MATKL'.
gt_fcat-tabname = 'GT_FINAL'.
gt_fcat-seltext_m = 'Material Group'.
gt_fcat-just = 'C'.
gt_fcat-no_zero = 'X'.
APPEND gt_fcat TO gw_fcat.
CLEAR gt_fcat.
gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
APPEND gt_fcat TO

14.
= 'MEINS'.
'GT_FINAL'.
= 'Base Unit of Measure'.
gw_fcat.

CLEAR gt_fcat.
gt_fcat-col_pos =
gt_fcat-fieldname
gt_fcat-tabname =
gt_fcat-seltext_m
gt_fcat-outputlen
APPEND gt_fcat TO
CLEAR gt_fcat.

15.
= 'EXCPT'.
'GT_FINAL'.
= ''.
= 3.
gw_fcat.

ENDFORM.
" DICLARATION
*&---------------------------------------------------------------------*
*&
Form DISPLAY
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM display .
DATA: p_layout TYPE slis_layout_alv.
p_layout-colwidth_optimize = 'X'.
p_layout-zebra = 'X'.
p_layout-no_vline = 'X'.
p_layout-no_hline = 'X'.
p_layout-window_titlebar = 'My ALV Report'.
p_layout-lights_fieldname = 'EXCPT'.
p_layout-no_sumchoice = 'X'.
p_layout-box_fieldname = 'SYM'.
p_layout-totals_text = 'Toltal QTY'.
p_layout-totals_only = 'X'.
p_layout-no_sumchoice = 'X'.
p_layout-key_hotspot = 'X'.
p_layout-detail_titlebar = 'Details of Storing'.
**
p_layout-reprep = 'X'.
**
p_layout-detail_initial_lines = 'X'.
**
p_layout-info_fieldname = 'C01'.
**
p_layout-coltab_fieldname = ''.
**
p_layout-lights_tabname = 'GW_FINAL'.
*
p_layout-lights_rollname = 'VBELN_VA'.
*
p_layout-lights_condense = 'X'.
**
p_layout-box_tabname = 'VBAK'.
**
p_layout-f2code = ''.
*
p_layout-confirmation_prompt = 'X'.
**
p_layout-no_colhead = 'X'.

*
*
*
*
*

gt_sort-fieldname = 'VBELN'.
gt_sort-tabname = 'GT_FINAL'.
gt_sort-subtot = 'X'.
APPEND gt_sort TO gw_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK
= ' '
I_BYPASSING_BUFFER
= ' '
I_BUFFER_ACTIVE
= ' '
i_callback_program
= sy-repid
I_CALLBACK_PF_STATUS_SET
= 'X'
i_callback_user_command
= 'USER_COMMAND'
i_callback_top_of_page
= 'TOP_OF_PAGE'
i_callback_html_top_of_page
= ''

* i_callback_html_end_of_list
= ''
* I_STRUCTURE_NAME
= ''
* I_BACKGROUND_ID
= ''
i_grid_title
= 'ALV_GRID'
* I_GRID_SETTINGS
= ''
is_layout
= p_layout
it_fieldcat
= gw_fcat
* IT_EXCLUDING
=
* IT_SPECIAL_GROUPS
=
it_sort
= gw_sort
* IT_FILTER
=
* IS_SEL_HIDE
=
* I_DEFAULT
= 'X'
* I_SAVE
= ' '
* IS_VARIANT
=
* IT_EVENTS
=
* IT_EVENT_EXIT
=
* IS_PRINT
=
* IS_REPREP_ID
=
* I_SCREEN_START_COLUMN
= 0
* I_SCREEN_START_LINE
= 0
* I_SCREEN_END_COLUMN
= 0
* I_SCREEN_END_LINE
= 0
* I_HTML_HEIGHT_TOP
= 0
* I_HTML_HEIGHT_END
= 0
* IT_ALV_GRAPHICS
=
* IT_HYPERLINK
=
* IT_ADD_FIELDCAT
=
* IT_EXCEPT_QINFO
=
* IR_SALV_FULLSCREEN_ADAPTER
=
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER
=
* ES_EXIT_CAUSED_BY_USER
=
TABLES
t_outtab
= gt_final
* 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
*&---------------------------------------------------------------------*
*&
Form user_command
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_UCOMM
text
*
-->R_SELF
text
*----------------------------------------------------------------------*
*FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
* IF r_ucomm = '&IC1' .
*
READ TABLE gt_final INTO gw_final INDEX rs_selfield-tabindex.
*
rs_selfield-VALUE = gw_final-vbeln.
*
SET PARAMETER ID 'AUN' FIELD rs_selfield-VALUE.
*
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
* ENDIF.

*ENDFORM.
"USERCMD
*&---------------------------------------------------------------------*
*&
Form atselection
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM atselection .
SELECT SINGLE kunnr
FROM kna1
INTO v_kunnr
WHERE kunnr = p_kunnr.
IF sy-subrc NE 0.
MESSAGE 'Custamer is not avilable' TYPE 'E'.
ENDIF.
ENDFORM.
" atselection
*&---------------------------------------------------------------------*
*&
Form PAGE
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM top_of_page.
DATA: p_hed TYPE slis_t_listheader,
s_hed TYPE slis_listheader.
s_hed-typ = 'H'.
s_hed-info = 'SALES ORDEAR'.
APPEND s_hed TO p_hed.
s_hed-typ = 'S'.
s_hed-key = 'DATE :'.
s_hed-info = sy-datum.
APPEND s_hed TO p_hed.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = p_hed
i_logo
= 'ZSAP'.
* I_END_OF_LIST_GRID
=
* I_ALV_FORM
=
.
ENDFORM.
"top_of_page
*&---------------------------------------------------------------------*
*&
Form LISTDISPLAY
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM listdisplay .
DATA: p_layout TYPE slis_layout_alv.
p_layout-colwidth_optimize = 'X'.
p_layout-zebra = 'X'.
* p_layout-no_vline = 'X'.
p_layout-no_hline = 'X'.
** p_layout-no_colhead = 'X'.
p_layout-window_titlebar = 'My ALV Report'.

* p_layout-lights_fieldname = 'VBELN'.
** p_layout-lights_tabname = 'GW_FINAL'.
* p_layout-lights_rollname = 'VBELN_VA'.
*p_layout-lights_condense = 'X'.
**p_layout-no_sumchoice = 'X'.
* p_layout-box_fieldname = 'VBELN'.
** p_layout-box_tabname = 'VBAK'.
**p_layout-f2code = ''.
* p_layout-confirmation_prompt = 'X'.
* p_layout-key_hotspot = 'X'.
** p_layout-reprep = 'X'.
** p_layout-detail_initial_lines = 'X'.
p_layout-detail_titlebar = 'X'.
** p_layout-info_fieldname = 'C01'.
** p_layout-coltab_fieldname = ''.

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'


EXPORTING
I_INTERFACE_CHECK
= ' '
I_BYPASSING_BUFFER
=
I_BUFFER_ACTIVE
= ' '
i_callback_program
= sy-repid
I_CALLBACK_PF_STATUS_SET
= ' '
i_callback_user_command
= 'USER_COMMAND'
I_STRUCTURE_NAME
=
is_layout
= p_layout
it_fieldcat
= gw_fcat
IT_EXCLUDING
=
IT_SPECIAL_GROUPS
=
it_sort
= gw_sort
IT_FILTER
=
IS_SEL_HIDE
=
I_DEFAULT
= 'X'
I_SAVE
= ' '
IS_VARIANT
=
IT_EVENTS
=
IT_EVENT_EXIT
=
IS_PRINT
=
IS_REPREP_ID
=
I_SCREEN_START_COLUMN
= 0
I_SCREEN_START_LINE
= 0
I_SCREEN_END_COLUMN
= 0
I_SCREEN_END_LINE
= 0
IR_SALV_LIST_ADAPTER
=
IT_EXCEPT_QINFO
=
I_SUPPRESS_EMPTY_DATA
= ABAP_FALSE
IMPORTING
E_EXIT_CAUSED_BY_CALLER
=
ES_EXIT_CAUSED_BY_USER
=
TABLES
t_outtab
= gt_final
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.

" LISTDISPLAY

*&---------------------------------------------------------------------*
*&
Form POPDISPLAY
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM popdisplay .
DATA: i_private TYPE slis_data_caller_exit,
i_selfield TYPE slis_selfield,
w_exit(1) TYPE c.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title
= v_title
i_selection
= 'X'
i_allow_no_selection
= 'X'
i_zebra
= 'X'
** I_SCREEN_START_COLUMN
= 0
** I_SCREEN_START_LINE
= 0
** I_SCREEN_END_COLUMN
= 0
** I_SCREEN_END_LINE
= 0
i_checkbox_fieldname
= 'W_CHEK'
* I_LINEMARK_FIELDNAME
=
* I_SCROLL_TO_SEL_LINE
= 'X'
i_tabname
= 'GT_FINAL'
* I_STRUCTURE_NAME
= ''
it_fieldcat
= gw_fcat
* IT_EXCLUDING
=
i_callback_program
= sy-cprog
i_callback_user_command
= 'USER_COMMAND'
is_private
= i_private
IMPORTING
es_selfield
= i_selfield
e_exit
= w_exit
TABLES
t_outtab
= gt_final
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.

" POPDISPLAY

*&---------------------------------------------------------------------*
*&
Form user_command
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_UCOMM
text
*
-->R_SELF
text

*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1' .
READ TABLE gt_final INTO gw_final INDEX rs_selfield-tabindex.
rs_selfield-value = gw_final-vbeln.
SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
ENDFORM.
"USERCMD
*&---------------------------------------------------------------------*
*&
Form SUB_MODIFY_RECORDS
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM sub_modify_records .
LOOP AT gt_final INTO gw_final.
* IF gt_final-netwr GT 10000.
** Field icn of internal table is going to contain icon . For this column
**icon_allowed is set in the field catalog table. For various icons,see
** type pool <ICON>
*
i_tab-icn = '@1V@'.
*
MODIFY i_tab TRANSPORTING icn.
* ENDIF.
IF gw_final-netwr GT 50.
* Field icn of internal table is going to contain symbol . For this
* column symbol_allowed is set in the field catalog table. For various
* icons,see type pool <SYMBOL>
gw_final-sym = 'N'.
*
MODIFY gT_final TRANSPORTING sym.
ENDIF.
*
**
**
**
*
**
*

IF gw_final-KUNNR NE 'SDC1'.
This field will contain lights , traffic signals : red.yellow,green
That this field will be used as a light will be specified in the
column of structure STRUCT_LAYOUT.
gw_final-EXCPT = '1'.
MODIFY gt_final TRANSPORTING EXCPT.
ENDIF.
ENDLOOP.
ENDFORM.
" SUB_MODIFY_RECORDS
*&---------------------------------------------------------------------*
*&
Form GUIDOWnload
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
FORM guidownload .
DATA: var TYPE string.
*
ver TYPE string.
var = p_path.
* ver = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING

*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

BIN_FILESIZE
=
filename
= var
filetype
= 'ASC'
APPEND
= ' '
WRITE_FIELD_SEPARATOR
= ' '
HEADER
= '00'
TRUNC_TRAILING_BLANKS
= ' '
WRITE_LF
= 'X'
COL_SELECT
= ' '
COL_SELECT_MASK
= ' '
DAT_MODE
= ' '
CONFIRM_OVERWRITE
= ' '
NO_AUTH_CHECK
= ' '
CODEPAGE
= ' '
IGNORE_CERR
= ABAP_TRUE
REPLACEMENT
= '#'
WRITE_BOM
= ' '
TRUNC_TRAILING_BLANKS_EOL
= 'X'
WK1_N_FORMAT
= ' '
WK1_N_SIZE
= ' '
WK1_T_FORMAT
= ' '
WK1_T_SIZE
= ' '
IMPORTING
FILELENGTH
=
TABLES
data_tab
= gt_final
FIELDNAMES
=
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.
" GUIDOWnload
*&---------------------------------------------------------------------*
*&
Form f_email
*&---------------------------------------------------------------------*

*
text
*----------------------------------------------------------------------*
* --> p1
text
* <-- p2
text
*----------------------------------------------------------------------*
form f_email .
mail_id-SIGN = ''.
mail_id-option = ''.
w_document_data-obj_name = 'MAIL_TO_HEAD'.
w_document_data-obj_descr = 'Regarding Mail Program by SAP ABAP'.
"Body of the mail
PERFORM build_body_of_mail
USING:space,
'Hi,',
'I am fine. How are you? How are you doing ? ',
'This program has been created to send simple mail',
'with Subject,Body with Address of the sender. ',
'Regards,',
'Jeeva,',
'SAP HR Technical Consultant.'.
"Write Packing List for Body
DESCRIBE TABLE i_body_msg LINES g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Write Packing List for Attachment
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 1.
w_packing_list-body_start = 1.
DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
w_packing_list-doc_type = 'XLS'.
w_packing_list-obj_descr = 'Excel Attachment'.
w_packing_list-obj_name = 'XLS'.
w_packing_list-doc_size = w_packing_list-body_num * 255.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Fill the document data and get size of attachment
w_document_data-obj_langu = sy-langu.
READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
"Receivers List.
w_receivers-rec_type = 'U'. "Internet address
w_receivers-receiver = mail_id.
w_receivers-com_type = 'INT'.
w_receivers-notif_del = 'X'.
w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.

*
*
*

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'


EXPORTING
document_data
= w_document_data
put_in_outbox
= 'X'
commit_work
= 'X'
IMPORTING
SENT_TO_ALL
=
NEW_OBJECT_ID
=
TABLES
packing_list
= i_packing_list
contents_bin
= i_attachment
contents_txt
= i_body_msg
receivers
= i_receivers.
IF sy-subrc <> 0.
MESSAGE 'Mail Has been Succusfully Sent' TYPE 'i'.
ELSE.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.

ENDIF.
endform.
" f_email
*&---------------------------------------------------------------------*
*&
Form build_body_of_mail
*&---------------------------------------------------------------------*
*
text
*----------------------------------------------------------------------*
*
-->P_SPACE text
*----------------------------------------------------------------------*
form build_body_of_mail using
p_space.
w_body_msg = p_space.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
endform.
" build_body_of_mail

You might also like