Problem using function module for infotype 21
hi
im uploading the infotype 21 (family details) through function module hr_infotype_operations. i found that infotype 0106 (family/related person)
is a secondary infotype and that a record is created for 0106 ,everytime you create a record in 21. so i upload the family data of an employee using the function module for infotype 21 initially. and then fetch the same record from the table pa0106 and modify the same record with other information.
for example : u have the address details of a dependent(father subtype 11) in infotype 21. this address data is stored in the table pa0106 . im not able to modify the record for infotype 0106 using the function module 0106.
i would like to know the reason for the same. Is it because that infotype 0106 is a secondary infotype and u cannot modify the record using the fn module..?/
thanks
sridharan
Hi Sir,
I am also facing the same issue...i need to update dependents Information Date Of Birth n Perid(Which is stored in IT0106)...in IT 0021..
Kindly correct my code....
I am using the following code for this...
data: w_return type bapireturn1.
data: p0021_struc TYPE p0021,
p0106_struc TYPE p0106,
p_pskey TYPE pskey.
start-of-selection.
get pernr.
p0021_struc = p0021.
p0021_struc-favor = 'Gaurav'.
p0021_struc-fgbdt = '05/10/1955'.
Move p0021_struc-favor to p0021-favor.
p0106_struc = p0106.
p0106_struc-stras = '2235 BOmbay Road'.
p0106_struc-perid = '123456789'.
MOVE p0106_struc-stras to p0106-stras.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_ENQUEUE'
exporting
number = pernr-pernr
importing
return = w_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_pskey-infty
number = p_pskey-pernr
subtype = p_pskey-subty
objectid = p_pskey-objps
lockindicator = p_pskey-sprps
validityend = p0021-endda " '99991231'
validitybegin = p0021-begda
record = p0021_struc
operation = 'mod'
tclas = 'A'
dialog_mode = '2'
nocommit = p_test
VIEW_IDENTIFIER = '07' "p0003-viekn
secondary_record = p0106_struc
IMPORTING
return = w_return
key = familykey
EXCEPTIONS
OTHERS = 0.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_DEQUEUE'
exporting
number = pernr-pernr
importing
return = w_return.
Similar Messages
-
Presently used function module for obsoleted FM
hi,
what is the presently used fuction module for obsoleted function module
ws_filenames_get.Hi,
Use the class <b>CL_GUI_FRONTEND_SERVICES</b>
Check this thread for detail information.
Re: WS_FILENAME_GET is obsolete - what do I use instead ?
Regards,
Maha -
Problem using Function Module IDOC_INBOUND_ASYNCHRONOUS
Hi friends,
I have a critical problem load idoc ARTMAS05. I development a program for load the data with idoc but my program call the function module IDOC_INBOUND_ASYNCHRONOUS close my session of the SAP GUI and lose the load. This problem begining today because yesterday was work well. This morning when I'm load the idoc gave to me a short dump with this message "SNAP_NO_NEW_ENTRY" I have find some notes and obtained this note 17537.
Note Solution
Solution
When the SNAP Table is full: Reorganize the table e.g. via Transaction ST22->Go to->Reorganize. Please also refer to Note 16083. This may lead to other errors of this kind since not all dumps e.g. from SM21 can be displayed.
In case of database problems, the errors should no longer occur with new short dumps after correcting the database error. Here, other errors of this kind may occur in SM21 as well.
After apply the correction begin the error that I close me the Session of SapGui and lose all my data proccessing. Please need your help.
Thank and regards..Hi Sir,
I am also facing the same issue...i need to update dependents Information Date Of Birth n Perid(Which is stored in IT0106)...in IT 0021..
Kindly correct my code....
I am using the following code for this...
data: w_return type bapireturn1.
data: p0021_struc TYPE p0021,
p0106_struc TYPE p0106,
p_pskey TYPE pskey.
start-of-selection.
get pernr.
p0021_struc = p0021.
p0021_struc-favor = 'Gaurav'.
p0021_struc-fgbdt = '05/10/1955'.
Move p0021_struc-favor to p0021-favor.
p0106_struc = p0106.
p0106_struc-stras = '2235 BOmbay Road'.
p0106_struc-perid = '123456789'.
MOVE p0106_struc-stras to p0106-stras.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_ENQUEUE'
exporting
number = pernr-pernr
importing
return = w_return.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = p_pskey-infty
number = p_pskey-pernr
subtype = p_pskey-subty
objectid = p_pskey-objps
lockindicator = p_pskey-sprps
validityend = p0021-endda " '99991231'
validitybegin = p0021-begda
record = p0021_struc
operation = 'mod'
tclas = 'A'
dialog_mode = '2'
nocommit = p_test
VIEW_IDENTIFIER = '07' "p0003-viekn
secondary_record = p0106_struc
IMPORTING
return = w_return
key = familykey
EXCEPTIONS
OTHERS = 0.
Enqueue personnel number
call function 'BAPI_EMPLOYEE_DEQUEUE'
exporting
number = pernr-pernr
importing
return = w_return. -
Hi,
I am using RH_STRUC_GET with evalPath O-O-S-P and get the or g structure. I then loop through the table obtained from RH_STRUC_GET and re-use RH_STRUC_GET with a evaluation path 'bossonly' to find out who the managers are. But it does not work. I get No ROOTS FOUND error.
When I try the function module RH_STRUC_GET separately with the same input fields then it works!!!
Please let me know if I am doing anything wrong. My code is shown below....
FUNCTION Z_ORGBUILDER_CONN.
""Local interface:
*" IMPORTING
*" VALUE(OTYPE) LIKE OBJEC-OTYPE
*" VALUE(OBJID) LIKE OBJEC-OBJID
*" VALUE(PATHID) LIKE GDSTR-WEGID
*" VALUE(PLVAR) LIKE OBJEC-PLVAR
*" EXPORTING
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" L_ZCONN_TAB TYPE ZCONN_TAB
*" RESULT_TAB STRUCTURE SWHACTOR OPTIONAL
*" RESULT_OBJEC STRUCTURE OBJEC OPTIONAL
*" RESULT_STRUC STRUCTURE STRUC OPTIONAL
*" L_ZCONN_ORG TYPE ZCONN_TAB
*" L_ZCONN_POS_HOLDER TYPE ZCONN_POS_TAB
*" L_MANAGERS STRUCTURE OBJEC
DATA: z_struc type zconn_struc.
DATA: xresult_struc like result_struc.
DATA: yresult_struc like result_struc.
DATA: z_struc1 type zconn_struc.
DATA: z_struc_pos type zconn_position.
DATA: temp_tab LIKE SWHACTOR occurs 0 with HEADER LINE.
DATA: temp like struc-objid.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = otype
act_objid = objid
act_plvar = plvar
act_wegid = pathid
TABLES
result_tab = result_tab
result_struc = result_struc
result_objec = result_objec
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE no_roots_found.
ENDIF.
LOOP AT result_struc into xresult_struc.
read table result_struc into yresult_struc with key seqnr =
xresult_struc-pup.
if sy-subrc = 0.
z_struc-objectID = xresult_struc-OBJID.
z_struc-objectType = xresult_struc-otype.
z_struc-parentID = yresult_struc-objid.
z_struc-parentType = yresult_struc-otype.
endif.
Append z_struc to l_zconn_tab.
ENDLOOP.
LOOP AT l_zconn_tab.
if l_zconn_tab-objectType = 'O' or l_zconn_tab-objectType = 'S'.
z_struc1-objectID = l_zconn_tab-objectID.
z_struc1-objectType = l_zconn_tab-objectType.
z_struc1-parentID = l_zconn_tab-parentID.
z_struc1-parentType = l_zconn_tab-parentType.
Append z_struc1 to l_zconn_org.
endif.
ENDLOOP.
LOOP AT l_zconn_tab.
if l_zconn_tab-objectType = 'P'.
z_struc_pos-position = l_zconn_tab-parentID.
z_struc_pos-pos_holder = l_zconn_tab-objectID.
Append z_struc_pos to l_zconn_pos_holder.
endif.
ENDLOOP.
loop at result_struc.
if result_struc-otype = 'O'.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'O'
act_objid = result_struc-objid
act_plvar = '01'
act_wegid = 'bossonly'
TABLES
result_tab = temp_tab
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE no_roots_found.
ENDIF.
APPEND LINES OF temp_tab to L_managers.
endif.
endloop.
ENDFUNCTION.data: begin of itab occurs 0,
orgunit(10) type c,
mananger(30) type c,
end of itab.
* This will add a record to your itab
loop at result.
itab-orgunit = result-orgunit. " I don't know what fields they are
itab-manager = result-manager.
append itab.
endloop.
Please remember to award points for helpful answers and mark this post as solved if you question has been answered. Thanks.
Regards,
Rich Heilman -
Problem in function module for expand in tree display
hi all,
i have found a function module which can expand all nodes of the tree.
it is TREEV_EXPAND_ROOT_NODES.
CALL FUNCTION 'TREEV_EXPAND_ROOT_NODES' "Expands all Root Nodes
EXPORTING
handle = " cntl_handle Handle for Tree Control
level_count = " i Number of Levels to be Expanded
expand_all_children = " c
no_flush = " c
EXCEPTIONS
FAILED = 1 " General Error
ILLEGAL_LEVEL_COUNT = 2 . " LEVEL_COUNT Must Be GE 0
for above function call what value should i give for "handle parameter".
thanks.Hi,
Please pass the value as below with minor changes as per your requirement.
DATA: tree TYPE cntl_handle,
DATA: TREE_HANDLE TYPE CNTL_HANDLE.
data: local_rep like sy-repid,
local_scr like sy-dynnr.
constants: dynpro_default type i value -1.
data: node_table type node_table_type,
constants : TREEV_NODE_SEL_MODE_SINGLE TYPE I VALUE 0,
call function 'TREEV_CREATE_SIMPLE_TREE'
exporting
owner_repid = local_rep
dynnr = local_scr
left = 0
top = 0
width = 45
height = 22
no_flush = space
shellstyle = style
parentid = dynpro_default
node_selection_mode = treev_node_sel_mode_single
node_table_structure_name = 'MTREESNODE'
tables
node_table = node_table
changing
handle = tree_handle
exceptions
create_error = 1
tree_control_not_existing = 2
cntl_system_error = 3
failed = 4
illegal_node_selection_mode = 5
missing_node_structure_name = 6
error_in_node_table = 7
dp_error = 8
illegal_owner_repid = 9
table_structure_name_not_found = 10
others = 11.
if sy-subrc <> 0.
message e645 with text-745 sy-subrc.
endif.
call function 'TREEV_EXPAND_ROOT_NODES'
exporting
handle = tree_handle
level_count = 2
expand_all_children = 'X'
no_flush = ' '
exceptions
failed = 1
illegal_level_count = 2
cntl_system_error = 3
others = 4.
if sy-subrc <> 0.
message e645 with text-743 sy-subrc.
endif.
If it is helpfull means reward me with some points.
Regards
Chitra -
Useful function module for get month
Dear experts,
I need some FM to realise some functions :
1, get the month and year from system date
2, get the month by adding or subtracting from a given month ex: month(system date) - 11
Moderator message: date conversion questions = FAQ, please search (harder) before asking.
Edited by: Thomas Zloch on Nov 7, 2010 9:24 PMHi
I think you can find out the answer if you look for it in SDN forum: have you tried?
Max -
Delta Problem while extracting the data by using function module
Hi Experts,
I have extracted the data by using Function module, for delta loads I have given Calday and additive delta in Generic delta settings, in BW side I have initialized the data after that I have given delta update option in infopackage and I made process chain also, every day process chain is running successfully but it is showing zero records, but there is a data in Data source (RSA3), means delta is not working.
What is the problem,
Is there any another settings for delta loads,
Please help me to do this,
Helpful answer will be appreciated with points,
Regards,
VenkatHi,
Try this delta type :NEW STATUS FOR CHANGED RECORDS.
More information from Nagesh, this information may help
1. New status for changed Records.
2. Additive delta.
New status for changed records means
New Order
order no quantity
1000 10
order changed to quntity 8. then 2 records will posted 2 BW in first case.
1000 -10
1000 8
if you come to Additve delta.
for the same case it will send the same record as
1000 10
changed records
1000 -2
this is the difference. New status with changed records should be used only in association with ODS not cube becoz we don't have overwrite option.
Additive delta we can use for ODS and Cubes with update mode Addition.
Regards,
Satya -
Function module for access OM Data from infotype 1001
We had a function module for accessing OM data viz. Infotype 1001. Could you let me know.
Advanced thanks,
Dasaradh kosanaHi Dasaradh,
Do you want the fm which fetches the data from HRP1001 , if this is the case you can use this FM RH_READ_INFTY_1001.
Reward Points if it is helpful
Regards,
Kiran I -
Code For Delta Extraction Using Function Module
Dear Experts,
I want a sample code for Delta Extraction using Function Module ( If it is customized already working code very helpful ), I have already created Function Module but Full update is happening. If I give delta update again it is retrieving all records. It is very urgent, if you have please send me to the following mail ID.
[email protected]
Best Regards,
SGK.Dear KJ,
Thank for your response. I saw the code that you sent, you have used some ztables like ZSC_DELTA_IP, ZSC_SAFETY_DELTA, ZSC_SET_EXT_TIME
What are the fields that you have created in these tables , what is use of these tables, can you send the fields that you have used in these tables.
Thanks & Regards,
SGK -
Creating the bussiness roles for the bussiness partner using Function modul
Hi
How to create the business roles using the function modules for the Business partner.You can also assign the role at the time of creation of the business partner itself. Use the function module BAPI_BUPA_FS_CREATE_FROM_DATA to achieve the same.
If your business partner is already there then you can use the function module BAPI_BUPA_ROLE_ADD.
<b>Reward points if it helps.</b> -
Insert record in infotype 0581 using function module
Hello experts,
I am using function module HR_INFOTYPE_OPERATION to insert a record in infotype 0581, but its giving exception CX_HRPA_INVALID_INFOTYPE. This infotype is time constraint 1.So how can i handle this.
Reply will be really helpful <removed by moderator>.
Edited by: S Harshit on Feb 17, 2012 6:49 AM
Edited by: Thomas Zloch on Feb 17, 2012Hi Mallikarjuna,
I am trying to pass the rent amount, but unable to, here is the code.
TYPES: BEGIN OF IT_P0581.
INCLUDE STRUCTURE P0581.
TYPES END OF IT_P0581.
DATA: INFTYKEY LIKE BAPIPAKEY,
RETURN LIKE BAPIRETURN1.
DATA: P0581_TAB TYPE TABLE OF IT_P0581 WITH HEADER LINE.
P0581_TAB-PERNR = 01400038.
P0581_TAB-INFTY = '0581'.
P0581_TAB-BEGDA = '20111010'.
P0581_TAB-ENDDA = '99991231'.
P0581_TAB-RTAMT = 3000 .
append P0581_TAB.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = P0581_TAB-INFTY
NUMBER = P0581_TAB-PERNR
SUBTYPE = ''
VALIDITYEND = P0581_TAB-ENDDA
VALIDITYBEGIN = P0581_TAB-BEGDA
RECORD = P0581_TAB
OPERATION = 'INS'
NOCOMMIT = ''
RECORDNUMBER = '000'
DIALOG_MODE = '2'
IMPORTING
RETURN = RETURN
KEY = INFTYKEY
EXCEPTIONS
OTHERS = 0. -
Problem in getting public holiday class using function module
Hi to all
I am using function module
HR_PERSON_READ_WORK_SCHEDULE.
for getting the employee's actual work schedule and public holiday class FTKLA.
But I am unable to get the correct public holiday class.
Please guide me.
How to do that.
Regards
AnubhavHi,
form build_work_schedule tables b_psp structure pdpsp
b_day_psp structure pdsppsp
b_employees structure pdpnr
using value(b_begda) like sy-datum
value(b_endda) like sy-datum
value(b_read_db) type c.
data: counter type i. "Note 495298
call function 'HR_PERSON_READ_WORK_SCHEDULE'
exporting
begin_date = b_begda
end_date = b_endda
grouping_dws = motpr "VEX Modif
grouping_attendence = moabw
grouping_substitute = mover
read_from_database = b_read_db
im_read_no_locked_records = 'X' "803380
tables
pernr_tab = b_employees
psp = b_psp
day_psp = b_day_psp
exceptions
error_in_build_psp = 1
others = 2.
read table b_employees with key error = 'X'
transporting pernr.
if sy-subrc eq 0.
read table d3000_pers with key pernr = b_employees-pernr
transporting name.
if sy-subrc eq 0.
message s582 with d3000_pers-name.
else.
message s582 with b_employees-pernr.
endif.
endif.
Hope it helps you. -
Problem with Time stamp function module for converting US to Japan
Hi All,
I need standard function module for converting US Timestamp to Japan, Can any one let me know is there any standard function modules.
thanks in advance!
Regards,
Kalidas.T
Edited by: Kalidas Thirumoorthy on May 5, 2009 5:29 PM
Edited by: Kalidas Thirumoorthy on May 5, 2009 5:30 PM
Edited by: Kalidas Thirumoorthy on May 5, 2009 5:30 PMTry this way:
CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.
CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.
<tst> is of type P(8) or P(11) with 7 decimal places
<tz> of type C(6)
Refer to help.sap.com for more details. -
Problem when Saving Texts using Function Module CREATE_TEXT
Hi All,
I am using Function Module CREATE_TEXT to save text in transaction XK02.
But the first character of few lines disappears in one of (Ruled) editor while that character appears in a new line in another editor.
In debug mode, I found that value of TDFORMAT is '=' in the line in which first character disappears.
while in rest its value is '*'.
I tried hardcoding the value FFORMAT in function module CREATE_TEXT with '*'. Please suggest me solution to this.
Regards,
NibhaHI.
Refer this link.
http://www. ****************/Tutorials/ABAP/MaterialLongText/info.htm
Regards.
Jay -
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = pdf
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 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.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf INTO gd_buffer.
* ENDLOOP.
* TRANSLATE gd_buffer USING '~ '.
* DO.
* it_mess_att = gd_buffer.
* APPEND it_mess_att.
* SHIFT gd_buffer LEFT BY 255 PLACES.
* IF gd_buffer IS INITIAL.
* EXIT.
* ENDIF.
* ENDDO.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = RECLIST
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 NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop.
Maybe you are looking for
-
Incorporating a checkbox field in an internal table.
Hi all, I have an internal table itab which has the following fields: WRITE:/p_box AS CHECKBOX, itab-vbeln, itab-traid, itab-lifnr, itab-lfdat, itab-printed. But I want that ch
-
I paid for the 12 month free deal to export my files and it is not working I would like to work or get my money back.
-
When I tried to reboot, I got a file folder with a question mark
My computer froze up with the spinning wheel. I was forced to turn it off & reboot. Now all I get is a file folder with question mark in folder. What can I do?
-
I am trying to start the Weblogic Commerce Server 3.2 on NT after loading the webloic_classpath variables its suddenly dies saying --> Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server I'm using weblogic server 6.0, and my WE
-
CS4.2 - Nested Sequence bug!...
I seem to have stumbled upon a bug in Premiere CS4.2 (it is probably present in all versions of CS4) I am trying to build some professional looking transitions, but to accomplish them I am having to nest sequences (though it would be nicer if I could