Send ABAP Report as an Attachment with Workflow Function Module
Hi all.
Hopefully someone ever experienced with this requirements.
My requirements to send ABAP Report result to user as an attachment. Together with this attachment user need to receive work item/notification. Single workflow task has been defined based on SELFITEM object type to send workflow notification and its attachment.
Function module for this requirement is SWU_START_WORKFLOW. And this function module provide table parameter ATTACHMENT_LIST.
My question how to pass this ABAP report result/ ABAP internal table into this ATTACHMENT_LIST?
Thanks in advance
check the help on the SUBMIT statement ther are options to write the report to memory or spool.
Kind regards, Rob Dielemans
Similar Messages
-
Please send me some sample codes of ALVS using function modules only
Hi,
i am new to alvs
Please send me some sample codes of alvs using function modules only.
My mail id is [email protected]
Thanks & regards,
hari priyahI
http://www.sapdev.co.uk/reporting/reportinghome.htm SPECIAL FOR ALL ALV PROGRAMS WITH EXAMPLE CODES
Check the below links :
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
http://www.sap-img.com/abap-function.htm
http://www.sap-basis-abap.com/sapab034.htm
http://www.erpgenie.com/abap/example_code.htm
These all are very simple ALV programs ,good luck
<b>Reward if usefull</b> -
Problem with the function module SO_DOCUMENT_SEND_API1
Hi Friends,
I am facing the problem wiht the function module SO_DOCUMENT_SEND_API1,
My actull requirement is : - i need to send the sap data to my externa mail id (Like as XYZ@) with out the any attachment , So i have implemented the code with the function module SO_DOCUMENT_SEND_API1.
The mail has successfully sent the sap inbox (SOST) but the mail are not reached to the external mail ID'S( XYZ@GMAIL)
i Have maintained my code lines same as below.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = ca_x
commit_work = ca_x
TABLES
packing_list = tb_packing_list
contents_txt = tb_mailbody
receivers = tb_receiver.
Can you please tell me soultion ,
Thanks
charan.Hi charan,
If u r able to see the mail in sost, then i think ur code has worked fine. if the mail is not going to outside domains from sost u need to do some configurations for that, u can find lots of configuration docs regarding mail setup in sap.
once try to pass below parameter also.
t_receivers1-rec_type = 'U'.
For configuring mail setup u need to sit with ur basis guy.
Moderator message: please do not use SMS speak.
Edited by: Thomas Zloch on Nov 23, 2010 5:51 PM -
Performance problem with OLE_FLUSH_CALL function module
Hello Everyone,
I am facing problem with OLE_FLUSH_CALL function module (execution is taking long time which is going to be dump error).
Could you please help me in knowing solution for this problem?
Thanking you in advance.
SrinivasHi Srinivas,
the OLE_FLUSH_CALL does an RFC from ABAP backend to frontend UI. So high execution time could result from high network time, for example latency between UI and backend server.
How many UI interaction steps did you measure for the trace above? Ideally, there should only be one OLE_FLUSH_CALL per user interaction step. If its more, the application is not written in an optimized way.
Best Regards, Randolf -
Issue with gui_download function module
Hi All,
I have an issue with gui_download function module that it is creating one extra line while downloading my internal table data into text file,which i donot want.i have searched for various threads but couldnot get the proper reply.Or please provide me some other Function Module which will not create one extra line.Please help.part 2
INCLUDE RPPPXD00.
DATA : BEGIN OF COMMON PART A.
INCLUDE RPPPXD10.
DATA : END OF COMMON PART.
INCLUDE PC2RXTW0.
INCLUDE RPC2RX00.
DATA : BEGIN OF COMMON PART B.
INCLUDE RPC2CD00.
DATA : END OF COMMON PART.
INCLUDE RPPPXM00.
INCLUDE RPCMGR00.
AT SELECTION-SCREEN OUTPUT.
CONCATENATE SY-DATUM2(6) SY-UZEIT0(4) INTO REF_NO.
LOOP AT SCREEN.
IF R1 = 'X'.
IF SCREEN-NAME = 'FLN' OR SCREEN-NAME = '%_FLN_%_APP_%-TEXT' OR
SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT' OR
SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT'"SOC BY ANKITA"
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R2 = 'X'.
IF SCREEN-NAME = 'FLN' OR SCREEN-NAME = '%_FLN_%_APP_%-TEXT' OR
SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT' OR
SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT' "SOC BY ANKITA
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R3 = 'X'.
IF SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'PY_DT' OR SCREEN-NAME = '%_PY_DT_%_APP_%-TEXT' "SOC BY ANKITA
OR SCREEN-NAME = 'ORG_ID' OR SCREEN-NAME = '%_ORG_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'ORG_AC' OR SCREEN-NAME = '%_ORG_AC_%_APP_%-TEXT'
OR SCREEN-NAME = 'REF_NO' OR SCREEN-NAME = '%_REF_NO_%_APP_%-TEXT'
OR SCREEN-NAME = 'DEPT_CD' OR SCREEN-NAME = '%_DEPT_CD_%_APP_%-TEXT'
OR SCREEN-NAME = 'PRS_BNK' OR SCREEN-NAME = '%_PRS_BNK_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_TY' OR SCREEN-NAME = '%_TRANS_TY_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_ID' OR SCREEN-NAME = '%_TRANS_ID_%_APP_%-TEXT'
OR SCREEN-NAME = 'TRANS_RK' OR SCREEN-NAME = '%_TRANS_RK_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
IF R4 = 'X'.
IF SCREEN-NAME = 'PREPBY' OR SCREEN-NAME = '%_PREPBY_%_APP_%-TEXT'"SOC BY ANKITA
OR SCREEN-NAME = 'APROBY' OR SCREEN-NAME = '%_APROBY_%_APP_%-TEXT'
OR SCREEN-NAME = 'BTC' OR SCREEN-NAME = '%_BTC_%_APP_%-TEXT'."EOC BY ANKITA
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
START-OF-SELECTION.
SELECT SINGLE * FROM T549Q WHERE PERMO = '01'
AND PABRJ = PRD+0(4)
AND PABRP = PRD+4(2).
FR_DT = T549Q-BEGDA.
TO_DT = T549Q-ENDDA.
CONCATENATE FR_DT0(4) FR_DT4(2) INTO FR_P.
CONCATENATE TO_DT0(4) TO_DT4(2) INTO TO_P.
PN-PAPER = PRD.
PN-PERMO = '01'.
GET PERNR.
RP-PROVIDE-FROM-LAST P0003 SPACE PN-BEGDA PN-ENDDA.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ 1.
SN = SN + 1.
ITAB1-SNO = SN.
ITCC-SNO = SN.
ITAB1-ENO = PERNR-PERNR.
ITAB1-NAM = PERNR-ENAME.
ELSE.
REJECT.
ENDIF.
RP-INIT-BUFFER.
RP-SEL-CALC.
CALL FUNCTION 'RP_EVALUATION_PERIODS'
EXPORTING
LAST_CALCULATED_DAY = P0003-ABRDT
LAST_DAY_IN_PERIOD = TO_DT
RETROCALCULATED_DAY = RP-SEL-CALC-RRDAT
TABLES
DIR = RGDIR
EVP = EVP
EXCEPTIONS
RGDIR_EMPTY = 1
INTERNAL_ERROR = 2
OTHERS = 3.
DESCRIBE TABLE EVP LINES LIN.
IF LIN > 0.
LOOP AT EVP.
IF EVP-IAPER = TO_P AND EVP-PAPER = TO_P.
RX-KEY-PERNR = PERNR-PERNR.
UNPACK EVP-SEQNR TO RX-KEY-SEQNO.
RP-IMP-C2-TN.
READ TABLE BT INDEX 1.
READ TABLE WPBP INDEX 1.
READ TABLE TAX INDEX 1."CHANGES BY ANKITA
ITAB1-BAC = BT-BANKN.
ITAB1-BKEY = BT-BANKL .
ITAB1-DEP = WPBP-KOSTL.
ITAB1-BETRG = BT-BETRG."CHANGES BY ANKITA
ITAB1-TAXID = TAX-TAXID."CHANGES BY ANKITA
YEAR = VERSC-PAYDT+0(4) - 11.
MONTH = VERSC-PAYDT+4(2).
DAY = VERSC-PAYDT+6(2).
CONCATENATE YEAR MONTH DAY INTO ITAB1-PDT.
ITAB1-PDT = VERSC-PAYDT - 110000.
ITCC-DEP = WPBP-KOSTL.
LOOP AT RT WHERE LGART = '/559'.
ITAB1-BTFR = RT-BETRG.
ITCC-BTFR = RT-BETRG.
IF EVP-SRTZA = 'P'.
ITAB1-BTFR = ITAB1-BTFR - RT-BETRG.
ELSE.
ITAB1-BTFR = ITAB1-BTFR + RT-BETRG.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
APPEND: ITAB1, ITCC.
CLEAR: ITAB1, ITCC.
END-OF-SELECTION.
CONCATENATE 'Prepared By:' ` ` PREPBY INTO PREPBY.
CONCATENATE 'Approved By:' ` ` APROBY INTO APROBY.
IF R1 = 'X'.
FORMAT COLOR 2.
ULINE (127).
NEW-LINE.
WRITE: 2 'Sr No.', 10 'Emp Num', 27 'Name'.
WRITE: 57 'Department'.
WRITE: 72 ' Transfer Amount' RIGHT-JUSTIFIED.
WRITE: 92 'Bank Key', 107 'Bank AC. Number'.
WRITE:1 '|', 8 '|', 25 '|', 55 '|', 70 '|', 90 '|', 105 '|', 127 '|'.
NEW-LINE.
ULINE (127).
NEW-LINE.
FORMAT COLOR OFF.
LOOP AT ITAB1.
SN = SY-TABIX.
WRITE: 2 SN, 10 ITAB1-ENO, 27 ITAB1-NAM.
WRITE: 57 ITAB1-DEP.
WRITE: 72 ITAB1-BTFR.
WRITE: 92 ITAB1-BKEY, 107 ITAB1-BAC.
WRITE: 1 '|', 8 '|', 25 '|', 55 '|', 70 '|', 90 '|', 105 '|', 127 '|'.
ULINE (127).
NEW-LINE.
ENDLOOP.
SKIP 4.
ULINE 90(32).
NEW-LINE.
WRITE: 90 PREPBY.
SKIP 4.
ULINE 90(32).
NEW-LINE.
WRITE: 90 APROBY.
ENDIF.
IF R2 = 'X'.
LOOP AT ITCC.
COLLECT ITCC INTO ITCOL.
ENDLOOP.
FORMAT COLOR 2.
ULINE (44).
NEW-LINE.
WRITE:2 'Sr No.', 9 'Department'.
WRITE: 27 'Transfer Amount ' RIGHT-JUSTIFIED.
WRITE:1 '|', 8 '|', 25 '|', 44 '|'.
NEW-LINE.
ULINE (44).
NEW-LINE.
FORMAT COLOR OFF.
LOOP AT ITCOL.
SN = SY-TABIX.
WRITE: 2 SN, 9 ITCOL-DEP, 27 ITCOL-BTFR.
WRITE:1 '|', 8 '|', 25 '|', 44 '|'.
NEW-LINE.
ULINE (44).
NEW-LINE.
ENDLOOP.
ENDIF.
IF R3 = 'X'.
LOOP AT ITAB1.
CLEAR: ITTF, P3, P11, P13, P6, V_BAC.
LEN = STRLEN( ITAB1-BKEY ).
IF LEN < 3.
CONCATENATE ITAB1-BKEY '***' INTO P3.
ELSE.
LEN = LEN - 3.
LEN = 3.
P3 = ITAB1-BKEY+LEN(3).
ENDIF.
CLEAR LEN.
V_BAC = ITAB1-BAC.
REPLACE ALL OCCURRENCES OF '-' IN ITAB1-BAC WITH ''.
CONDENSE ITAB1-BAC NO-GAPS.
LEN = STRLEN( ITAB1-BAC )."if length of acc num > limit
IF LEN > 11.
IT_FAIL-EN = ITAB1-ENO.
IT_FAIL-BA = V_BAC.
APPEND IT_FAIL.
CLEAR: IT_FAIL.
CONTINUE.
ENDIF.
P11 = ITAB1-BAC.
CONCATENATE P11 '***********' INTO P11.
above step is for putting '' in place of unfilled chars of P11.
P13 = ITAB1-BTFR * 100.
P6 = ITAB1-PDT+2(6).
CONCATENATE ` ` P3 P11 BTC P13 P6 INTO STR.
ITTF-ROW = STR.
APPEND ITTF.
ENDLOOP.
IF ITTF[] IS NOT INITIAL.
CONCATENATE FLN SY-DATUM SY-UZEIT '.txt' INTO FILEPATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = FILEPATH
FILETYPE = 'ASC'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = ITTF
OTHERS = 22
SKIP 2.
IF SY-SUBRC <> 0.
WRITE:/ 'Unable to Download file at ', FILEPATH.
ELSE.
WRITE:/ 'File with following data downloaded at ', FILEPATH.
NEW-LINE.
SKIP 2.
LOOP AT ITTF.
WRITE:/ ITTF.
ENDLOOP.
ENDIF.
ELSE.
WRITE 'No Data, no file was downloaded'.
ENDIF.
IF IT_FAIL[] IS NOT INITIAL.
SKIP 2.
FORMAT COLOR 2.
WRITE 'Acc. No. of following employees exceeded the length limit'.
WRITE:/ 'So their entry was not created in the file'.
SKIP 1.
WRITE : 'Employee Number', 20 'Bank Acc. No.'.
FORMAT COLOR OFF.
LOOP AT IT_FAIL.
NEW-LINE.
WRITE : IT_FAIL-EN, 20 IT_FAIL-BA.
ENDLOOP.
ENDIF.
ENDIF.
IF R4 = 'X'."CHANGES BY ANKITA
WRITE:/ 'ERROR LOG - BANK A/C NO. CONTAINS ALPHANUMERIC'.
WRITE:/ 'EMPID' COLOR COL_POSITIVE,12 '|',15 'Receiving Bank Code' COLOR COL_POSITIVE,
40 '|','Receiver A/C No' COLOR COL_POSITIVE.
PERFORM EXTRACT_DATA.
SKIP 2.
ENDIF."EOC
RP-READ-PAYROLL-DIR.
Edited by: ANKITA BHARDWAJ on Dec 9, 2009 10:36 AM -
Hi All,
Need some urgent help..
Iam facing some issue with the Function Module 'SKWF_FIND_BY_QUERY' in a BW ECC6.0 system.
As shown below, in the function module, the Table IT_PROPERTIES_RESULT gets populated with some values based on inputs like IT_CLASSES, IT_QUERY, and L.
This updation of IT_PROPERTIES_RESULT table is happening for some of the services sent through IT_QUERY and is not getting populated for some.
call function 'SKWF_FIND_BY_QUERY
exporting
CONNECTION_SPACE =
OBJ_TYPE = 'L'
PTYPE =
X_STRICT =
IMPORTING
ERROR =
tables
CLASSES = IT_CLASSES
QUERIES = IT_QUERY
RESULT_OBJECTS = IT_LOIO
PROPERTIES_REQUEST = PROPERTIES_RESULT = IT_PROPERTIES_RESULT.
The values are as follows:-
Values getting populated in IT_CLASSES BW_LO_TRAN Values getting populated in IT_QUERY 1) BW_QUERY, 2) /BIC/ZSERVICE
I would like to know whether any Standard Customizing BW transaction is present that is maintaining IT_PROPERTIES_RESULT table properties and fetching through this Function Module.
Also, suggest how this issue can be resolved
Thanks & Regards,
Shailesh nagarThanks Suhas. That definitely helped.
Also the following links helped.
http://help.sap.com/saphelp_nw70/helpdata/EN/86/1c8c3e94243446e10000000a114084/frameset.htm
/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
Cheers,
Preethi -
Abap object as export parameter for remote function module
Hello all,
I would like to know if there is any possibility to use an abap object as parameter within a remote function module.
Thanks in advanceNo. You can't pass the Object Reference as the Parameters of the FM which could be run as an independent object like RFC FM, Update Task FM.
If you have an object and you want to pass the data to the subsequent FM (RFC), you need to move the attributes to structures or variables before calling the FM and use these variables to pass the data to your RFC.
Regards,
Naimesh Patel -
Create new settlement rule for an order with a function module
Hi,
I would like to create a settlement rule for an order. I searched for existing function modules and found K_ORDER_SETTLEMENT_RULE, which seems to be the correct one.
The problem: The settlement rules, which I create with this function module are not saved.
Do I have to call another function module to save my new rules?
Thanks in advance,
FabianHi,
Settlement rules are first of all defined in customizing how the should be behave and secondly lies the question how to update a CO cost object with this settlement rule.
My first advice would be to use the "automatic settlement derivation feature" that can be setup in customizing alike. <b>SPRO -> Controlling -> Internal Orders -> Actual Postings -> Settlement -> Automatic generation of Settlement Rule</b>. Read the docu for this node (right click and choose Display documentation) to understand what possibilities and limitations this functionality has. Below this node you have the possibility to define a "settlement strategy" and allocate this to a order type. You can also define a Enhamcement (COOM0003
) where you can somewhat influence the automatic generation of settlement rules.
Execute transaction KO8G (collective processing) or KO88 (indicidual processing) to create a settlement rule for internal orders.
The other option you have is to create a custom program based on BDC to create settlement rule for internal orders.
I think the BDC program would be a better idea for you.
Let me know if you have any question.
Regards,
RS -
Problem with BAPI_SALESORDER_CHANGE function module
I know lot of posts have been done about problems with this function module. However I was not able to find the answer to my problem. Hence posting a new thread
I have the following code which changes the reason rejection (if required to 'ZF') and also updates the sales order quantity.
The code works absolutely fine as long as the PGI date of the order item is either today or in the future. However if the PGI date of the order item is in the past. I get an error in the t_return table with error type 'E' saying 'PGI date is in the past hence could not update the item'.
If I try to update the same order quantity in VA02 for the item with PGI date in the past it does so without any problem.
Can someone please suggest what the problem might be. Or if there is some other way I can update the quantity. (I dont want to use BDC)
FORM change_sales_order_item USING value(r_rtb_posnrs) TYPE zpsd_ztsdrtb_ro_track
CHANGING r_return TYPE type_t_bapiret2.
DATA: v_order_header_in TYPE bapisdh1,
v_order_header_inx TYPE bapisdh1x,
t_schedule_lines TYPE bapischdl OCCURS 0 WITH HEADER LINE,
t_schedule_linesx TYPE bapischdlx OCCURS 0 WITH HEADER LINE,
v_temp_rtb_vbeln TYPE vbeln,
v_temp_rtb_posnr TYPE posnr,
wa_old_rtb_posnrs TYPE ztsdrtb_ro_track,
t_item_in TYPE bapisditm OCCURS 0 WITH HEADER LINE,
t_item_inx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
v_rtb_old_vbeln TYPE zrtbvbeln,
v_rtb_old_posnr TYPE zrtbposnr,
v_ro_old_vbeln TYPE zrovbeln,
v_ro_old_posnr TYPE zroposnr,
v_rtb_count TYPE i,
v_next_row_index TYPE i,
v_update_order_flg TYPE char1, "Update the sales order flag
v_rtb_record_counter TYPE i,
v_original_vbeln TYPE vbeln,
t_bapiret TYPE STANDARD TABLE OF bapiret2.
FIELD-SYMBOLS: <wa_r_rtb_posnrs> TYPE ztsdrtb_ro_track,
<wa_r_rtb_posnr_next> TYPE ztsdrtb_ro_track.
CONSTANTS: c_updateflag TYPE bapisditmx-updateflag VALUE 'U'.
v_order_header_inx-updateflag = 'U'.
Get rid of the duplicate records for the same RTB order. Just use
the last record quantity in the internal table
LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
v_rtb_record_counter = v_rtb_record_counter + 1.
<wa_r_rtb_posnrs>-seqnr = v_rtb_record_counter.
ENDLOOP.
SORT r_rtb_posnrs DESCENDING BY zrtbvbeln zrtbposnr seqnr zrtbconsumedflg.
DELETE ADJACENT DUPLICATES FROM r_rtb_posnrs COMPARING zrtbvbeln zrtbposnr.
DESCRIBE TABLE r_rtb_posnrs LINES v_rtb_count.
v_rtb_record_counter = 0.
v_update_order_flg = space.
LOOP AT r_rtb_posnrs ASSIGNING <wa_r_rtb_posnrs>.
v_rtb_record_counter = v_rtb_record_counter + 1.
v_update_order_flg = space.
Popluate the item quantity update flags for schedule lines
t_schedule_linesx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_schedule_linesx-sched_line = '0001'.
t_schedule_linesx-updateflag = c_updateflag.
t_schedule_linesx-req_qty = 'X'.
APPEND t_schedule_linesx.
CLEAR t_schedule_linesx.
*Item (Order QQuantity Field to be changed "KWMENG")
t_schedule_lines-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_schedule_lines-sched_line = '0001'.
t_schedule_lines-req_qty = <wa_r_rtb_posnrs>-zrtbchgqty.
APPEND t_schedule_lines.
CLEAR t_schedule_lines.
If fully consumed then set the rejection flag
IF <wa_r_rtb_posnrs>-zrtbconsumedflg = 'X'.
t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_inx-updateflag = 'X'.
t_item_inx-reason_rej = 'X'.
APPEND t_item_inx.
CLEAR t_item_inx.
t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_in-reason_rej = 'ZF'.
APPEND t_item_in.
CLEAR t_item_in.
ELSE.
t_item_inx-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_inx-updateflag = 'X'.
t_item_inx-reason_rej = 'X'.
APPEND t_item_inx.
CLEAR t_item_inx.
t_item_in-itm_number = <wa_r_rtb_posnrs>-zrtbposnr.
t_item_in-reason_rej = ' '.
APPEND t_item_in.
CLEAR t_item_in.
ENDIF.
If you have reached the last line of the RTB intern table update the sales order
*Index pointing to the next row
v_next_row_index = v_rtb_record_counter + 1.
IF v_rtb_record_counter = v_rtb_count.
v_update_order_flg = 'X'.
ELSEIF v_rtb_record_counter < v_rtb_count.
Get the next row data
READ TABLE r_rtb_posnrs INDEX v_next_row_index ASSIGNING <wa_r_rtb_posnr_next>.
IF sy-subrc = 0.
IF <wa_r_rtb_posnrs>-zrtbvbeln <> <wa_r_rtb_posnr_next>-zrtbvbeln.
v_update_order_flg = 'X'.
ENDIF.
ENDIF.
ELSE.
v_update_order_flg = space.
ENDIF.
update the rtb orders with quantities and the rejection flag (if required)
IF v_update_order_flg = 'X'.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE' STARTING NEW TASK 'SOUPDATE'
PERFORMING callbk_bapi_salesorder_change ON END OF TASK
EXPORTING
salesdocument = <wa_r_rtb_posnrs>-zrtbvbeln
order_header_in = v_order_header_in
order_header_inx = v_order_header_inx
TABLES
return = t_return
schedule_lines = t_schedule_lines
schedule_linesx = t_schedule_linesx
order_item_in = t_item_in
order_item_inx = t_item_inx.
WAIT UNTIL t_return[] IS NOT INITIAL.
READ TABLE t_return INTO wa_return WITH KEY type = 'E'.
IF sy-subrc <> 0.
ELSE.
r_return[] = t_return[].
MESSAGE ID 'ZSD' TYPE 'E' NUMBER 613.
RAISE errorinorderupdate.
ENDIF.
REFRESH t_schedule_linesx.
REFRESH t_schedule_lines.
REFRESH t_item_in.
REFRESH t_item_inx.
REFRESH t_return.
ENDIF.
ENDLOOP.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
IMPORTING
return = t_bapiret.
ENDFORM. "Change_Sales_Ordersee the following example and try to do this:
i_hdrx-updateflag = 'U'.
*" Fill required SCHEDULE_LINES data.
i_sched-itm_number = p_posnr.
i_sched-sched_line = p_etenr.
i_sched-req_qty = p_reqqty.
i_schedx-updateflag = 'U'.
i_schedx-itm_number = p_posnr.
i_schedx-sched_line = p_etenr.
i_schedx-req_qty = 'X'.
APPEND i_sched.
APPEND i_schedx.
CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
EXPORTING
salesdocument = p_vbeln
order_header_in = i_hdr
order_header_inx = i_hdrx
TABLES
return = i_ret
schedule_lines = i_sched
schedule_linesx = i_schedx. -
Sending ALV report(As a attachment ) through EMail
Dear Friends,
Could anyone please help me to solve this problem.
I need to send ALV report <b>as an attachment</b> to External mail-id as well as SAP USER ID..The user wants to schedule this ABAP program in background, at the end the final output should be send to his ID. I facing problem to locate correct Functional Module....
I would like to thank, if anyone give some idea on this issue also if possible a sample code.
Thanks in advance
With Reg
BabuHI Kamal Babu
After sending your ABAP List to the spool request (SP01), you can use the SAP standard spool PDF conversion program.
RSTXPDFT4 - This report program converts ABAP List to PDF files.
Or Just try this sample code:
After running the background jobs, send the spool to the SAP users Office Mail Box.
REPORT ZMAILSPOOL.
INCLUDE LBTCHDEF.
Include the Business Object Repository object
INCLUDE <CNTN01>.
DATA ABAPNM LIKE SY-REPID.
DATA BEGIN OF LOCAL_JOB.
INCLUDE STRUCTURE TBTCJOB.
DATA END OF LOCAL_JOB.
DATA BEGIN OF LOCAL_STEP_TBL OCCURS 10.
INCLUDE STRUCTURE TBTCSTEP.
DATA END OF LOCAL_STEP_TBL.
Data declarations for the mail recipient
DATA RECIPIENT TYPE SWC_OBJECT.
DATA RECIPIENT_OBJ LIKE SWOTOBJID.
SWC_CONTAINER CONTAINER.
Data declarations for the background job
PARAMETERS ABAPNAME(20) DEFAULT 'ZTEST1'.
PARAMETERS EMPFNAME LIKE SY-UNAME DEFAULT SY-UNAME.
ABAPNM = ABAPNAME.
LOCAL_JOB-JOBNAME = ABAPNAME.
Generate recipient object (see report RSSOKIF1 for an example)
1. Create the recipient:
IF EMPFNAME <> SPACE.
"** 1.1 Generate an object reference to a recipient object
SWC_CREATE_OBJECT RECIPIENT 'RECIPIENT' SPACE.
"** 1.2 Write the import parameters for method
"** recipient.createaddress into the container
"** and empty the container
SWC_CLEAR_CONTAINER CONTAINER.
"** Set address element (internal user 'JSMITH')
SWC_SET_ELEMENT CONTAINER 'AddressString' EMPFNAME.
"** Set address type (internal user)
SWC_SET_ELEMENT CONTAINER 'TypeId' 'B'.
"** 1.3 Call the method recipient.createaddress
SWC_CALL_METHOD RECIPIENT 'CreateAddress' CONTAINER.
"** Issue any error message generated by a method exception
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO.
ENDIF.
SWC_CALL_METHOD RECIPIENT 'Save' CONTAINER.
SWC_OBJECT_TO_PERSISTENT RECIPIENT RECIPIENT_OBJ.
ENDIF.
Recipient has been generated and is ready for use in a
background job
CALL FUNCTION 'JOB_OPEN'
exporting
DELANFREP = ' '
JOBGROUP = ' '
jobname = LOCAL_JOB-JOBNAME
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
IMPORTING
JOBCOUNT = LOCAL_JOB-JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4
if sy-subrc <> 0.
WRITE: / 'JOB_OPEN PROBLEM ', SY-SUBRC.
ELSE.
WRITE: / 'JOB OPEN SUCCESS',
LOCAL_JOB-JOBNAME, LOCAL_JOB-JOBCOUNT.
endif.
CALL FUNCTION 'JOB_SUBMIT'
exporting
ARCPARAMS =
authcknam = SY-UNAME
COMMANDNAME = ' '
OPERATINGSYSTEM = ' '
EXTPGM_NAME = ' '
EXTPGM_PARAM = ' '
EXTPGM_SET_TRACE_ON = ' '
EXTPGM_STDERR_IN_JOBLOG = 'X'
EXTPGM_STDOUT_IN_JOBLOG = 'X'
EXTPGM_SYSTEM = ' '
EXTPGM_RFCDEST = ' '
EXTPGM_WAIT_FOR_TERMINATION = 'X'
jobcount = LOCAL_JOB-JOBCOUNT
jobname = LOCAL_JOB-JOBNAME
LANGUAGE = SY-LANGU
PRIPARAMS = ' '
REPORT = ABAPNM
REPORT = 'ZTEST1'
VARIANT = ' '
IMPORTING
STEP_NUMBER = LOCAL_JOB-STEPCOUNT
EXCEPTIONS
BAD_PRIPARAMS = 1
BAD_XPGFLAGS = 2
INVALID_JOBDATA = 3
JOBNAME_MISSING = 4
JOB_NOTEX = 5
JOB_SUBMIT_FAILED = 6
LOCK_FAILED = 7
PROGRAM_MISSING = 8
PROG_ABAP_AND_EXTPG_SET = 9
OTHERS = 10
if sy-subrc <> 0.
WRITE: / 'JOB_SUBMIT PROBLEM ', LOCAL_JOB-JOBCOUNT,
LOCAL_JOB-JOBNAME, ABAPNAME, SY-SUBRC.
endif.
IF EMPFNAME <> SPACE.
CALL FUNCTION 'JOB_CLOSE'
exporting
AT_OPMODE = ' '
AT_OPMODE_PERIODIC = ' '
CALENDAR_ID = ' '
EVENT_ID = ' '
EVENT_PARAM = ' '
EVENT_PERIODIC = ' '
jobcount = LOCAL_JOB-JOBCOUNT
jobname = LOCAL_JOB-JOBNAME
LASTSTRTDT = NO_DATE
LASTSTRTTM = NO_TIME
PRDDAYS = 0
PRDHOURS = 0
PRDMINS = 0
PRDMONTHS = 0
PRDWEEKS = 0
PREDJOB_CHECKSTAT = ' '
PRED_JOBCOUNT = ' '
PRED_JOBNAME = ' '
SDLSTRTDT = NO_DATE
SDLSTRTTM = NO_TIME
STARTDATE_RESTRICTION = BTC_PROCESS_ALWAYS
STRTIMMED = 'X'
TARGETSYSTEM = ' '
START_ON_WORKDAY_NOT_BEFORE = SY-DATUM
START_ON_WORKDAY_NR = 0
WORKDAY_COUNT_DIRECTION = 0
RECIPIENT_OBJ = RECIPIENT_OBJ
TARGETSERVER = ' '
DONT_RELEASE = ' '
IMPORTING
JOB_WAS_RELEASED = 'X'
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8
IF ( SY-SUBRC <> 0 ).
WRITE: / 'Job_Close Problem:', ABAPNAME, SY-SUBRC.
ELSE.
WRITE: / 'Job_Close done'.
ENDIF.
ELSE. "no empfname
ENDIF.
Cheers,
Vijay Raheja -
Sending XI-Content as Mail Attachement with specific Filename
Hi,
I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
Is this possible and how?
Thank you for your help
ThomasHi Thomas,
You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
In the Mail Receiver Channel got to tab "Module"
As first module (before the mail module) enter:
localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
For this module key you can use in the module configuration following entries:
Transform.ContentDisposition inline|attachment;filename=<filename>
Transform.ContentDescription <Filename>
Transform.ContentType <MimeType>/<SubType>;name="<filename>"
If you want to send an attachment, use:
Transform.ContentDisposition attachment;filename="MyFile.csv"
Transform.ContentDescription MyFile
Transform.ContentType text/plain;name="MyFile.csv"
If you use the Mail Package, you can set the file name that way:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
<Content_Type>text/plain;name="MyFile.csv"</Content_Type>
<Content>Here comes the CSV Data</Content>
</ns:Mail>
Hope that helps,
Stefan -
Crystal Reports Charting Issue with SAP Function Module
I created a custom SAP Function module that returns 2 tables. The first table (summary table) contains two columns, column "a" contains a grouping and column "b" is a quantity. The second table is the detail and is linked to the first table by the grouping, column "a" , in both tables. I can bring the function module into Crystal Reports, but cannot create a drill down using a pie chart off the summary table. When I go into the Chart Expert - Data Tab only the Advance button is active and the Group, Cross-Tab, and OLAP buttons are deactivated. First of all, is it possible to do this using a SAP Function Module, if yes, what am I doing wrong.
hello Jhess,
i am not sure if you found an answer for your question yet. if you have a Group and a Summary on your report (i.e. the Sum of your Quantity field) then group charts should be enabled.
cheers,
jamie -
How to attached class or function module in FD03
Hi Guys
I want to attached CL_ATTACHMENT_LIST for retriving attachment list from fd03 please help to attached the function module in my program?
regards
Piroz
report zfir_aged_debtors no standard page heading
line-size 255.
Type group
type-pools:
slis. " ALV types
Tables
tables:
adrc, " Addresses
bsad, " Accounting: Customer secondary index (Cleared)
bsid, " Accounting: Customer secondary index (Open)
kna1, " Customer master: General data
knkk, " Customer master: Credit management
knvk. " Customer master: Contact persons
Types
types:
begin of ty_bsadbsid,
bukrs like bsad-bukrs, " Company code
kunnr like bsad-kunnr, " Customer
gjahr like bsad-gjahr, " Fiscal year
belnr like bsad-belnr, " Accounting document number
buzei like bsad-buzei, " Line item
budat like bsad-budat, " Posting date
bldat like bsad-bldat, " Document date
waers like bsad-waers, " Currency
xblnr like bsad-xblnr, " Reference
shkzg like bsad-shkzg, " Debit/credit indicator
dmbtr like bsad-dmbtr, " Amount
zfbdt like bsad-zfbdt, " Baseline date for due date
" calculation
zbd1t like bsad-zbd1t, " Cash discount days 1
zbd2t like bsad-zbd2t, " Cash discount days 2
zbd3t like bsad-zbd3t, " Net payment terms period
rebzg like bsad-rebzg, " Number of the invoice
rebzt like bsad-rebzt, " Follow on document type
end of ty_bsadbsid,
ty_it_bsadbsid type ty_bsadbsid occurs 0,
begin of ty_merged,
kunnr like kna1-kunnr, " Customer number
name1 like adrc-name1, " Name
city1 like adrc-city1, " City
post_code1 like adrc-post_code1, " Post code
street like adrc-street, " Street
house_num1 like adrc-house_num1, " House number
tel_number like adrc-tel_number, " Telephone number
fax_number like adrc-fax_number, " Fax number
namev like knvk-namev, " First name
namew like knvk-name1, " Last name
telf1 like knvk-telf1, " Telephone number
klimk like knkk-klimk, " Credit limit
skfor like knkk-skfor, " Total receivables
total like bsad-dmbtr, " Total amount
rast1 like bsad-dmbtr, " Amount period 1
rast2 like bsad-dmbtr, " Amount period 2
rast3 like bsad-dmbtr, " Amount period 3
rast4 like bsad-dmbtr, " Amount period 4
rast5 like bsad-dmbtr, " Amount period 5
rast6 like bsad-dmbtr, " Amount period 6
end of ty_merged,
ty_it_merged type ty_merged occurs 0.
Internal tables
data:
Internal table to store customer line items from BSAD and BSID
it_bsadbsid type ty_it_bsadbsid,
Internal table to store field catalog for ALV function call
it_fieldcat type slis_t_fieldcat_alv,
Internal table to store summarised data for report output
it_merged type ty_it_merged.
Structures
data:
Display variant structures
st_tvariant like disvariant,
st_variant like disvariant.
Constants
constants:
co_delim_dash type c
value '-',
co_false type c " False
value space,
co_koart_d like faede-koart " Customer account type
value 'D',
co_save_u type c " User display variant
value 'U', " saving allowed.
co_shkzg_h like bsid-shkzg " Debit/Credit indicator
value 'H', " for credit
co_shkzg_s like bsid-shkzg " Debit/Credit indicator
value 'S', " for debit
co_selected type c " Value of selected radio
value 'X', " button or checkbox
co_true type c " True
value co_selected.
Variables
data:
va_exit type c.
Selection screen definition
selection-screen: begin of block b1 with frame title text-001.
select-options:
s_kunnr for bsad-kunnr. " Customer number
parameters:
p_kkber like knkk-kkber, " Credit control area
p_pafkt like knvk-pafkt, " Contact function
p_datum like sy-datum. " Report date
selection-screen: begin of line,
comment 01(30) text-006,
position pos_low.
parameters:
rastbis1 like rfpdo1-allgrogr " Due date sorted 1
default '000',
rastbis2 like rfpdo1-allgrogr " Due date sorted 2
default '000',
rastbis3 like rfpdo1-allgrogr " Due date sorted 3
default '000',
rastbis4 like rfpdo1-allgrogr " Due date sorted 4
default '000',
rastbis5 like rfpdo1-allgrogr " Due date sorted 5
default '000'.
selection-screen: end of line.
selection-screen: end of block b1,
begin of block b2 with frame title text-002.
parameters:
p_varint like disvariant-variant. " Display variant.
selection-screen: end of block b2.
Initialisation
initialization.
Provide default periods for due date sorted list.
rastbis1 = 0.
rastbis2 = 30.
rastbis3 = 60.
rastbis4 = 90.
rastbis5 = 120.
Default report date to current.
p_datum = sy-datlo.
Default credit control area to BP01.
p_kkber = 'BP01'.
At selection screen on value request for
at selection-screen on value-request for p_varint.
Provide display variant list for this program.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = st_variant
i_save = co_save_u
importing
e_exit = va_exit
es_variant = st_tvariant
exceptions
not_found = 2.
if sy-subrc eq 2.
message id sy-msgid type 'S'
number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
if va_exit eq space.
st_variant = st_tvariant.
p_varint = st_tvariant-variant.
endif.
endif.
At selection screen
at selection-screen.
Load display variant.
if not p_varint is initial.
move st_variant to st_tvariant.
move p_varint to st_tvariant-variant.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = co_save_u
changing
cs_variant = st_tvariant.
st_variant = st_tvariant.
else.
clear st_variant.
st_variant-report = sy-repid.
endif.
if p_kkber is initial.
Ensure credit control area is specified.
message e000(zgen) with 'Credit control area must be specified'.
endif.
if p_pafkt is initial.
Ensure contact person function is specified.
message e000(zgen) with 'Contact person function must be specified'.
endif.
Start of selection
start-of-selection.
Extract open customer items from BSID
select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
from bsid
into table it_bsadbsid
where kunnr in s_kunnr
and budat le p_datum.
Extracct cleared customer items from BSAD
select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
from bsad
appending table it_bsadbsid
where kunnr in s_kunnr
and budat le p_datum
and augdt ge p_datum.
Ensure that items were not selected twice while getting data from the
open and cleared items tables (Only if transaction occured during
report run).
sort it_bsadbsid by bukrs belnr gjahr buzei.
delete adjacent duplicates from it_bsadbsid
comparing bukrs belnr gjahr buzei.
if it_bsadbsid[] is initial.
No data found for selection
message s001(zgen).
exit.
endif.
Merge data for report output
perform merge_data tables it_bsadbsid
it_merged.
Build field catalog
perform build_field_catalog tables it_fieldcat.
Output report via ALV
perform output_report_via_alv tables it_fieldcat
it_merged.
*& Form merge_data
text
form merge_data tables pa_it_bsadbsid type ty_it_bsadbsid
pa_it_merged type ty_it_merged.
Local work areas
data:
lwa_bsadbsid type ty_bsadbsid,
lwa_merged type ty_merged.
Local structures
data:
lst_faede like faede.
Local variables
data:
lva_daysover type i,
lva_merged_tabix like sy-tabix.
loop at pa_it_bsadbsid into lwa_bsadbsid.
Lookup merged entry for customer
clear lwa_merged.
read table pa_it_merged into lwa_merged
with key kunnr = lwa_bsadbsid-kunnr
binary search.
lva_merged_tabix = sy-tabix.
if sy-subrc ne 0.
Create new merged record for customer
lwa_merged-kunnr = lwa_bsadbsid-kunnr.
Get customer details from KNA1
clear kna1.
select single *
from kna1
where kunnr eq lwa_bsadbsid-kunnr.
Get customer address details from ADRC
clear adrc.
select single *
from adrc
where addrnumber eq kna1-adrnr
and date_from le p_datum.
lwa_merged-name1 = adrc-name1.
lwa_merged-city1 = adrc-city1.
lwa_merged-post_code1 = adrc-post_code1.
lwa_merged-street = adrc-street.
lwa_merged-house_num1 = adrc-house_num1.
lwa_merged-tel_number = adrc-tel_number.
lwa_merged-fax_number = adrc-fax_number.
Get credit limit details from KNKK
clear knkk.
select single *
from knkk
where kunnr eq lwa_bsadbsid-kunnr
and kkber eq p_kkber.
lwa_merged-klimk = knkk-klimk.
lwa_merged-skfor = knkk-skfor.
Get customer contact person details from KNVK
clear knvk.
select single *
from knvk
where kunnr eq lwa_bsadbsid-kunnr
and pafkt eq p_pafkt.
lwa_merged-namev = knvk-namev.
lwa_merged-namew = knvk-name1.
lwa_merged-telf1 = knvk-telf1.
insert lwa_merged into pa_it_merged index lva_merged_tabix.
endif.
Interpret debit/credit indicator
case lwa_bsadbsid-shkzg.
when co_shkzg_h.
Credit
lwa_bsadbsid-dmbtr = 0 - lwa_bsadbsid-dmbtr.
when co_shkzg_s.
Debit
endcase.
Perform ageing
clear lst_faede.
move-corresponding lwa_bsadbsid to lst_faede.
lst_faede-koart = co_koart_d.
call function 'DETERMINE_DUE_DATE'
exporting
i_faede = lst_faede
importing
e_faede = lst_faede
exceptions
others = 1.
lva_daysover = p_datum - lst_faede-netdt.
Accumulate total.
add lwa_bsadbsid-dmbtr to lwa_merged-total.
if lva_daysover le rastbis1.
add lwa_bsadbsid-dmbtr to lwa_merged-rast1.
else.
if lva_daysover le rastbis2 or
rastbis3 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast2.
else.
if lva_daysover le rastbis3 or
rastbis4 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast3.
else.
if lva_daysover le rastbis4 or
rastbis5 is initial.
add lwa_bsadbsid-dmbtr to lwa_merged-rast4.
else.
if lva_daysover le rastbis5.
add lwa_bsadbsid-dmbtr to lwa_merged-rast5.
else.
add lwa_bsadbsid-dmbtr to lwa_merged-rast6.
endif.
endif.
endif.
endif.
endif.
Update the merged record
modify pa_it_merged from lwa_merged index lva_merged_tabix.
endloop.
endform. " merge_data
*& Form build_field_catalog
text
form build_field_catalog tables pa_it_fieldcat type slis_t_fieldcat_alv.
Local work areas
data:
lwa_fieldcat type slis_fieldcat_alv.
--WG1K903216: Start Insert-
data: v_datum type datum,
v_mdmth type datum,
v_datxt type string,
v_noday type i.
--WG1K903216: End Insert---
refresh pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'KUNNR'.
lwa_fieldcat-ref_tabname = 'KNA1'.
lwa_fieldcat-ref_fieldname = 'KUNNR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '1'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAME1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'NAME1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '2'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'CITY1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'CITY1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '3'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'POST_CODE1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'POST_CODE1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '4'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'STREET'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'STREET'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '5'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'HOUSE_NUM1'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'HOUSE_NUM1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '6'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TEL_NUMBER'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'TEL_NUMBER'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '7'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'FAX_NUMBER'.
lwa_fieldcat-ref_tabname = 'ADRC'.
lwa_fieldcat-ref_fieldname = 'FAX_NUMBER'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '8'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAMEV'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'NAMEV'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '9'.
lwa_fieldcat-seltext_l = 'Contact first name'.
lwa_fieldcat-seltext_m = 'Contact Fname'.
lwa_fieldcat-seltext_s = 'Ctct Fname'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'NAMEW'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'NAME1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '10'.
lwa_fieldcat-seltext_l = 'Contact last name'.
lwa_fieldcat-seltext_m = 'Contact Lname'.
lwa_fieldcat-seltext_s = 'Ctxt Lname'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TELF1'.
lwa_fieldcat-ref_tabname = 'KNVK'.
lwa_fieldcat-ref_fieldname = 'TELF1'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '11'.
lwa_fieldcat-seltext_l = 'Contact phone no.'.
lwa_fieldcat-seltext_m = 'Contact phone'.
lwa_fieldcat-seltext_s = 'Ctct Phne'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'KLIMK'.
lwa_fieldcat-ref_tabname = 'KNKK'.
lwa_fieldcat-ref_fieldname = 'KLIMK'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '12'.
lwa_fieldcat-seltext_l = 'Credit limit'.
lwa_fieldcat-seltext_m = 'Credit limit'.
lwa_fieldcat-seltext_s = 'Crdt limit'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'SKFOR'.
lwa_fieldcat-ref_tabname = 'KNKK'.
lwa_fieldcat-ref_fieldname = 'SKFOR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '13'.
lwa_fieldcat-seltext_l = 'Credit used'.
lwa_fieldcat-seltext_m = 'Credit used'.
lwa_fieldcat-seltext_s = 'Crdt used'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'TOTAL'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '14'.
lwa_fieldcat-seltext_l = 'Total'.
lwa_fieldcat-seltext_m = 'Total'.
lwa_fieldcat-seltext_s = 'Total'.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST1'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '15'.
--WG1K903216: Start Delete-
concatenate '<'
rastbis2
into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis2.
Always use the middle of the report month as a heading reference date.
concatenate p_datum+0(6) '15' into v_mdmth.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '+'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST2'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '16'.
--WG1K903216: Start Delete-
concatenate rastbis1
rastbis2
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis1.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '+'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST3'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '17'.
--WG1K903216: Start Delete-
concatenate rastbis2
rastbis3
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis2.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST4'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '18'.
--WG1K903216: Start Delete-
concatenate rastbis3
rastbis4
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis3.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST5'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '19'.
--WG1K903216: Start Delete-
concatenate rastbis4
rastbis5
into lwa_fieldcat-seltext_l
separated by co_delim_dash.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis4.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
clear lwa_fieldcat.
lwa_fieldcat-tabname = 'PA_IT_MERGED'.
lwa_fieldcat-fieldname = 'RAST6'.
lwa_fieldcat-ref_tabname = 'BSAD'.
lwa_fieldcat-ref_fieldname = 'DMBTR'.
lwa_fieldcat-row_pos = '1'.
lwa_fieldcat-col_pos = '20'.
--WG1K903216: Start Delete-
concatenate '>'
rastbis5
into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Delete---
--WG1K903216: Start Insert-
clear: v_datum,
v_datxt.
v_noday = rastbis5.
call function 'ZWAG_DATE_CALCULATOR'
exporting i_datum = v_mdmth
i_noday = v_noday
i_oprnd = '-'
importing e_datum = v_datum
exceptions invalid_operand = 1.
call function 'ZWAG_END_MONTH'
exporting i_datum = v_datum
importing e_datum = v_datum
e_datxt = v_datxt
exceptions invalid_date = 1.
concatenate 'Due By' v_datxt into lwa_fieldcat-seltext_l
separated by space.
--WG1K903216: End Insert---
lwa_fieldcat-seltext_m = lwa_fieldcat-seltext_l.
lwa_fieldcat-seltext_s = lwa_fieldcat-seltext_l.
lwa_fieldcat-ddictxt = 'L'.
append lwa_fieldcat to pa_it_fieldcat.
endform. " build_field_catalog
*& Form output_report_via_alv
text
form output_report_via_alv
tables pa_it_fieldcat type slis_t_fieldcat_alv
pa_it_merged type ty_it_merged.
Local variables
data:
lva_repid like sy-repid,
lva_formname type slis_formname.
lva_repid = sy-repid.
lva_formname = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = lva_repid
i_callback_user_command = lva_formname
i_save = 'A'
is_variant = st_variant
it_fieldcat = pa_it_fieldcat[]
tables
t_outtab = pa_it_merged
exceptions
program_error = 1
others = 2.
endform. " output_report_via_alvHi shiva
Thanks for your help,
Can you check this coding and revert me back ASAP Please.
REPORT BDS_GOS_CONNECTION.
DATA : logical_system LIKE BAPIBDS01-log_system.
CLASSNAME LIKE BAPIBDS01-CLASSNAME
OBJKEY LIKE SWOTOBJID-objkey.
PARAMETERS: pa_lo_sys BAPIBDS01-log_system,
pa_class like BPIBDS01-CLASSNAME,
pa_objkey like swotobjidobjkey.
AT SELECTION-SCREEN.
CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
EXPORTING
bor_id = bor_id
IMPORTING
logical_sytem = pa_lo_sys.
classname = pa_class.
objkey = pa_objkey.
EXCEPTIONS
no_objects_found = 1
internal_error = 2
internal_gos_error = 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.
clear v_attno1.
i_object1-typeid = 'BUS2012'.
i_object1-catid = 'BO'.
i_object1-instid = i_yItem-docno.
call method cl_gos_attachment_query=>count_for_object
exporting
is_object = i_object1
ip_arl = space
receiving
rt_stat = i_stat1.
read table i_stat1 into wa_stat1 index 1.
if sy-subrc eq c_0.
move wa_stat1-counter to v_attno1.
endif.
CALL METHOD cl_gos_attachment_query=>count_for_object
EXPORTING
is_object = object
ip_arl = space
RECEIVING
rt_stat = lt_stat.
READ TABLE lt_stat INDEX 1 into ls_stat.
count = ls_stat-counter.
*The object has to be a concatenation of your document, like this:
CONCATENATE object-instid tab-gjahr INTO object-instid.
ELSE.
CONCATENATE tab-bukrs tab-belnr tab-gjahr INTO
object-instid.
ENDIF. -
Problem with SO_DOCUMENT_SEND_API1 Function module
Hi Experts,
Is it anyway possible that If we are sending excel attachment through email using SO_DOCUMENT_SEND_API1, column width in excel get adjusted as per the field content without any manual interaction.
Looking forward towards your valuable suggestions!!!
Regards
VJhi,
please see the following
[alignment problem with SO_NEW_DOCUMENT_SEND_API1 FM;
[Problem with function module SO_NEW_DOCUMENT_SEND_API1;
hope these helps you
Regards
Ritesh -
PDF Attachement in RFC Function Module
Hi Experts,
We are going to send the PDF format of Purchase Orders to other Non-SAP System through RFC Function Module.
Please suggest, is there any RFC function module to send PDF file as the attachment.
Or is there any other way to send the PDF files on regular basis from SAP to Non-SAP system.
Regards,
NrusinghaHi ,
follwo the belwo steps..
* Work Area for Print Parameters
Data : wa_pri_params TYPE pri_params,
* Work Area for Converted PDF file
Data : wa_pdf TYPE tline,
if t_ouputdata[] is not initial.
* WAIT UP TO 1 SECONDS.
CONCATENATE 'E'
w_tabix
sy-datum+4(4)
sy-uzeit INTO
wa_pri_params-plist.
ENDIF.
NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params. "creating spool request
WRITE : / text-s32.
ULINE.
LOOP AT t_error INTO wa_error.
WRITE : / wa_error-text.
ENDLOOP.
WRITE : / text-s33.
NEW-PAGE PRINT OFF. "closing spool request
* To fetch the spool number from TSP01 table
SELECT rqident
FROM tsp01
INTO w_rqident
UP TO 1 ROWS
WHERE rq2name = wa_pri_params-plist.
ENDSELECT.
* Subroutine to convert ABAP spool to PDF file
PERFORM abapspoll_to_pdf.
* Now t_pdf table contains the PDF data...
" now call the function module in backgrond task destination and push the PDF format dat to external system...
FORM abapspoll_to_pdf.
* Function Module to Convert Spool to PDF file
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_rqident
no_dialog = 'X'
dst_device = 'LP01'
pdf_destination = 'X'
TABLES
pdf = t_pdf.
CLEAR wa_mail_receivers.
ENDFORM. " ABAPSPOLL_TO_PDF
Regards,
Prabhudas
Maybe you are looking for
-
Failure chain in xml report is missing
The failure chain within the xml report is longer coming up in the report. Where is this option set or how to insure it is functioning properly.
-
How do I get folders and their content to show up in the "Administrative Console"?
We have added a few sub folders under the "webroot" folder. I did this so I could make a custom web page that generates the code need to display the video in a web page if it is one of the folders. My question is how do I get these folders and their
-
Where & what to look for failed messages analysis ?
Hi, Im new to PI. Messages are failing in PI. Just want to know where exactly to look in SXMB_ADM or RWB for the failed messages and what do I need to look in there to analyze these failed messages ? Please help. Thanks Sourav
-
B2B-51507 Element GS08 does not contain a valid identification code
Hi, I am getting error Machine Info: (local.example.com) Element GS08 (Version / Release / Industry Identifier Code) does not contain a valid identification code: '004010UCS' is not allowed. Segment GS is defined in the guideline at position N/A.{br}
-
I have created a foreign JMS for Oracle, when I deploy my application I get an error: (I followed the steps outlined here: ) java.lang.ClassNotFoundException: oracle.jms.AqjmsInitialContextFactory Do I need to install Oracle Service Bus for this to w