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
Similar Messages
-
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 -
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 -
Hi Friends
I am having performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA) and one my client got over 8 thousend employees . This function-module taking forever to read the data. is there any other function-module to read the absences data IT2001 .
I did use like this .if i take out this F.M 'HR_TIM_REPORT_ABSENCE_DATA_INI' its not working other Function-module.please Suggest me .
call function 'HR_TIM_REPORT_ABSENCE_DATA_INI'
exporting "Publishing to global memory
option_string = option_s "string of sel org fields
trig_string = trig_s "string of req data
alemp_flag = sw_alemp "all employee req
infot_flag = space "split per IT neccessary
sel_modus = sw_apa
importing
org_num = fdpos_lines "number of sel org fields
tables
fieldtab = fdtab "all org fields
field_sel = fieldnametab_m. "sel org fields
To Read all infotypes from Absences type.
RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.
central function unit to provide internal tables: abse orgs empl
call function 'HR_TIM_REPORT_ABSENCE_DATA'
exporting
pernr = pernr-pernr
begda = pn-begda
endda = pn-endda
IMPORTING
SUBRC = SUBRC_RTA
tables
absences = absences_01
org_fields = orgs
emp_fields = empl
REFTAB =
APLTAB =
awart_sel_p = awart_s[]
awart_sel_a = awart_s[]
abstp_sel = abstp_s[]
i0000 = p0000
i0001 = p0001
i0002 = p0002
i0007 = p0007
i2001 = p2001
i2002 = p2002
i2003 = p2003.
Thanks & Regards
Reddyguessing will not help you much, check with SE30 to get a better insight
SE30
The ABAP Runtime Trace (SE30) - Quick and Easy
what is the total time, what are the Top 10 in the hitlist.
Siegfried -
I am having issues with my web module on Lightroom 4 (Mac OS 10.9.5). "an unknown error occurred" while trying to upload to my FTP (no changes in my FTP). Bandaid fix was to export to local folder and upload via Filezilla. However, now that is no longer working and although upload completes, the URL takes you to a "Forbidden - do not have permission to read this file" page. Lightroom is changing the permissions of each file to 000 instead of 644 for index files and 755 for all others. How can I change the permissions settings in Lightroom?
I am having issues with my web module on Lightroom 4 (Mac OS 10.9.5). "an unknown error occurred" while trying to upload to my FTP (no changes in my FTP). Bandaid fix was to export to local folder and upload via Filezilla. However, now that is no longer working and although upload completes, the URL takes you to a "Forbidden - do not have permission to read this file" page. Lightroom is changing the permissions of each file to 000 instead of 644 for index files and 755 for all others. How can I change the permissions settings in Lightroom?
-
Hi Guys:
I am experiencing some issue with DUPLIATE FUNCTION. What happen is that I have create some BUTTONS on the stage that was used througth out difference scence.....those buttons has same action that point page to particular scence. And this is when I found the DUPLICATE FUNCTION issue.
I found that I could get away by changing the name of the FUNCTION, but as I have quite a lots of those buttons so I really don't think this method is very pratical and organized. So does anyone have any better idea how this can be solved?
Many Thanks!Thanks so much, this did solve the problem. Studpid me that were trying to add same FUNCTION on each Scene that has the same button. Initially I thought it's more complex in AS3, but seems AS3 is actually trying to make thing easier and more praticler.
Not really good at previously AS, but decided to spend some time on learning AS3.0 now. Hope I could help people like me on the forum with question about AS3.0 soon. Just like the favor you did for me.
Many Thanks!! -
As FI consultant, What are critical issues with other Functional Consultant
Hai, Masters
Can you express about Critical issues with other functional consultant with exmples
Regards
Ramesh KHi Ramesh K,
I think the critical issue should be the definaition cross application should be consistency( Ex in FI, CO, MM or SD).
And the Main issue is the result updated from FI to other applications or from other applications to FI is correct or not!
With Best Regards,
Gladys Xing -
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 -
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 -
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 -
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. -
Gui_download Function module is not working in Background Scheduling
Hi Experts,
Function modules like GUI_DOWNLOAD are not working in background scheduled jobs, It is raising an exception. Though it is working fine in foreground execution.
Please provide me solution for this challenging task.
you could be rated well for this question.
Thanks,
Rama Krishna.Hello,
work with open dataset and close dataset...
just loop over itab and transfer itab field for field into a string field separated by ;
Here is an extract of coding:
OPEN DATASET p_dath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab_pos.
CLEAR satz.
MOVE itab_pos-vbeln TO satz-vbeln.
MOVE ';' TO satz-fill1.
MOVE itab_pos-kunnr TO satz-kunnr.
MOVE ';' TO satz-fill2.
MOVE itab_pos-ktgrd TO satz-ktgrd.
MOVE ';' TO satz-fill3.
MOVE itab_pos-fkdat TO satz-fkdat.
MOVE ';' TO satz-fill4.
MOVE itab_pos-budat TO satz-budat.
MOVE ';' TO satz-fill5.
MOVE itab_pos-cpudt TO satz-cpudt.
MOVE ';' TO satz-fill6.
MOVE itab_pos-fkimg TO satz-fkimg.
MOVE ';' TO satz-fill7.
MOVE itab_pos-netwr TO satz-netwr.
MOVE ';' TO satz-fill8.
MOVE itab_pos-vrkme TO satz-vrkme.
MOVE ';' TO satz-fill9.
MOVE itab_pos-ktgrm TO satz-ktgrm.
MOVE ';' TO satz-fill10.
MOVE itab_pos-matnr TO satz-matnr.
MOVE ';' TO satz-fill11.
MOVE itab_pos-mattxt TO satz-mattxt.
MOVE ';' TO satz-fill12.
MOVE itab_pos-gewei TO satz-gewei.
MOVE ';' TO satz-fill13.
MOVE itab_pos-brgew TO satz-brgew.
TRANSFER satz TO p_dath.
ENDLOOP.
CLOSE DATASET p_dath.
It is not so comfortable as it is with GUI_DOWNLOAD but it works in background! -
CONTROL_FLUSH_ERROR when using 'GUI_DOWNLOAD' Function Module in foreground
Hi,
I am using function module 'GUI_DOWNLOAD' in foreground mode with APPEND = 'X' ( I need to add infomration to file ).
In most of the cases it works good but in some cases ( which I cannot isolate ) - I am getting CONTROL_FLUSH_ERROR exception. Do you have any ideas where can be the problem?
Thanks in advance,
AnnaYou will get "CONTROL_FLUSH_ERROR " error when there is some problem with SAP GUI. Check your Gui installation and if possible uninstall the exixting GUI and reinstall the new GUI from fresh.
or you can use the below code
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING bin_filesize = l_xml_size
filename = 'c:tempflights.xml'
filetype = 'BIN'
CHANGING data_tab = l_xml_table
EXCEPTIONS OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
Using GUI_DOWNLOAD Function module in Batch
Hi All,
I use the subject function module to load the data into a .xls file. I find no error while I run my program directly. But when I run it in Background it throws an unknown_error. Tried to debug, while in background (by introducing a infinite loop and releasing from the loop with the exit condition). I couldn't get into the function module to debug.
Needed information on how else can I find what the error is and is there any other function module (other than ws_download and gui_download) which I could use and find no errors while running in background.
Thanks,
Aaron.
This is what I am doing:
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
if sy-subrc = 0.
Loop at te070 into se070.
Transfer se070 to p_file.
Endloop.
endif.
close dataset p_file.
This creates a file in the app server in Batch and I will have to run a program online to dowload the contents from the server. My requirement is that I need to download the contents in Batch to my local file. Is this possible by any means? (Can we create a windows executable file (.EXE) and use it in a windows batch file (.BAT)?)
Message was edited by: Aaron AnthonyHi Gopi,
This is what I am doing:
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
if sy-subrc = 0.
Loop at te070 into se070.
Transfer se070 to p_file.
Endloop.
endif.
close dataset p_file.
This creates a file in the app server in Batch and I will have to run a program online to dowload the contents from the server. My requirement is that I need to download the contents in Batch to my local file. Is this possible by any means? (Can we create a windows executable file?)
Thanks for your help. -
Issues in IDOC_XML_FILE function module in ECC5.0
Hi,
I used the function module IDOC_XML_FILE to upload and convert XML file from the application server to idoc. It was working fine in 4.6C. Howeverm when we recently upgraded to ECC5.0, the version of this function module changed. And we are facing issues with this.
- The FM is not reading the XML file correctly (There are some blank spaces while reading the file using the method, call method l_conv->read( importing data = g_xml_string ) and
- The parsing method is throwing error (CALL METHOD l_mini_parser->parse_string)
Can anybody tell whether any SAP notes available for the corrections.
Regards,
HariQuestion rephrased and asked again to improve clarity
Maybe you are looking for
-
Updating a component outside the context of the f:ajax element
Is there a way to make the following code work, apart from placing the "out" component inside the h:form element? <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org
-
Convert >_tnati-ebeln& - purchase order to 1234567890 - purchase order
Hi All, I have got data from as below DATA: lv_covtitle TYPE so_obj_des. " Cover text SELECT SINGLE objdes FROM tnati INTO lv_covtitle WHERE spras = nast-spras AND kappl = nast-
-
How to create a count up timer in flash ...
How do you make a count up timer in flash? I have the custom counter I made in photoshop and I can get it to count up, but not with the dynamic text field I've created in flash, what do I need to do....... simpl code: var startT:Number = 1; var endT:
-
Errors in generated JSP pages (JDev 10.1.3)
Hello all, I'm having this error in generated pages and I don't know how I can solve it. Error(1,51): HttpJsp not found in class maretours.boekjaarjsp.html.errorpage. generated code: public class errorpage extends oracle.jsp.runtime.HttpJsp { Error(1
-
Iphoto to imovie to idvd--bad picture quality(Cannon powershoot sd200)
My family video I made for the year looks like really. I made one last year in movie maker on my PC and it looks great. The one I made on my mac this year is blurry and not clear. The video is fine but the photos are really bad. Specifically photos t