Documente Academic
Documente Profesional
Documente Cultură
custtab-kunnr = t_task-kunnr. receive results from function TABLES ORDER_ITEMS_OUT ORDER_CONDITION_EX MESSAGETABLE 'BAPI_SALESORDER_SIMULATE' = order_items_out = order_condition_ex = messagetable.
endloop. WAIT UNTIL rcv_jobs >= snd_jobs. loop at custpricetab. index = sy-tabix. clear deleted. read table mattab with key matnr = custpricetab-material. if sy-subrc = 0 and mattab-lvorm = 'X'. deleted = 'X'. endif. clear: wa_custprice. read table t_custprice into wa_custprice with key salesorg custpricetab-salesorg distchan custpricetab-distchan division custpricetab-division customer custpricetab-customer material custpricetab-material. if sy-subrc <> 0. if deleted <> 'X' and custpricetab-amount <> 0. clear wa_custprice. clear wa_custprice. wa_custprice-salesorg = custpricetab-salesorg. ... wa_custprice-del = ' '. insert zsky_custprice from wa_custprice. endif. else. if wa_custprice-amount <> custpricetab-amount or ... wa_custprice-grouproutine5 <> custpricetab-grouproutine5. move custpricetab-amount to wa_custprice-amount. ... move w_timestamp to wa_custprice-ldbtstamp. modify zsky_custprice from wa_custprice. endif. endif. endloop. * delete NJMA WRITE: / 'Start of customer price commit ', sy-UZEIT. ****************** commit work. * delete NJMA WRITE: / 'End of customer price commit ', sy-UZEIT. ****************** endform. key matnr = custpricetab-material. if sy-subrc = 0 and mattab-lvorm = 'X'. deleted = 'X'. endif. clear: wa_custprice. read table t_custprice into wa_custprice with key salesorg custpricetab-salesorg distchan custpricetab-distchan division custpricetab-division customer custpricetab-customer material custpricetab-material. if sy-subrc <> 0. if deleted <> 'X' and custpricetab-amount <> 0. clear wa_custprice. clear wa_custprice. wa_custprice-salesorg = custpricetab-salesorg. ... wa_custprice-del = ' '. insert zsky_custprice from wa_custprice. endif. else. if wa_custprice-amount <> custpricetab-amount or ... wa_custprice-grouproutine5 <> custpricetab-grouproutine5. move custpricetab-amount to wa_custprice-amount. = = = = = = = = = =
functioncall1 = done. read table messagetable with key type = 'E'. if sy-subrc = 0. loop at messagetable where type = 'E'. write error msg. endloop. Else. u2026 Store customer-material prices in custpricetab from order_items_out and order_header u2026 Endif. endform. "Set_custom
form custom. select * into table t_custprice from zsky_custprice. select * into table t_ZSKY_ORDER_TYPES from ZSKY_ORDER_TYPES. select * into table t_cust from zsky_cust. CLEAR: taskname, index, snd_jobs, rcv_jobs, exc_flag, mess, functioncall1. free t_task. u2026 Store active customers in internal table custtab u2026 loop at mattab. clear order_items_in. order_items_in-itm_number = ln. order_items_in-material = mattab-matnr. order_items_in-req_qty = 1000. clear work_meins. select single meins into work_meins from mara where matnr = mattab-matnr. order_items_in-sales_unit = work_meins. append order_items_in. ln = ln + 1. endloop. loop at custtab. index = sy-tabix. exc_flag = 0. clear: order_header_in. refresh: order_partners, order_schedule_in, order_items_out, order_condition_ex. order_header_in-doc_type = 'ZOR'. order_header_in-sales_org = p_vkorg. order_header_in-distr_chan = p_vtweg. order_header_in-division = p_spart. order_header_in-req_date_h = sy-datum. clear order_partners. order_partners-partn_role = 'AG'. order_partners-partn_numb = custtab-kunnr. append order_partners. free: messagetable. wait_count = 0. CONCATENATE 'Task_' index into taskname. CONDENSE taskname NO-GAPS. t_task-taskname = taskname. t_task-kunnr = custtab-kunnr. insert TABLE t_task. DO. CALL FUNCTION 'BAPI_SALESORDER_SIMULATE' STARTING NEW TASK taskname performing return_custom on end of task EXPORTING ORDER_HEADER_IN = order_header_in TABLES
ORDER_ITEMS_IN = order_items_in ORDER_PARTNERS = order_partners ORDER_SCHEDULE_IN = order_schedule_in EXCEPTIONS system_failure = 1 MESSAGE mess communication_failure = 2 MESSAGE mess resource_failure = 3. CASE sy-subrc. WHEN 0. snd_jobs = snd_jobs + 1. exit. * WHEN 1 OR 2. Error. WHEN 3. wait_count = 1. IF snd_jobs >= 1 AND exc_flag = 0. exc_flag = 1. WAIT UNTIL rcv_jobs >= snd_jobs UP TO 5 SECONDS. ENDIF. WHEN OTHERS. MESSAGE 'Other error' TYPE 'I'. ENDCASE. *
... move w_timestamp to wa_custprice-ldbtstamp. modify zsky_custprice from wa_custprice. endif. endif. endloop. delete NJMA WRITE: / 'Start of customer price commit ', sy-UZEIT. ****************** commit work. * delete NJMA WRITE: / 'End of customer price commit ', sy-UZEIT. ****************** endform.
ANS 3 : thanks for posting the coding. If I understand correctly, you do the final processing in one loop. You loop over all customer/material records and either insert or modify the table entries one by one. When the complete loop is over, you do COMMIT WORK once. Right? Our investigations show that single MODIFY or INSERT statements are showing significantly worse performance than array inserts and updates. Please try to implement packaging mechanism for your loop with insert and update. Build an internal table to be inserted and updated. When one of the tables reach the package size (e.g. 10.000 entries), you make the insert/update from table. Afterwards, do a COMMIT (see also below). In your particular case I would try calling function DB_COMMIT rather than COMMIT WORK, as the standard commit does more than simply make a DB commit. There might be the case that BAPI_SALESORDER_SIMULATE planned some subroutines or function modules to be executed on COMMIT and they cause longer COMMIT runtimes. Q ANS ANS3: ust want to say thanks to everyone who provided assistance and points will be assigned. I get the best performance (3hrs) when the table is updated/insert with out checking if it already exist (thanks Volker). I've tested all of your suggestions and I'm still not sure what was causing the delay with the 'commit work' or DB_commit function. ANS1 to Q: data: t_custprice type sorted table of zsky_custprice with non-UNIQUE key SALESORG, DISTCHAN, DIVISION, CUSTOMER, MATERIAL. I hope the table in question is not this "t_custprice", because, as I said, using the INSERT / UPDATE returncodes in the described way only works correctly with a UNIQUE key. If you did adjust this or the table in question was another one, I am happy that this did work well. Q: how to write sy-tabix in alv In this program. How can i write var2 value which is eq sy-tabix?? DATA: var2 TYPE I , cnt1 TYPE i, cnt2 TYPE i, cnt3 TYPE i, cnt4 TYPE i, cnt5 TYPE i, cnt6 TYPE i, fullname TYPE char25.
TYPES: BEGIN OF i_tab1 , werks LIKE pa0001-werks, btrtl LIKE pa0001-btrtl, "personnel sub area pernr LIKE pa0001-pernr, abkrs LIKE pa0001-abkrs, ename LIKE pa0001-ename, cnt1 TYPE i, cnt2 TYPE i, cnt3 TYPE i, cnt4 TYPE i, cnt5 TYPE i, cnt6 TYPE i, VAR2 TYPE I,
endda LIKE pa0002-endda, persg LIKE pa0001-persg, persk LIKE pa0001-persk, plans LIKE pa0001-plans, fullname TYPE char25, mgt_name TYPE char25, srno TYPE p DECIMALS 0, END OF i_tab1.
DATA : it_final TYPE TABLE OF i_tab1 with header line, wa_final TYPE i_tab1. DATA : it_final1 TYPE TABLE OF i_tab1 with header line, wa_final1 TYPE i_tab1. DATA : it_t500p TYPE TABLE OF t500p, wa_t500p LIKE LINE OF it_t500p. DATA : it_t501t TYPE TABLE OF t501t, wa_t501t LIKE LINE OF it_t501t. START-OF-SELECTION . GET pernr . rp-provide-from-last p0001 space pn-begda pn-endda . " Macro for IFT-0001 rp-provide-from-last p0002 space pn-begda pn-endda . " Macro for IFT-0002 LOOP AT p0001." where abkrs = PNPABKRS-LOW. wa_final-werks = p0001-werks. wa_final-persg = p0001-persg. wa_final-endda = p0001-endda. wa_final-abkrs = p0001-abkrs. wa_final-srno = 1. APPEND wa_final TO it_final. CLEAR wa_final . ENDLOOP. SORT it_final BY werks persg. SELECT * FROM t500p INTO TABLE it_t500p FOR ALL ENTRIES IN it_final WHERE persa EQ it_final-werks AND molga EQ '40'. SELECT * FROM t501t INTO TABLE it_t501t FOR ALL ENTRIES IN it_final WHERE persg EQ it_final-persg AND sprsl = 'E' .
END-OF-SELECTION. DELETE it_final WHERE endda <> '99991231'. SORT it_final BY werks abkrs persg. LOOP AT it_final INTO wa_final. VAR2 = SY-TABIX. AT LAST . write: sy-tabix. ENDAT. MOVE VAR2 TO it_FINAL-VAR2. MOVE-CORRESPONDING wa_final TO wa_final1. COLLECT wa_final1 INTO it_final1. it_final1-var2 = it_final-var2. ENDLOOP. * LOOP AT it_final1 INTO wa_final1. * WRITE: / wa_final1-werks,wa_final1-persg,wa_final1-srno,wa_final1-mgt_name,wa_final1-fullname. * WRITE: var2. * ENDLOOP. ANS 1: instead of sy-index you can also use count = count + 1. and display your final value. Q to ANS 1: i am wrting it like this,again debugger shows me the true value of var2 but in alv it is zero.as my debugger's cursor comes to perform salv_at_reuse_display. my var2 value becomes zero....
LOOP AT it_final INTO wa_final. var2 = var2 + 1. MOVE-CORRESPONDING wa_final TO wa_final1. COLLECT wa_final1 INTO it_final1. MOVE VAR2 TO it_FINAL-VAR2. it_final1-var2 = it_final-var2. ENDLOOP. Q: I am posting ALV Part also my alv all the value showing instesd of var2.. TYPE-POOLS : slis. DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE, gd_layout TYPE slis_layout_alv, gd_repid LIKE sy-repid. fieldcatalog-col_pos = 0. fieldcatalog-fieldname = 'WERKS'. fieldcatalog-seltext_l = 'Personel Area'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 10. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. fieldcatalog-col_pos = 1. fieldcatalog-fieldname = 'FULLNAME'. fieldcatalog-seltext_l = 'PAYROLL AREA'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 15. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. fieldcatalog-col_pos = 2. fieldcatalog-fieldname = 'PERSG'. fieldcatalog-seltext_l = 'Employee Group'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 10. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. fieldcatalog-col_pos = 3. fieldcatalog-fieldname = 'MGT_NAME'. fieldcatalog-seltext_l = 'EMPLOYEE GROUP'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 15. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. * * * * * * * * * fieldcatalog-col_pos = 4. fieldcatalog-fieldname = 'PTEXT'. fieldcatalog-seltext_l = 'Employee Category'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 15. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. fieldcatalog-col_pos = 4. fieldcatalog-fieldname = 'SRNO'. fieldcatalog-seltext_l = 'NUMBER OF EMPLOYEES'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 15. fieldcatalog-key = ' '.
fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. fieldcatalog-col_pos = 5. fieldcatalog-fieldname = 'VAR2'. fieldcatalog-seltext_l = 'total'. fieldcatalog-tabname = 'IT_FINAL1'. fieldcatalog-outputlen = 15. fieldcatalog-key = ' '. fieldcatalog-no_out = ' '. APPEND fieldcatalog. CLEAR fieldcatalog. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = sy-repid i_grid_title = 'MAN POWER DETAILS.' * i_callback_top_of_page = 'TOP_OF_PAGE' is_layout = gd_layout * ls_line-info = wa_final-endda it_fieldcat = fieldcatalog[] i_default = 'A' TABLES t_outtab = it_final1 EXCEPTIONS program_error =1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ANS 3 to Q: you can modify this loop, LOOP AT p0001." where abkrs = PNPABKRS-LOW. wa_final-werks = p0001-werks. wa_final-persg = p0001-persg. wa_final-endda = p0001-endda. wa_final-abkrs = p0001-abkrs. wa_final-srno = 1. var2 = var2 + 1. " Table index APPEND wa_final TO it_final. CLEAR wa_final . ENDLOOP. & you can include the var2 variable in your it_final structure's first field. & add it in your field catalog.. ANS 1: This will solve your purpose "declare var in internal table of it_final & it_final1. LOOP AT it_final INTO wa_final. at new "unique field. clear var. endat. var = 1. wa_final-var = var. COLLECT wa_final INTO it_final1. clear: wa_final, var. ENDLOOP. " your fieldcat.