Different langua
I wanted to know how to make the zen touch display other languages besides english! I've read the FAQ's section but it didn't work. The files are still displayed with symbols rather than characters. Can i get a step by step procedure on displaying languages such as Chinese?
what os are you using? XP uses unicode filenames which should be OK.
Try to convert your mp3 id3v2 tag to unicode.
Get ConvertZ v7.40 now.
http://alf-li.pcdiscuss.com/
I use "Unicode Little Endian" for my id3v2 tag.
Similar Messages
-
What are the different methods to find the user-exit for any requirement?
Hi Everybody,
What are the different methods to follow to find the user-exit for any requirement?
Thanks & Regards,
Nagaraju MaddiThe following program search all the user exits involved with a T-code:
Selection Text: P_TCODE: Transaction Code to Search
Text Symbols: 001 - Enter the Transaction Code that you want to search through for a User Exit
REPORT z_find_userexit NO STANDARD PAGE HEADING.
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP® User Exits exists.
*& Tables
TABLES : tstc, "SAP® Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP® Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
*& Selection Screen Parameters
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK a01.
*& Start of main program
START-OF-SELECTION.
* Validate Transaction Code
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
* Find Repository Objects for transaction code
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.
SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'FUGR'
AND obj_name = enlfdir-area.
MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.
* Find SAP® Modifications
SELECT * FROM tadir
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object = 'SMOD'
AND devclass = v_devclass.
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
SKIP.
IF NOT jtab[] IS INITIAL.
WRITE:/(95) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
WRITE:/(95) sy-uline.
LOOP AT jtab.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu AND
name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
ENDLOOP.
WRITE:/(95) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of Exits:' , sy-tfill.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'No User Exit exists'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(95) 'Transaction Code Does Not Exist'.
ENDIF.
* Take the user to SMOD for the Exit that was selected.
AT LINE-SELECTION.
GET CURSOR FIELD field1.
CHECK field1(4) EQ 'JTAB'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN. -
Dynamic structure for different tables
Hi All,
My requirement is, a table has to be given in the selection-screen and i have to download the data of that particular table.
My doubt is, here we are passing the table names dynamically, so how can we assign the structure to the different tables.
Any clues...
Senthil.Hi
Maybe the below code can help you.
TYPES: c80(80).
DATA: i_src TYPE STANDARD TABLE OF c80 WITH HEADER LINE.
*DATA: lin TYPE i.
*DATA: msg(240).
FIELD-SYMBOLS: <field> TYPE ANY.
DATA: headline(255).
PARAMETERS: p_tab TYPE dd03l-tabname OBLIGATORY VALUE CHECK.
DATA: tabstr LIKE p_tab.
DATA: layout(3). " 'A' = ALV, 'L' = ABAP-Liste
SELECTION-SCREEN BEGIN OF BLOCK layout WITH FRAME TITLE text-001
NO INTERVALS.
PARAMETERS: p_alv RADIOBUTTON GROUP layo.
PARAMETERS: p_list RADIOBUTTON GROUP layo.
SELECTION-SCREEN END OF BLOCK layout.
DEFINE src.
concatenate &1 &2 &3 &4 into i_src separated by space.
append i_src.
END-OF-DEFINITION.
START-OF-SELECTION.
CONCATENATE '''' p_tab '''' INTO tabstr.
CASE 'X'.
WHEN p_alv.
layout = '''A'''.
WHEN p_list.
layout = '''L'''.
ENDCASE.
src 'REPORT' p_tab '.' ''.
src 'DATA I_TAB TYPE STANDARD TABLE OF' p_tab '.' ''.
src 'FORM GETTAB.' '' '' ''.
src 'PERFORM CALLBACK IN PROGRAM' sy-repid '' ''.
src ' TABLES I_TAB USING' tabstr layout 'IF FOUND.'.
src 'ENDFORM.' '' '' ''.
GENERATE SUBROUTINE POOL i_src NAME p_tab. " LINE lin MESSAGE msg.
PERFORM gettab IN PROGRAM (p_tab) IF FOUND.
TOP-OF-PAGE.
CHECK NOT headline IS INITIAL.
FORMAT COLOR COL_HEADING.
WRITE headline.
ULINE.
* FORM callback *
* Sämtliche Verarbeitung muss in dieser Routine liegen *
* --> TAB Tabelle *
* --> TABNAME Name der Tabelle *
* --> LAYOUT_TYP Gewünschtes Layout 'A' = ALV-Grid, 'L' = Liste *
FORM callback TABLES tab TYPE STANDARD TABLE
USING value(tabname) TYPE dd02l-tabname
value(layout_typ).
DATA: typ,
len TYPE i,
pos TYPE i,
last_field TYPE i.
TYPES: BEGIN OF ty_header,
position TYPE dd03l-position,
reptext TYPE dd04t-reptext,
END OF ty_header.
DATA: headers TYPE STANDARD TABLE OF ty_header WITH HEADER LINE.
SELECT * INTO TABLE tab FROM (tabname).
CHECK sy-subrc = 0.
IF NOT sy-batch IS INITIAL.
layout_typ = 'L'.
ENDIF.
CASE layout_typ.
WHEN 'A'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = tabname
TABLES
t_outtab = tab
EXCEPTIONS
program_error = 0
OTHERS = 0.
WHEN 'L'.
* Ermitteln der Feldtexte
SELECT dd03l~position dd04t~reptext
INTO TABLE headers
FROM dd03l
INNER JOIN dd04t
ON dd04t~rollname = dd03l~rollname
WHERE dd03l~tabname = tabname AND
dd04t~ddlanguage = sy-langu AND
dd04t~as4local = 'A' AND
dd04t~as4vers = 0
ORDER BY dd03l~position.
* Ermitteln des letzten auszugebenden Feldes und
* Festlegung der Überschrift
FORMAT COLOR COL_HEADING.
CLEAR pos.
READ TABLE tab INDEX 1.
DO.
CHECK sy-index > 1.
ASSIGN COMPONENT sy-index OF STRUCTURE tab TO <field>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
DESCRIBE FIELD <field> OUTPUT-LENGTH len TYPE typ.
READ TABLE headers INDEX sy-index.
* Überschriften numerischer Felder rechtsbündig
IF typ CA 'NPIF'.
WRITE headers-reptext(len) TO headline+pos(len)
RIGHT-JUSTIFIED.
ELSE.
WRITE headers-reptext(len) TO headline+pos(len).
ENDIF.
last_field = sy-index.
pos = pos + len + 1.
IF pos > 254.
EXIT.
ENDIF.
ENDDO.
WRITE AT sy-linsz ''.
FORMAT COLOR COL_BACKGROUND INTENSIFIED OFF.
* Ausgabe der Tabelle
LOOP AT tab.
NEW-LINE.
DO last_field TIMES.
CHECK sy-index > 1.
ASSIGN COMPONENT sy-index OF STRUCTURE tab TO <field>.
WRITE: <field>.
ENDDO.
ENDLOOP.
ENDCASE.
ENDFORM.
Thanks to the original progam provider.
Kind Regards
Eswar -
Different database in different languages....
Hi Experts,
I am facing an unusual problem.In my project,there are two languages English & French.I am doing the coding by logging in English.But the database maintained for the same query in French is different.Now the testing is being done in French.How can i take care of this?Good answers will be suitably rewarded....Hi Shaheen,
Normaly databse values are mentained in same table, and if there is requirement of maintaining texts or values in different languages then there is always a laguage key in database table.
in your case as you have specified that there are two different tables , then u need to eitherfind a function moduel which automatically checks for language and do the required data fetch from tables.
or if you dont find any such function module then you have to code different select statements for each language.
you can check the laguage using system field sy-langu to get the language then call appropriate select statement.
hope ths helps
award forum points to helpful answers -
Different ways to find Customer exit, User Exit & Badi
Dear All,
What are the different ways by which we can find Customer Exit, User Exit & Badi for a given transaction code
Thanks
Ravindra suvarna<b>use this report u can find associate badi and user exit both for perticular transaction</b>&----
*& Report ZNEGI16 *
REPORT ZNEGI16 .
TABLES : TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.
DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA : FIELD1(30).
DATA : V_DEVCLASS LIKE TADIR-DEVCLASS.
PARAMETERS : P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .
DATA wa_tadir type tadir.
START-OF-SELECTION.
IF NOT P_TCODE IS INITIAL.
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
ELSEIF NOT P_PGMNA IS INITIAL.
TSTC-PGMNA = P_PGMNA.
ENDIF.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.
SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'FUGR'
AND OBJ_NAME EQ ENLFDIR-AREA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.
SELECT * FROM TADIR INTO TABLE JTAB
WHERE PGMID = 'R3TR'
AND OBJECT in ('SMOD', 'SXSD')
AND DEVCLASS = V_DEVCLASS.
SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU
AND TCODE EQ P_TCODE.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(105) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
Sorting the internal Table
sort jtab by OBJECT.
data : wf_txt(60) type c,
wf_smod type i ,
wf_badi type i ,
wf_object2(30) type C.
clear : wf_smod, wf_badi , wf_object2.
Get the total SMOD.
LOOP AT JTAB into wa_tadir.
at first.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 'Enhancement/ Business Add-in',
41 SY-VLINE ,
42 'Description',
105 SY-VLINE.
WRITE:/(105) SY-ULINE.
endat.
clear wf_txt.
at new object.
if wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
elseif wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
endif.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 wf_object2,
105 SY-VLINE.
endat.
case wa_tadir-object.
when 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE MODTEXT into wf_txt
FROM MODSAPT
WHERE SPRSL = SY-LANGU
AND NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
when 'SXSD'.
For BADis
wf_badi = wf_badi + 1 .
select single TEXT into wf_txt
from SXS_ATTRT
where sprsl = sy-langu
and EXIT_NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
endcase.
WRITE:/1 SY-VLINE,
2 wa_tadir-OBJ_NAME hotspot on,
41 SY-VLINE ,
42 wf_txt,
105 SY-VLINE.
AT END OF object.
write : /(105) sy-ULINE.
ENDAT.
ENDLOOP.
WRITE:/(105) SY-ULINE.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , wf_smod.
WRITE:/ 'No.of BADis:' , wf_badi.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
data : wf_object type tadir-object.
clear wf_object.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(8) EQ 'WA_TADIR'.
read table jtab with key obj_name = sy-lisel+1(20).
move jtab-object to wf_object.
case wf_object.
when 'SMOD'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
when 'SXSD'.
SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
endcase. -
Hi All.
i have an issue in the form printing.
In my form I have to pages.
I want the first page in Potroit format and second one in Landscape.
for this requirement,how to deal in Scripts and in Smart forms.
Can any body help me to solve this issue,.
Thanks in advance,
regards,
eswarWith onli one form u cannot achieve this.. but u need to have two same forms .. one with Landscape orientation.. and second with Portrait orientation...
( Otherwise u can go for the SMARTFORMS , with smartforms u can achieve this in a single form )
There is a way to have first page in landscape and second page in portrait.
Use
START_FORM
END_FORM
twice one form in each having different page setting(like landscape....)
See this code:
REPORT ZTEST_LANDSCAPE.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZTEST_02'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
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 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZTEST_02'
LANGUAGE = ' '
STARTPAGE = ' ' <b><u>(*** u can use this option to start printing from the second page )</u></b>
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA1'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA2'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
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 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
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 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZTEST_03'
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
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 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA2'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
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 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
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 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>reward if it helps u..
sai ramesh</b> -
Sending a text mail for different user in
Hi Abapers,
I am trying to use function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send a Text mail like "Purchase order is pending" .But how i can send a text mail .
Here we are not attach any document only the text message we need to different mail id.Or is there any other FM to send text mail.
Please help me if u have any sample code to send a text mail.
Thanks
NaniHi
You can use the fun module
UWSP_SEND_MAIL_TO_WEB
see the sample program using both he fun modules for sending some mails
REPORT zm_reservation_alert
NO STANDARD PAGE HEADING
MESSAGE-ID zm_msg.
D A T A B A S E T A B L E S D E C L A R A T I O N
T Y P E S D E C L A R A T I O N S
Reservations Main Structure
TYPES: BEGIN OF s_res,
rsnum TYPE rsnum, " Reservation No
rspos TYPE rspos, " Item No
usnam TYPE usnam, " User Name
bwart TYPE bwart, " Movement Type
aufnr TYPE aufnr, " Order Number
rsart TYPE rsart, " Record Type
bdart TYPE bdart, " Reservation Type
matnr TYPE matnr, " Material No
bdter TYPE bdter, " Req Date
menge TYPE menge_d, " Quantity
kostl TYPE kostl, " Cost Center
usrid TYPE sysid, " User ID
END OF s_res.
Output Main Structure
TYPES: BEGIN OF s_rep,
usnam TYPE usnam, " User Name
rsnum TYPE rsnum, " Reservation No
rspos TYPE rspos, " Item No
matnr TYPE matnr, " Material No
bdter TYPE bdter, " Req Date
menge TYPE menge_d, " Quantity
kostl TYPE kostl, " Cost Center
aufnr TYPE aufnr, " Order Number
END OF s_rep.
User Dept Details
TYPES: BEGIN OF s_dept,
pernr TYPE persno, " Personal No
usrid TYPE sysid, " User ID
orgeh TYPE orgeh, " Orgn Unit
orgtx TYPE orgtx, " Dept Name
END OF s_dept.
For Send Mail Purpose
DATA : i_doc_data LIKE sodocchgi1.
DATA : BEGIN OF i_pack_list OCCURS 0.
INCLUDE STRUCTURE sopcklsti1.
DATA : END OF i_pack_list.
DATA : BEGIN OF i_receivers OCCURS 0.
INCLUDE STRUCTURE somlreci1.
DATA : END OF i_receivers.
DATA : BEGIN OF i_contents OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA : END OF i_contents.
DATA : BEGIN OF i_header OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA : END OF i_header.
DATA : BEGIN OF i_att OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA : END OF i_att.
Internal table for bdcdata
DATA : it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
Internal table to handle messages
DATA : it_messages LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
D A T A D E C L A R A T I O N S
DATA: gv_lines TYPE sy-index, " Total Lines int Table
gv_days TYPE i, " Difference Days
gv_date TYPE sy-datum, " Date
gv_date1 TYPE sy-datum, " Date
gv_date2 TYPE sy-datum, " Date
gv_text(85), " Text Field
gv_mesg(70), " Error Messages
gv_bdc, " BDC Flag
gv_flag TYPE i, " Flag
gv_ernam TYPE ernam. " User ID
C O N S T A N T S D E C L A R A T I O N S
CONSTANTS: c_x VALUE 'X', " Flag
c_endda TYPE endda VALUE '99991231'. " Date
I N T E R N A L T A B L E S D E C L A R A T I O N S
DATA: i_res TYPE STANDARD TABLE OF s_res WITH HEADER LINE, " Reservns
i_dept TYPE STANDARD TABLE OF s_dept WITH HEADER LINE, " Dept
i_rep TYPE STANDARD TABLE OF s_rep WITH HEADER LINE. " Output
S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Fetch main data
PERFORM fetch_data.
Process data
PERFORM process_data.
*& Form fetch_data
Fetching the Reservations related data from Database Tables
FORM fetch_data .
CLEAR: gv_date, gv_date1, gv_date2.
gv_date = sy-datum.
gv_date1 = sy-datum - 10.
gv_date2 = sy-datum + 10.
CLEAR i_res.
REFRESH i_res.
SELECT a~rsnum " Reservation No.
b~rspos " Reservation Item
a~usnam " User Name
a~bwart " Movement Type
a~aufnr " Order Number
b~rsart " Record Type
b~bdart " Reservation Type
b~matnr " Material No
b~bdter " Req Date
INTO TABLE i_res
FROM rkpf AS a JOIN resb AS b
ON arsnum = brsnum
WHERE ( b~bdter BETWEEN gv_date1 AND gv_date2 ) AND
b~xloek EQ ' '.
SORT i_res BY rsnum rspos.
DELETE ADJACENT DUPLICATES FROM i_res COMPARING matnr.
Add userid into the i_usr int table
LOOP AT i_res.
i_res-usrid = i_res-usnam.
MODIFY i_res INDEX sy-tabix.
ENDLOOP.
IF NOT i_res[] IS INITIAL.
Get the User Dept Name
CLEAR i_dept.
REFRESH i_dept.
SELECT a~pernr " Personal No
a~usrid " User ID
b~orgeh " Orgn Unit
c~orgtx " Dept Name
INTO TABLE i_dept
FROM pa0105 AS a JOIN pa0001 AS b
ON apernr = bpernr JOIN t527x AS c
ON borgeh = corgeh
FOR ALL ENTRIES IN i_res
WHERE a~usrid = i_res-usrid AND
a~endda EQ c_endda AND
b~endda EQ c_endda.
ENDIF.
SORT i_dept BY pernr.
DELETE ADJACENT DUPLICATES FROM i_dept COMPARING pernr.
Move the Creator of Reservation to a diff table
LOOP AT i_res.
MOVE-CORRESPONDING i_res TO i_rep.
APPEND i_rep.
CLEAR i_rep.
ENDLOOP.
SORT i_rep BY usnam rsnum rspos.
ENDFORM. " Fetch_Data
*& Form process_data
Process the Reservations related data for Expiry Date
FORM process_data .
DATA: lv_date1 LIKE sy-datum,
lv_date2 LIKE sy-datum,
lv_date3(10),
lv_menge(13),
lv_tabix LIKE sy-tabix.
LOOP AT i_rep.
CLEAR: gv_days, gv_text, lv_date1, lv_date2,lv_date3.
lv_tabix = sy-tabix.
AT NEW usnam.
Populate the Contents Table
CLEAR i_att.
REFRESH i_att.
i_att = 'Reservations Reminder'(014).
APPEND i_att.
i_att = '----
APPEND i_att.
i_att-line = ' '.
APPEND i_att.
READ TABLE i_dept WITH KEY usrid = i_rep-usnam.
CONCATENATE 'Name:'(003) i_rep-usnam 'Dept:'(015) i_dept-orgtx
INTO i_att-line SEPARATED BY space.
APPEND i_att.
i_att-line = ' '.
APPEND i_att.
i_att = 'Please find the List of expiring Reservations'(004).
APPEND i_att.
i_att-line = ' '.
APPEND i_att.
CONCATENATE '--' '' '--
' INTO
i_att-line SEPARATED BY space.
APPEND i_att.
CONCATENATE 'Reservation #'(006) 'Material #'(007) ' Quantity'(002)
'Due Date'(008) 'Work Center/CC'(005) INTO
i_att-line SEPARATED BY space.
APPEND i_att.
CONCATENATE '--' '' '--
' INTO
i_att-line SEPARATED BY space.
APPEND i_att.
i_att-line = ' '.
APPEND i_att.
ENDAT.
gv_days = i_rep-bdter - gv_date.
lv_date1 = i_rep-bdter + 5.
lv_date2 = i_rep-bdter + 10.
MOVE i_rep-menge TO lv_menge.
WRITE i_rep-bdter TO lv_date3.
IF gv_days = 10.
IF i_rep-aufnr <> space.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-aufnr 'is due for 10 days. Please collect'(009)
INTO gv_text SEPARATED BY space.
ELSE.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-kostl 'is due for 10 days. Please collect'(009)
INTO gv_text SEPARATED BY space.
ENDIF.
i_att-line = gv_text.
APPEND i_att.
CLEAR i_att.
CLEAR gv_text.
ENDIF.
IF gv_days = 5.
IF i_rep-aufnr <> space.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-aufnr 'is due for 5 days. Please collect'(010)
INTO gv_text SEPARATED BY space.
ELSE.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-kostl 'is due for 5 days. Please collect'(010)
INTO gv_text SEPARATED BY space.
ENDIF.
i_att-line = gv_text.
APPEND i_att.
CLEAR i_att.
CLEAR gv_text.
ENDIF.
IF gv_date = lv_date1.
IF i_rep-aufnr <> space.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-aufnr 'is getting cancelled on'(011) lv_date2
INTO gv_text SEPARATED BY space.
ELSE.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-kostl 'is getting cancelled on'(011) lv_date2
INTO gv_text SEPARATED BY space.
ENDIF.
i_att-line = gv_text.
APPEND i_att.
CLEAR i_att.
CLEAR gv_text.
ENDIF.
IF gv_date = lv_date2.
IF i_rep-aufnr <> space.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-aufnr 'is being cancelled'(012)
INTO gv_text SEPARATED BY space.
ELSE.
CONCATENATE i_rep-rsnum i_rep-matnr lv_menge lv_date3
i_rep-kostl 'is being cancelled'(012)
INTO gv_text SEPARATED BY space.
ENDIF.
i_att-line = gv_text.
APPEND i_att.
CLEAR i_att.
CLEAR gv_text.
Mark the Reservation Item 'DELETED' using BDC.
UPDATE resb SET xloek = c_x.
PERFORM delete_item_resb.
ENDIF.
AT END OF usnam.
IF ( gv_days = 10 OR gv_days = 5 OR gv_date = lv_date1 OR
gv_date = lv_date2 ).
Read the User who creates the Reservn and send a mail alert to him
CLEAR : i_receivers,gv_ernam.
REFRESH: i_receivers.
READ TABLE i_rep INDEX lv_tabix.
gv_ernam = i_rep-usnam.
IF gv_ernam <> space.
Send mail Alert to PR Creator(SAP inbox)
PERFORM send_alert_data.
Send Mail to External Mail ID of the SAP USER
PERFORM send_mail_external.
ENDIF.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " Process_data
*& Form delete_item_resb
Set the Deletion Indicator for the Res. Item in RESB
FORM delete_item_resb.
gv_bdc = 'N'.
Perform to fill it_bdcdata.
PERFORM fill_it_bdcdata.
Call the Transaction MB22
CALL TRANSACTION 'MB22' USING it_bdcdata MODE 'A' UPDATE 'S'
MESSAGES INTO it_messages.
IF sy-subrc <> 0.
gv_flag = 1.
If error occurs in transaction mode run bdc session for that data
PERFORM bdc_process.
ENDIF.
Handles error messages
PERFORM error_messages.
CLEAR : it_bdcdata, it_messages.
REFRESH : it_bdcdata, it_messages.
IF gv_bdc = 'O'.
close bdc if it is open
PERFORM close_bdc.
ENDIF.
ENDFORM. "delete_item_resb
*& Form FILL_IT_BDCDATA
Filling Bdcdata structure with data
FORM fill_it_bdcdata.
PERFORM bdc_dynpro USING 'SAPMM07R' '0560'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RM07M-RSPOS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RM07M-RSNUM'
i_rep-rsnum.
PERFORM bdc_field USING 'RM07M-RSPOS'
i_rep-rspos.
PERFORM bdc_dynpro USING 'SAPMM07R' '0510'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RESB-XLOEK'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RESB-XLOEK'
c_x.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_dynpro USING 'SAPMM07R' '0510'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RESB-ERFMG'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDFORM. " FILL_IT_BDCDATA
*& Form BDC_DYNPRO
Filling the it_bdcdata table with program name & screen number
FORM bdc_dynpro USING program LIKE bdcdata-program
dynpro LIKE bdcdata-dynpro.
it_bdcdata-program = program.
it_bdcdata-dynpro = dynpro.
it_bdcdata-dynbegin = 'X'.
APPEND it_bdcdata.
CLEAR it_bdcdata.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
Filling it_bdcdata with field name and field value
FORM bdc_field USING fnam LIKE bdcdata-fnam
fval.
it_bdcdata-fnam = fnam.
it_bdcdata-fval = fval.
APPEND it_bdcdata.
CLEAR it_bdcdata.
ENDFORM. " BDC_FIELD
*& Form ERROR_MESSAGES
Displaying error messages
FORM error_messages.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = sy-langu
IMPORTING
msg = gv_mesg
EXCEPTIONS
not_found = 1
OTHERS = 2.
LOOP AT it_messages WHERE msgtyp = 'E'.
WRITE : / 'Message :'(001) ,gv_mesg.
CLEAR it_messages.
ENDLOOP.
ENDFORM. " ERROR_MESSAGES
*& Form BDC_PROCESS
Open bdc session if call transaction fails
FORM bdc_process.
IF gv_bdc = 'N'.
open bdc session
PERFORM open_bdc.
gv_bdc = 'O'.
ENDIF.
IF gv_bdc = 'O'.
insert data into bdc session
PERFORM insert_bdc.
ENDIF.
ENDFORM. " BDC_PROCESS
*& Form OPEN_BDC
Calling function module to open bdc session
FORM open_bdc.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'ZMM'
keep = 'X'
user = sy-uname
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
ENDFORM. " OPEN_BDC
*& Form INSERT_BDC
Insert it_bdcdata into bdc by calling function module bdc_insert
FORM insert_bdc.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'MB22'
TABLES
dynprotab = it_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ENDFORM. " INSERT_BDC
*& Form CLOSE_BDC
Closing bdc session
FORM close_bdc.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
ENDFORM. " CLOSE_BDC
*& Form send_alert_data
Send Alert for the Expired Contract
FORM send_alert_data .
CLEAR: gv_lines,i_receivers, i_header, i_contents,i_doc_data.
REFRESH : i_receivers,i_header,i_contents.
DESCRIBE TABLE i_att LINES gv_lines.
i_receivers-receiver = gv_ernam.
i_receivers-receiver = 'SSHEIK'.
i_receivers-rec_type = 'B'.
i_receivers-rec_date = sy-datum.
i_receivers-express = 'X'.
i_receivers-com_type = 'INT'.
i_receivers-notif_del = 'X'.
APPEND i_receivers.
i_doc_data-obj_name = 'SAPoffice'(013).
i_doc_data-obj_descr = 'Reservations Reminder'(014).
i_doc_data-obj_langu = 'E'.
i_doc_data-no_change = c_x.
i_doc_data-obj_prio = 1.
i_doc_data-priority = 1.
i_doc_data-doc_size = ( gv_lines - 1 ) * 255 + 135.
i_pack_list-transf_bin = c_x.
i_pack_list-head_start = '1'.
i_pack_list-head_num = '1'.
i_pack_list-body_start = '1'.
i_pack_list-body_num = gv_lines.
i_pack_list-doc_type = 'DOC'.
i_pack_list-obj_name = 'SAPoffice'(013).
i_pack_list-obj_descr = 'Reservations Reminder'(014).
i_pack_list-obj_langu = 'E'.
i_pack_list-doc_size = ( gv_lines - 1 ) * 255 + 135.
APPEND i_pack_list.
i_header-line = 'Header'. APPEND i_header.
Data for contents
i_contents-line = 'Please find the Reservations Due List'(016).
APPEND i_contents.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = i_doc_data
PUT_IN_OUTBOX = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = i_pack_list
object_header = i_header
contents_bin = i_att
contents_txt = i_contents
receivers = i_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc = 0.
MESSAGE i000 WITH 'Mail Sucessfully sent'(017).
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " send_alert_data
*& Form send_mail_external
Send mail to External MAIL ID of the PR Creator
FORM send_mail_external.
DATA : lv_str(24), lv_str1(40),
lv_pernr LIKE adr6-persnumber,
lv_adrnr LIKE adr6-addrnumber,
lv_usrid LIKE pa0105-usrid,
lv_mail LIKE adr6-smtp_addr,
lv_sendor TYPE syuname,
lv_receiver TYPE string,
lv_header TYPE string,
lv_body TYPE string.
CLEAR: lv_pernr, lv_usrid, lv_adrnr,
lv_mail, lv_sendor, lv_receiver,
lv_header, lv_body .
lv_usrid = gv_ernam.
SELECT SINGLE persnumber addrnumber FROM usr21
INTO (lv_pernr,lv_adrnr)
WHERE bname = lv_usrid.
IF sy-subrc = 0.
SELECT SINGLE smtp_addr INTO lv_mail FROM adr6
WHERE addrnumber = lv_adrnr AND
persnumber = lv_pernr.
IF sy-subrc <> 0.
CONCATENATE lv_usrid '@anc.com' INTO lv_mail.
lv_receiver = lv_mail.
ELSE.
lv_receiver = lv_mail.
ENDIF.
lv_receiver = '[email protected]'.
lv_sendor = 'JALKHATAM'.
lv_header = 'Reservations Reminder'(014).
lv_str = 'Pls check your SAP Inbox'(019).
lv_str1 = 'for the status of Reservations Due List'(020).
CONCATENATE lv_str lv_str1 INTO lv_body
SEPARATED BY space.
Call Function Module To send mail
CALL FUNCTION 'UWSP_SEND_MAIL_TO_WEB'
EXPORTING
id_header = lv_header
id_body = lv_body
id_receiver = lv_receiver
id_sender = lv_sendor
ID_HTML_MAIL =
id_commit_work = 'X'
EXCEPTIONS
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.
ENDIF.
ENDFORM. " send_mail_external
Reward points for useful Answers
Regards
Anji -
What are the different functions used in sap script?
Hi,
What are the different functions used in sap script? What are the parameters used in each Function?
Regards,
Maheshhe print program is used to print forms. The program retieves the necesary data from datbase tables, defines the order of in which text elements are printed, chooses a form for printing and selects an output device and print options.
Function modules in a printprogram:
When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine forms into a single spool request use START_FORM and END_FORM.
To print textelements in a form use WRITE_FORM. The order in which the textelements are printed, is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you can also use the WRITE_FORM_LINES function module.
To transfer control command to a form use CONTROL_FORM.
Structure of a print program
Read data
Tables: xxx.
SELECT *
FROM xxx.
Open form printing - Must be called before working with any of the other form function modules.
Must be ended with function module CLOSE FORM
call function 'OPEN_FORM'.....
To begin several indentical forms containing different data within a single spool request, begin each form using START_FORM, and end it using END_FORM
call funtion 'START_FORM'.....
Write text elements to a window of the form
call function 'WRITE_FORM'.....
Ends spool request started with START_FORM
call funtion 'END_FORM'.....
Closes form printing
call function 'CLOSE_FORM'...
OPEN_FORM function
Syntax:
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = ' '
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Some important parameters:
FORM Name of the form
DEVICE
PRINTER : Print output using spool
TELEFAX: Fax output
SCREEN: Output to screen
OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....
The input for the parameter is structure ITCPO.
CLOSE_FORM function
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Paramerters:
RESULT Returns status information and print/fax parameters after the form has been printed. RESULT is of structure ITCPP.
WRITE_FORM function
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = ' '
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Some important parameters:
ELEMENT Specifies which textelement is printed
WINDOW Specifies which window is printed
TYPE Specifies the output area of the main window. This can be:
TOP - Used for headers
BODY
BOTTOM - Used for footers
FUNCTION Specifies whether text is to be appended, replaced or added
Example of how to use the WRITE_FORM function module together with a script.
Form layout of the MAIN window
/E INTRODUCTION
Dear Customer
/E ITEM_HEADER
IH Carrier, Departure
/E ITEM_LINE
IL &SBOOK-CARRID&, &SPFLI-DEPTIME&
/E CLOSING_REMARK
The print program
Writing INTRODUCTION
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'INTRODUCTION'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Writing ITEM_HEADER
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Set ITEM_HEADER into TOP area of main window for subsequent pages
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Write ITEM_LINE
LOOP AT .....
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8.
ENDLOOP.
Delete ITEM_HEADER from TOP area of main window
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'DELETE'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Print CLOSING_REMARK
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CLOSING_REMARK'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
START_FORM function
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = ' '
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END_FORM function
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONTROL_FORM function
The CONTROL_FORM function module alows you to create SapScript control statements from within an APAB program.
Syntax:
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command =
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 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.
Example:
Protecting the text element ITEM_LINE
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
TEXELEMENT = 'ITEM_LINE'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'. -
Using /1BCDWB/DOCPARAMS - LANGU in Interface coding initialization
Hello,
I have build an pdf interactive offline form using a DDIC form interface. I am using this interface (FM) in my print report like
call function module fm_name
exporting
/1BCDWB/DOCPARAMS
One important parameter of /1BCDWB/DOCPARAMS that is filled in my print report is obviously LANGU.
As you know you can have alternative language in AIF that are used when the LANGU isn't available. (REPLANGU1, REPLANGU2 and REPLANGU3)
The challenge I am currently struggeling with is, how to get these information in my "coding initialization" part of my interface.
Either I would like to have the langu variable of /1BCDWB/DOCPARAMS or even better the final language that is used to create the pdf form.
I have tried to use /1BCDWB/DOCPARAMS-LANGU directly in my coding initialization and I have tried to define /1BCDWB/DOCPARAMS as an input parameter of the coding initialization (as all the other import parameters).
However, when I try to activate it gives me the error that /1BCDWB/DOCPARAMS is unkown.
Do you have an idea how to get the pdf language in the coding initialization?
BR
CarstenHi,
To display form in login language refer below code...and To change the form element labels you do need to translate the form in different languages use t-code se63.
data : LW_SFPDOCPARAMS type SFPDOCPARAMS.
LW_SFPDOCPARAMS-LANGU = SY-LANGU.
CALL FUNCTION 'XXXXXXXXXXX'
EXPORTING
/1BCDWB/DOCPARAMS = LW_SFPDOCPARAMS
other parameters.......... -
VBAP - ARKTX is not stored as per Sy-langu
Hi
We have different users viz. login in English, Login in Arabic.
We have maintained the material master description in both the language.
When we create the sales order, the material master description in VBAP-ARKTX is not stored as per Sy-langu.
It is always in English.
Kindly help me where to configure / update in order to make this work.
Regards,
VenkatKindly use search before posting - Google 'VBAP-ARKTX language' finds this old post.
-
Need cost of materials of plant to be posted to different profit center
hi,
when we create a maintenance order in plant maintenance module, profit center is getting defaulted from the cost center assigned to main work center, all the material costs are psoted to this profit center, but my requirement is cost of materials of specific plant should be posted to different profit center. is there any way i can do this.
thanksDear Monica,
One way is to maintain the entries in a ztable for material and cost center relation and implement a proper BAdi/Enhancement.
Please check this sample program from other thread to find BADI and enhancement for a given transaction code. You just need to create a custom program in your system by cut and paste below codes.
REPORT ZTEST.
TABLES: TSTC,
TADIR,
MODSAPT,
MODACT,
TRDIR,
TFDIR,
ENLFDIR,
SXS_ATTRT ,
TSTCT.
DATA: JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
DATA: FIELD1(30).
DATA: V_DEVCLASS LIKE TADIR-DEVCLASS.
PARAMETERS: P_TCODE LIKE TSTC-TCODE,
P_PGMNA LIKE TSTC-PGMNA .
DATA: WA_TADIR TYPE TADIR.
START-OF-SELECTION.
IF NOT P_TCODE IS INITIAL.
SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
ELSEIF NOT P_PGMNA IS INITIAL.
TSTC-PGMNA = P_PGMNA.
ENDIF.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'PROG'
AND OBJ_NAME = TSTC-PGMNA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
IF SY-SUBRC NE 0.
SELECT SINGLE * FROM TRDIR
WHERE NAME = TSTC-PGMNA.
IF TRDIR-SUBC EQ 'F'.
SELECT SINGLE * FROM TFDIR
WHERE PNAME = TSTC-PGMNA.
SELECT SINGLE * FROM ENLFDIR
WHERE FUNCNAME = TFDIR-FUNCNAME.
SELECT SINGLE * FROM TADIR
WHERE PGMID = 'R3TR'
AND OBJECT = 'FUGR'
AND OBJ_NAME EQ ENLFDIR-AREA.
MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
ENDIF.
ENDIF.
SELECT * FROM TADIR INTO TABLE JTAB
WHERE PGMID = 'R3TR'
AND OBJECT in ('SMOD', 'SXSD')
AND DEVCLASS = V_DEVCLASS.
SELECT SINGLE * FROM TSTCT
WHERE SPRSL EQ SY-LANGU
AND TCODE EQ P_TCODE.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) 'Transaction Code - ',
20(20) P_TCODE,
45(50) TSTCT-TTEXT.
SKIP.
IF NOT JTAB[] IS INITIAL.
WRITE:/(105) SY-ULINE.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
Sorting the internal Table
sort jtab by OBJECT.
data : wf_txt(60) type c,
wf_smod type i ,
wf_badi type i ,
wf_object2(30) type C.
clear : wf_smod, wf_badi , wf_object2.
Get the total SMOD.
LOOP AT JTAB into wa_tadir.
at first.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 'Enhancement/ Business Add-in',
41 SY-VLINE ,
42 'Description',
105 SY-VLINE.
WRITE:/(105) SY-ULINE.
endat.
clear wf_txt.
at new object.
if wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
elseif wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
endif.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 SY-VLINE,
2 wf_object2,
105 SY-VLINE.
endat.
case wa_tadir-object.
when 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE MODTEXT into wf_txt
FROM MODSAPT
WHERE SPRSL = SY-LANGU
AND NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
when 'SXSD'.
For BADis
wf_badi = wf_badi + 1 .
select single TEXT into wf_txt
from SXS_ATTRT
where sprsl = sy-langu
and EXIT_NAME = wa_tadir-OBJ_NAME.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
endcase.
WRITE:/1 SY-VLINE,
2 wa_tadir-OBJ_NAME hotspot on,
41 SY-VLINE ,
42 wf_txt,
105 SY-VLINE.
AT END OF object.
write : /(105) sy-ULINE.
ENDAT.
ENDLOOP.
WRITE:/(105) SY-ULINE.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No.of Exits:' , wf_smod.
WRITE:/ 'No.of BADis:' , wf_badi.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
data : wf_object type tadir-object.
clear wf_object.
GET CURSOR FIELD FIELD1.
CHECK FIELD1(8) EQ 'WA_TADIR'.
read table jtab with key obj_name = sy-lisel+1(20).
move jtab-object to wf_object.
case wf_object.
when 'SMOD'.
SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
when 'SXSD'.
SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
Alternatively, you can do the following:
1. For what ever transaction u want the enhancement .. just check for the System-->status (menu) and find out the PROGRAM name....
2. Double click on to the program name and go inside the program (Abap editor)
3. Search for "Call Customer-function " ... and u'll get some search results .. If u get results then u have enhancement in that tcode .....
4. Then it actually calls a Function module .... copy the Function module name .... go to SE80 (object navigator) click on "Repository Information system" then Customer Enhancements .... Give the Function module name in the "Components" field and click Execute ....
ull get a list of Enhancements related to that Componene....
5. Choose which ever enhancement will suit ur business need ..
6. Go to CMOD... create a project .... assign ur enhancement ... and then code ur logic.... activate ur enhancement in CMOD ....... Ur Buisness need will be solved...
For a user exit......
Finding whether there is any User Exit or not for tcode VA42
1. For what ever transaction u want the user exit .. just check for the System-->status (menu) and find out the PROGRAM name.... ( The program name would be for our scenario "SAPMV45A" )
2. Double click on to the program name and go inside the program (Abap editor)
3. Search for the word "USEREXIT" .... u ll find all the user exits in the search result .. and find ur's then ...
Hope this will help.
Regards,
Naveen. -
Smartform layout in different languages
Hi Experts,
How will i display a letter in smartform in different customer languages?
Thanks,
Abaper.Persis,
if the language parameter, be it a flag or sy-langu is passed to the Smartform, then u can have different variables for the same text carrying the same word in different languages. Based on the language parameter, u can use conditions in ur Smartform to display the correct word depending on the language. Hope u clear...
Reward if helpful,
Karthik -
Hello Experts, i have issue with mime repository image with different languages ?
Good day !
I was facing the issue with images : we are creating the images by using CSS tool to generate a button. that image type is .png , this images we are importing into webdyunpro component as a mime object.
These images are binided into button image source property. And i am writing the code for calling this button (this is uniq code for all languages).
But all langaues are working fine for spanish(ES) langage only it was not displaying the image. it is displyind cross mark.
Naming standard i ma mainintg for mime object name : Export_ES.png.(spanish).
Please can any one help me on this .
Regards,
VenuHi Kiran,
Thanks for your Promt reply.
1. i am creating different images for different languages.
ex : english : Export_EN.png
Spanish : Export_ES.png
Code will be : here i am creating attribute and bing that attribute to button image source.
me ->get_button_img
EXPORTING
im_button_id = 'Export'
im_button_value = 'IMG_EXPORT'
im_type = '.png'
CHANGING
ch_context_ele = lo_el_images.
'IMG_EXPORT' : attribute name
method : get_button_img
DATA: lv_img_name TYPE string,
lv_lang TYPE string.
* lv_jpg(4) TYPE c VALUE '.jpg'.
lv_lang = sy-langu .
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = lv_lang
IMPORTING
output = lv_lang.
CONCATENATE im_button_id '_' lv_lang IM_TYPE INTO lv_img_name.
CALL METHOD CH_CONTEXT_ELE->set_attribute
EXPORTING
value = lv_img_name
name = im_button_value.
here lv_img_name : Export_ES.png.
But its not working.
thank you -
DATA UPLOAD into 5 Different Internal Tables !!!
Hi ABAPers,
I have data in 5 different TABS of an Excel Sheet.
I have to UPLOAD this data in these different TABS to 5 different Internal tables.
Can any one give me a solution to this ???take data from all internal tabels into final internal table.....and proceed in below way......
fill ur inetnal table and call call the below form DOWNLOAD_TO_EXCEL, This Form is displaying an internal table it_outtab
Move data from it_outtab to it_excel
it_excel will contain all the charecter fields
DATA : BEGIN OF IT_EXCEL OCCURS 0,
FLD1(32),
FLD2(32),
FLD3(32),
FLD4(32),
FLD5(32),
FLD6(32),
FLD7(32),
FLD8(32),
FLD9(32),
FLD10(32),
FLD11(32),
FLD12(32),
FLD13(32),
FLD14(32),
FLD15(32),
FLD16(32),
FLD17(32),
FLD18(32),
FLD19(32),
FLD20(32),
FLD21(32),
END OF IT_EXCEL.
FORM DOWNLOAD_TO_EXCEL.
PERFORM GET_FILE_NAME .
CLEAR IT_EXCEL.
REFRESH IT_EXCEL.
IF NOT FNAME IS INITIAL .
PERFORM POPULATE_HEADER_DETAIL.
LOOP AT IT_OUTTAB.
IT_EXCEL-FLD1 = IT_OUTTAB-BANFN.
IT_EXCEL-FLD2 = IT_OUTTAB-BNFPO.
IT_EXCEL-FLD3 = IT_OUTTAB-EBELN.
IT_EXCEL-FLD4 = IT_OUTTAB-EBELP.
IT_EXCEL-FLD5 = IT_OUTTAB-STYLE.
IT_EXCEL-FLD6 = IT_OUTTAB-SKU.
IT_EXCEL-FLD7 = IT_OUTTAB-LP_COLOR.
IT_EXCEL-FLD8 = IT_OUTTAB-MAKTX.
IT_EXCEL-FLD9 = IT_OUTTAB-CURR_PRICE.
IF NOT IT_OUTTAB-VALID_FROM IS INITIAL.
CONCATENATE IT_OUTTAB-VALID_FROM+4(2) '/'
IT_OUTTAB-VALID_FROM+6(2) '/'
IT_OUTTAB-VALID_FROM(4) INTO IT_EXCEL-FLD10.
ENDIF.
IF NOT IT_OUTTAB-VALID_TO IS INITIAL.
CONCATENATE IT_OUTTAB-VALID_TO+4(2) '/'
IT_OUTTAB-VALID_TO+6(2) '/'
IT_OUTTAB-VALID_TO(4) INTO IT_EXCEL-FLD11.
ENDIF.
IT_EXCEL-FLD12 = IT_OUTTAB-FUT_PRICE.
IT_EXCEL-FLD13 = IT_OUTTAB-FAC_PRICE.
IF NOT IT_OUTTAB-FAC_VALID_FROM IS INITIAL.
CONCATENATE IT_OUTTAB-FAC_VALID_FROM+4(2) '/'
IT_OUTTAB-FAC_VALID_FROM+6(2) '/'
IT_OUTTAB-FAC_VALID_FROM(4) INTO IT_EXCEL-FLD14.
ENDIF.
IF NOT IT_OUTTAB-FAC_VALID_TO IS INITIAL.
CONCATENATE IT_OUTTAB-FAC_VALID_TO+4(2) '/'
IT_OUTTAB-FAC_VALID_TO+6(2) '/'
IT_OUTTAB-FAC_VALID_TO(4) INTO IT_EXCEL-FLD15.
ENDIF.
IT_EXCEL-FLD16 = IT_OUTTAB-JPN_PRICE.
IT_EXCEL-FLD17 = IT_OUTTAB-EAN11_1.
IT_EXCEL-FLD18 = IT_OUTTAB-EAN11_2.
IT_EXCEL-FLD19 = IT_OUTTAB-HANG_TAG_STAT.
IT_EXCEL-FLD20 = IT_OUTTAB-LABEL_STAT.
IT_EXCEL-FLD21 = IT_OUTTAB-CJI_STAT.
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
ENDLOOP.
CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
EXPORTING
CHECK_VERSION = ' '
DATA_NAME = FNAME
DATA_PATH_FLAG = ''
DATA_TYPE = 'DAT'
DATA_BIN_FILE_SIZE =
MACRO_NAME = ' '
MACRO_PATH_FLAG = 'E'
FORCE_START = ' '
WAIT = ''
IMPORTING
WINID =
TABLES
DATA_TAB = IT_EXCEL
EXCEPTIONS
NO_BATCH = 1
EXCEL_NOT_INSTALLED = 2
WRONG_VERSION = 3
INTERNAL_ERROR = 4
INVALID_TYPE = 5
CANCELLED = 6
DOWNLOAD_ERROR = 7
OTHERS = 8
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 .
ENDFORM. " DOWNLOAD_TO_EXCEL
FORM GET_FILE_NAME.
DATA: TMP_FILENAME LIKE RLGRAP-FILENAME,
GLOBAL_FILEMASK_ALL(80),
GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20),
GLOBAL_DOWNLOAD_PATH LIKE RLGRAP-FILENAME,
DEF_PATH LIKE RLGRAP-FILENAME,
FIELDLN TYPE I,
MODE TYPE C,
TMP_MASK LIKE GLOBAL_FILEMASK_ALL.
FIELD-SYMBOLS: .
IF GLOBAL_FILEMASK_MASK IS INITIAL.
TMP_MASK = ',.,..'.
ELSE.
TMP_MASK = ','.
WRITE GLOBAL_FILEMASK_TEXT TO TMP_MASK+1.
WRITE ',' TO TMP_MASK+21.
WRITE GLOBAL_FILEMASK_MASK TO TMP_MASK+22.
WRITE '.' TO TMP_MASK+42.
CONDENSE TMP_MASK NO-GAPS.
ENDIF.
IF NOT GLOBAL_FILEMASK_ALL IS INITIAL.
TMP_MASK = GLOBAL_FILEMASK_ALL.
ENDIF.
FIELDLN = STRLEN( DEF_PATH ) - 1.
ASSIGN DEF_PATH+FIELDLN(1) TO .
ENDIF.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = FNAME "rlgrap-filename
DEF_PATH = DEF_PATH
MASK = TMP_MASK
MODE = MODE
TITLE = ' '
IMPORTING
FILENAME = FNAME
RC =
EXCEPTIONS
INV_WINSYS = 01
NO_BATCH = 02
SELECTION_CANCEL = 03
SELECTION_ERROR = 04.
IF SY-SUBRC = 0.
FNAME = TMP_FILENAME.
ELSE.
ENDIF.
ENDFORM. " GET_FILE_NAME
FORM POPULATE_HEADER_DETAIL.
IT_EXCEL-FLD8 = 'S U D H E E R'.
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
IT_EXCEL-FLD1 = 'Price Validation Report'.
IT_EXCEL-FLD14 = 'Page'.
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
IT_EXCEL-FLD1 = 'Vendor Number/Name'.
IT_EXCEL-FLD3 = 'Plan Month'.
IT_EXCEL-FLD4 = 'Effective In-store-Date'.
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
IT_EXCEL-FLD1 = VENDOR_NAME.
IT_EXCEL-FLD3 = P_BEDNR.
IT_EXCEL-FLD4 = P_EFF_DT.
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
sudheer start
APPEND IT_EXCEL.
IT_EXCEL-FLD1 = 'PR'.
IT_EXCEL-FLD2 = 'Line'.
IT_EXCEL-FLD3 = 'PO'.
IT_EXCEL-FLD4 = 'PO Line'.
IT_EXCEL-FLD5 = 'Style'.
IT_EXCEL-FLD6 = 'SKU'.
IT_EXCEL-FLD7 = 'Long Color'.
IT_EXCEL-FLD8 = 'Material Description'.
IT_EXCEL-FLD9 = 'Current Price'.
IT_EXCEL-FLD10 = 'validity'.
IT_EXCEL-FLD11 = 'Period'.
IT_EXCEL-FLD12 = 'Future Price'.
IT_EXCEL-FLD13 = 'Factory Price'.
IT_EXCEL-FLD14 = 'Validity'.
IT_EXCEL-FLD15 = 'Period'.
IT_EXCEL-FLD16 = 'Japan Price'.
IT_EXCEL-FLD17 = 'First UPC'.
IT_EXCEL-FLD18 = 'Factory UPC'.
IT_EXCEL-FLD19 = 'Hang Tag Status'.
IT_EXCEL-FLD20 = 'Label Status'.
IT_EXCEL-FLD21 = 'CJI Label Status'.
*sudheer end
APPEND IT_EXCEL.
CLEAR IT_EXCEL.
ENDFORM. " POPULATE_HEADER_DETAIL
Check these links for sample code :
http://www.sapdevelopment.co.uk/ms/ms_excel.htm
please check this example:
FORM download.
DATA: lh_file1 TYPE rlgrap-filename,
lh_file2 TYPE rlgrap-filename,
lh_file3 TYPE rlgrap-filename,
lh_datda(1).
CLEAR: lh_file1, lh_file2, lh_file3.
Download neue Daten
CONCATENATE xh_pfad 'Datafile materialmaster new ' sy-datum(4)
sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file1.
working area
DATA: index TYPE i,
lh_col TYPE i.
FIELD-SYMBOLS: .
SORT xt_bmm00 BY matnr.
SORT xt_bmmh1 BY matnr.
SORT xt_bmmh4 BY matnr.
SORT xt_bmmh7 BY matnr.
IF NOT xt_bmm00[] IS INITIAL.
MOVE 'X' TO lh_datda.
DO 4 TIMES.
CASE sy-index.
WHEN 1.
CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF lh_excel 'Visible' = 1 .
GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
GET PROPERTY OF lh_workbooks 'Application' = lh_application .
SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Item' = lh_sheet
EXPORTING #1 = sy-index .
SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S005'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_bmmh7.
index = sy-tabix + 1.
DO 4 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh7 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
WHEN 2.
GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
SET PROPERTY OF lh_newsheet 'Name' = 'BMMH4'.
CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
EXPORTING #1 = 'BMMH4'.
CALL METHOD OF lh_activesheet 'Activate' .
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S004'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_bmmh4.
index = sy-tabix + 1.
DO 4 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh4 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
WHEN 3.
GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
EXPORTING #1 = 'BMMH1'.
CALL METHOD OF lh_activesheet 'Activate' .
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S003'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
Überschrift gebraucht wird.
IF xt_ftab-fieldname = 'SPIRIDON'.
MOVE 'ZZSSN' TO xt_ftab-fieldname.
ENDIF.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_bmmh1.
index = sy-tabix + 1.
DO 72 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh1 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
WHEN 4.
GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
SET PROPERTY OF lh_newsheet 'Name' = 'BMM00'.
CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
EXPORTING #1 = 'BMM00'.
CALL METHOD OF lh_activesheet 'Activate' .
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S002'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_bmm00.
index = sy-tabix + 1.
DO 21 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmm00 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
ENDCASE.
ENDDO.
CALL METHOD OF lh_workbook 'SAVEAS'
EXPORTING #1 = lh_file1.
CALL METHOD OF lh_excel 'QUIT'.
FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
lh_workbook, lh_workbooks, lh_excel,
lh_chart, lh_activesheet.
ENDIF.
Download geänderter Materialstammdaten
CONCATENATE xh_pfad 'Datafile materialmaster change ' sy-datum(4)
sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file2.
IF NOT xt_emmh1[] IS INITIAL.
MOVE 'X' TO lh_datda.
DO 2 TIMES.
CALL METHOD OF lh_sheets 'Item' = lh_sheet
EXPORTING #1 = sy-index .
CASE sy-index.
WHEN 1.
CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF lh_excel 'Visible' = 1 .
GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
GET PROPERTY OF lh_workbooks 'Application' = lh_application .
SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Item' = lh_sheet
EXPORTING #1 = sy-index .
SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S005'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_emmh7.
index = sy-tabix + 1.
DO 4 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh7 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
WHEN 2.
GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
EXPORTING #1 = 'BMMH1'.
CALL METHOD OF lh_activesheet 'Activate' .
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S003'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
Überschrift gebraucht wird.
IF xt_ftab-fieldname = 'SPIRIDON'.
MOVE 'ZZSSN' TO xt_ftab-fieldname.
ENDIF.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_emmh1.
index = sy-tabix + 1.
DO 72 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh1 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
ENDCASE.
ENDDO.
CALL METHOD OF lh_workbook 'SAVEAS'
EXPORTING #1 = lh_file2.
CALL METHOD OF lh_excel 'QUIT'.
FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
lh_workbook, lh_workbooks, lh_excel,
lh_chart, lh_activesheet.
ENDIF.
Download geänderter Texte
CONCATENATE xh_pfad 'Datafile materialmaster change PO ' sy-datum(4)
sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file3.
IF NOT xt_tmmh7[] IS INITIAL.
CLEAR: lh_cells, lh_sheet, lh_sheets, lh_application,
lh_workbook, lh_workbooks, lh_excel,
lh_chart, lh_activesheet.
MOVE 'X' TO lh_datda.
CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
SET PROPERTY OF lh_excel 'Visible' = 1 .
GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
GET PROPERTY OF lh_workbooks 'Application' = lh_application .
SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
CALL METHOD OF lh_sheets 'Item' = lh_sheet
EXPORTING #1 = 1 .
SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
Überschrift erstellen
CLEAR xt_ftab.
REFRESH xt_ftab.
CALL FUNCTION 'GET_FIELDTAB'
EXPORTING
langu = sy-langu
tabname = '/SIE/TS_MM01S005'
withtext = ' '
only = 'T'
TABLES
fieldtab = xt_ftab
EXCEPTIONS
OTHERS = 1.
CLEAR lh_col.
LOOP AT xt_ftab.
ADD 1 TO lh_col.
PERFORM fill_cell
USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
ENDLOOP.
LOOP AT xt_tmmh7.
index = sy-tabix + 1.
DO 4 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE xt_tmmh7 TO lh_excel lh_cells.
ENDIF.
ENDDO.
ENDLOOP.
CALL METHOD OF lh_workbook 'SAVEAS'
EXPORTING #1 = lh_file3.
CALL METHOD OF lh_excel 'QUIT'.
FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
lh_workbook, lh_workbooks, lh_excel,
lh_chart, lh_activesheet.
ENDIF.
IF lh_datda NE 'X'.
MESSAGE i016.
ENDIF.
ENDFORM. " download
FORM fill_cell USING p_i
value
p_customer_cell1
h_excel
h_cells.
CALL METHOD OF h_excel 'Cells' = h_cells EXPORTING #1 = p_i #2 = value.
SET PROPERTY OF lh_cells 'Numberformat' = '@'.
SET PROPERTY OF h_cells 'Value' = p_customer_cell1.
ENDFORM. " fill_cell -
Adobe: How to print the documents more than once with different data.
Hi Experts,
I have a requirement to print the document of minimum 5 employee's at a time.
First we are displaying the list of employee's and then the user is provided an option to select the employee's and print their details.
A form has been created. We are able to print the document for a single employee. But now the requirement is to select multiple employee's and print their details at one time.
I am able to get the contents all the employee's in an internal table. But i am not getting to combine the contents together and print the document.
So could some one help me how to get the contents of all the selected employee's and print the document's.
Thanks.I don't understand whether you want to print several different documents in a row each with an employee or one pdf document with several employees in it.
If you want to print one document with multiple employees inside, then you have to recode your PDF to be able to handle a table containing each employee data.
If you want to print multiple pdf documents each containing one employee info, then this is done in abap. [see BC480]
i.e.
DATA:
gt_customers TYPE TABLE OF scustom,
gs_customer LIKE LINE OF gt_customers,
gt_bookings TYPE ty_bookings, "table of sbook
gt_sums TYPE flprice_t,
gv_image_url TYPE string,
gv_fm_name TYPE rs38l_fnam,
* parameters for calling the generated function module
gs_docparams TYPE sfpdocparams,
gs_outputparams TYPE sfpoutputparams,
Event START-OF-SELECTION:
* Please note that the error handling implemented here is very
* rudimentary!
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Get name of the generated function module
TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = pa_form
IMPORTING
e_funcname = gv_fm_name.
CATCH cx_root.
MESSAGE e004 WITH pa_form.
* No active form &1 available
ENDTRY.
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Optional: Set output parameters
gs_outputparams-nodialog = space.
gs_outputparams-preview = 'X'.
gs_outputparams-dest = pa_prnt.
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Open print job
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = gs_outputparams
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e020.
* Form processing could not be started
ENDIF.
LOOP AT gt_customers INTO gs_customer.
* Set form language and country (->form locale)
gs_docparams-langu = pa_lang.
gs_docparams-country = pa_cntry.
PERFORM find_bookings_for_customer.
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Now call the generated function module
CALL FUNCTION gv_fm_name
EXPORTING
/1bcdwb/docparams = gs_docparams
is_customer = gs_customer
it_bookings = gt_bookings
it_sums = gt_sums
iv_image_url = gv_image_url
iv_sending_country = pa_cntry
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e021.
ENDIF.
ENDLOOP.
*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
* Close spool job
CALL FUNCTION 'FP_JOB_CLOSE'.
In the above pay attention to the loop.
Cheers,
Maybe you are looking for
-
Please can someone help me get my itunes in shape? I started off with an iPod a couple of years ago to which i set up an iTunes account on my home computer. I thought that i could open itunes on any computer, so i opened itunes on my work computer to
-
How to include a customer FM in FQEVENTS in the right sequence order?
Hi everybody, I am trying to include a new function module for event 1788 in tcode FQEVENTS. The default fm is FKK_SAMPLE_1788_B. I still want this one to be in place, I don't want to replace it. What I need is to program a ZFKK_SAMPLE_1788_A to do s
-
Can you download a movie from a dvd
can you download a movie from a DVD like you can with music from a CD? Or do oyu have to buy a movie from Itunes?
-
Error while importing idocs in IR
This is the error when I try to import Idocs in IR. "Unable to establish connection to R/3 system FR3 (client=850) Troubleshooting tips: Is the target system online? Check the connection data (note that server names and groups are case-sensitive) Tip
-
How to retrieve Notes in background that were created by GOS?
Hello all - I have Notes that were created for DIRs in the GUI (CV02N) using Services for Objects (GOS). I need to retrieve these notes in background. Has anybody done this? (I've read Ram Manohar Tiwari's blog Generic object services (GOS) - In Ba