Subroutine (perform) inside the include program
Hi all,
i am writting a subroutine inside an include.include itself is present inside a subroutine.
form x.
include xyz.
endform.
inside this include, structure of program is like below.
include xyx.
perform y.
perform z.
form y.
endform.
form z.
endform.
so i am geting error like before statement form structure introduced by form must be ended with endform.
can i use perform & form statement inside include?
if not then how is it possible to put perform statements inside that include. this include is nothing but an exit
of program--MV50AFZ1.plz suggest me .it is very urgent.
any suggestion will be highly appreaciated.
Regards
pabitra
<b>inside this include, structure of program is like below.</b>
include xyx.
perform y.
perform z.
form y.
endform.
form z.
endform.
Maintain separate Include to keep the FORMS when u ae defining PERFORMS in Include program. Then it will allow u to activate
Similar Messages
-
How to use the variables of Function exit in the include program
i have a problem of using the variables of a function exit in the include program..
If i use those variables there will be an error indicating 'Field FEBVW_IN is unknown. It is neither in one of the specified tables nor defined by a DATA statement'. Please help... Below is the code of the function exit:
FUNCTION EXIT_SAPLIEDP_202.
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(IDOC_CONTROL_INDEX)
*" VALUE(IDOC_DATA_INDEX)
*" VALUE(FEBVW_IN) LIKE FEBVW STRUCTURE FEBVW
*" VALUE(FEBKO_IN) LIKE FEBKO STRUCTURE FEBKO
*" VALUE(FEBEP_IN) LIKE FEBEP STRUCTURE FEBEP
*" VALUE(FEBRE_IN) LIKE FEBRE STRUCTURE FEBRE
*" VALUE(FEBPI_IN) LIKE FEBPI STRUCTURE FEBPI
*" EXPORTING
*" VALUE(I_FIMSG) LIKE FIMSG STRUCTURE FIMSG
*" VALUE(FEBVW_OUT) LIKE FEBVW STRUCTURE FEBVW
*" VALUE(FEBKO_OUT) LIKE FEBKO STRUCTURE FEBKO
*" VALUE(FEBEP_OUT) LIKE FEBEP STRUCTURE FEBEP
*" VALUE(FEBRE_OUT) LIKE FEBRE STRUCTURE FEBRE
*" VALUE(FEBPI_OUT) LIKE FEBPI STRUCTURE FEBPI
*" TABLES
*" IDOC_CONTROL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_AVIP STRUCTURE AVIP OPTIONAL
*" IDOC_AVIR STRUCTURE AVIR OPTIONAL
*" IDOC_AVIT STRUCTURE AVIT OPTIONAL
*" CHANGING
*" REFERENCE(IDOC_AVIK) TYPE AVIK OPTIONAL
*" EXCEPTIONS
*" PROC_ERROR
INCLUDE ZXF08U10.
Here is the code for the include program.
INCLUDE ZXF08U10
MOVE febvw_in TO febvw_out.Sometimes you will get this error message when checking include code in exits even though there is really no error - it happens because the include does not realise it is in the function due to the navigation index being out of date.
Try activating the code - it may work even though the check said there were errors.
You can also get this issue when trying to drill down on the field in the include to view its structure.
Andrew -
Procedure to find the exit name from the include program
hai
i know the name of the include program
through this i want to know the user exit name
what is procedure?
please give me the details
ThanksHi,
Enter include name in se38 ..check where used option for this include.Using backward approach you can get to the exit.
Thanks.
Mark points if helpful. -
Canu00B4t create the include program HPEPAYMACRO
Can any one help me???
The paymacro is not defined for Perú so I need to create the include program HPEPAYMACRO as copy from H99PAYMACRO, when I try to do the copy there is a error message "Object name HPEPAYMACRO reserved for package P", but the package P does not exist.
How could I create the program HPEPAYMACRO?
Thanks for advance.Hi Rich,
You're right, it's a warning, I just have to press enter to continue...
Thanks,
Huong Le -
How to perform subroutine form in an include program?
Hi all,
I would like to perform an external subroutine form residing in an include program from a customer function user exit. I tried using the following code, but it dumps:
PERFORM <form name> IN PROGRAM (lv_program)
TABLES <a> <b> USING <c>.
In the dump analysis I see that "Program <include name> is type I and therefore cannot be generated" and "The current ABAP/4 program attempts to call the program <include name> but this program cannot be executed. Therefore,the current program had to be terminated. "
If the include can't be generated, is there another way or method I could directly call the form without needing to copy the standard code to an own function or form?
Best regards,
MikkoHi,
take this example..
perform idoc_status_record_write in program sapmsed7 using
x_edidc-docnum
c_idoc_status_ready
space
space
space
space
space
space.
in this the from is in include, but while calling you need to call with the help of main program.
in this case <b>SAPMSED7</b> main program, but form is in include <b>MSED7F05</b>
Regards
vijay -
How to improve the performance of the abap program
hi all,
I have created an abap program. And it taking long time since the number of records are more. And can anyone let me know how to improve the performance of my abap program.
Using se30 and st05 transaction.
can anyone help me out step by step
regds
harithaHi Haritha,
->Run Any program using SE30 (performance analysis)
Note: Click on the Tips & Tricks button from SE30 to get performance improving tips.
Using this you can improve the performance by analyzing your code part by part.
->To turn runtim analysis on within ABAP code insert the following code
SET RUN TIME ANALYZER ON.
->To turn runtim analysis off within ABAP code insert the following code
SET RUN TIME ANALYZER OFF.
->Always check the driver internal tables is not empty, while using FOR ALL ENTRIES
->Avoid for all entries in JOINS
->Try to avoid joins and use FOR ALL ENTRIES.
->Try to restrict the joins to 1 level only ie only for tables
->Avoid using Select *.
->Avoid having multiple Selects from the same table in the same object.
->Try to minimize the number of variables to save memory.
->The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)
->Avoid creation of index as far as possible
->Avoid operators like <>, > , < & like % in where clause conditions
->Avoid select/select single statements in loops.
->Try to use 'binary search' in READ internal table. -->Ensure table is sorted before using BINARY SEARCH.
->Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)
->Avoid using ORDER BY in selects
->Avoid Nested Selects
->Avoid Nested Loops of Internal Tables
->Try to use FIELD SYMBOLS.
->Try to avoid into Corresponding Fields of
->Avoid using Select Distinct, Use DELETE ADJACENT
Check the following Links
Re: performance tuning
Re: Performance tuning of program
http://www.sapgenie.com/abap/performance.htm
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
check the below link
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
See the following link if it's any help:
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
Check also http://service.sap.com/performance
and
books like
http://www.sap-press.com/product.cfm?account=&product=H951
http://www.sap-press.com/product.cfm?account=&product=H973
http://www.sap-img.com/abap/more-than-100-abap-interview-faqs.htm
http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
Performance tuning for Data Selection Statement
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
Debugger
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
Run Time Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
SQL trace
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
CATT - Computer Aided Testing Too
http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
Test Workbench
http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
Coverage Analyser
http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
Runtime Monitor
http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
Memory Inspector
http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
ECATT - Extended Computer Aided testing tool.
http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm
Just refer to these links...
performance
Performance
Performance Guide
performance issues...
Performance Tuning
Performance issues
performance tuning
performance tuning
You can go to the transaction SE30 to have the runtime analysis of your program.Also try the transaction SCI , which is SAP Code Inspector.
edited by,
Naveenan -
Performance of the Report Program
Hello experts,
I had a requirement like following
Selection parameters:
Material (lips-matnr)
Sold to party(likp-kunag): can hardcode it to 5090
Sales Org(likp-vkorg)
Plant(lips-werks) : hard code it to plant:9000
Sales order(likp-vbeln)
Actual goods movement dates(likp-wadat_ist)
Invoice number
Sales order
Output
material numberlips~matnr ( should Display only S* materials and material type FERT)
Serial number of the device shipped (objk-sernr)
Delivery number (lips~vbeln)
Invoice number (vbrp-vbeln)
Invoice price=Vbrp-vbeln/quantity (invoice price)
Notification number (Viqmel-QMNUm)
KBB Repair Level(VIQMEL-QMTXT from QMCOD )
KBC Repair level(VIQMMA-MNCOD from KBC-SM07 code group(VIQMMA-MNGRP))
and I wrote a program but its taking lot of time to run
Can anyone help me in changing the logic of the program,
TABLES: likp, lips, vbfa, vbak.
TYPE-POOLS: slis.
/ Selection and Input Parameters
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003.
SELECT-OPTIONS: s_matnr FOR lips-matnr,
s_kunag FOR likp-kunag.
SELECT-OPTIONS: s_vkorg FOR likp-vkorg NO INTERVALS,
s_werks FOR lips-werks.
SELECT-OPTIONS: s_vbeln FOR likp-vbeln,
s_waist FOR likp-wadat_ist.
SELECT-OPTIONS: s_vgbel FOR lips-vgbel.
SELECTION-SCREEN END OF BLOCK block2.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
TYPES: BEGIN OF ty_data,
matnr LIKE lips-matnr,
lsernr LIKE mase-lsernr,
vbeln LIKE likp-vbeln,
invno like vbrp-vbeln,
netwr like vbrp-netwr,
qmnum LIKE viqmel-qmnum,
mngrp like viqmma-mngrp,
mncod like viqmma-mncod,
END OF ty_data.
DATA: gt_data TYPE TABLE OF ty_data WITH HEADER LINE.
START-OF-SELECTION.
PERFORM get_data.
IF NOT gt_data[] IS INITIAL.
PERFORM display_data.
ELSE.
MESSAGE s000(z1) WITH 'No data found'.
ENDIF.
*& Form get_data
FORM get_data.
SELECT lips~matnr mase~lsernr likp~vbeln vbrp~vbeln vbrp~netwr
viqmel~qmnum viqmel~qmcod viqmma~mngrp viqmma~mncod
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM likp INNER JOIN lips ON lips~vbeln = likp~vbeln
INNER JOIN vbrp ON vbrp~vgbel = lips~vgbel AND
vbrp~matnr = lips~matnr
INNER JOIN mase ON mase~matnr = lips~matnr
INNER JOIN viqmel ON viqmel~matnr = lips~matnr AND
viqmel~serialnr = mase~lsernr
INNER JOIN viqmma ON viqmma~qmnum = viqmel~qmnum
WHERE lips~matnr IN s_matnr
AND lips~werks IN s_werks
AND likp~kunag IN s_kunag
AND likp~wadat_ist IN s_waist
AND lips~vgbel IN s_vgbel
AND likp~vkorg IN s_vkorg
and likp~vbeln in s_vbeln
AND lips~matnr LIKE 'S%'
AND EXISTS ( SELECT * FROM mara WHERE matnr = lips~matnr
AND mtart = 'FERT' ).
ENDFORM. " get_data
& Form display_data
FORM display_data.
DATA: lv_repid TYPE sy-repid.
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = lv_repid
i_internal_tabname = 'GT_DATA'
CHANGING
ct_fieldcat = gt_fieldcat[].
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = lv_repid
it_fieldcat = gt_fieldcat
i_save = 'A'
TABLES
t_outtab = gt_data.
ENDFORM.U can try two things instead of the EXISTS where clause.
1. U have select-option for matnr so need to use that
2. Inner join LIPS to mara on matnr and apply the filter on MTART field.
SELECT lipsmatnr maselsernr likpvbeln vbrpvbeln vbrp~netwr
viqmelqmnum viqmelqmcod viqmmamngrp viqmmamncod
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM likp INNER JOIN lips ON lipsvbeln = likpvbeln
INNER JOIN vbrp ON vbrpvgbel = lipsvgbel AND
vbrpmatnr = lipsmatnr
INNER JOIN mase ON masematnr = lipsmatnr
INNER JOIN mara on lipsmatnr = maramatnr
INNER JOIN viqmel ON viqmelmatnr = lipsmatnr AND
viqmelserialnr = maselsernr
INNER JOIN viqmma ON viqmmaqmnum = viqmelqmnum
WHERE lips~matnr IN s_matnr
AND lips~werks IN s_werks
AND likp~kunag IN s_kunag
AND likp~wadat_ist IN s_waist
AND lips~vgbel IN s_vgbel
AND likp~vkorg IN s_vkorg
and likp~vbeln in s_vbeln
AND lips~matnr LIKE 'S%'
and mara~mtart = 'FERT'.
Regards
Anurag
Message was edited by: Anurag Bankley -
Increasing the performance of the abap program
Hi ,
Anybody had any document regarding how to increase the performance of ABAP program.
Regards,
baijuhi,
Refer This link.
<b>
Performance tuning for Data Selection Statement</b>
http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
<b>
1. Debugger</b>
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617ca9e68c11d2b2ab080009b43351/content.htm
http://www.cba.nau.edu/haney-j/CIS497/Assignments/Debugging.doc
http://help.sap.com/saphelp_erp2005/helpdata/en/b3/d322540c3beb4ba53795784eebb680/frameset.htm
<b>2. Run Time Analyser</b>
http://help.sap.com/saphelp_47x200/helpdata/en/c6/617cafe68c11d2b2ab080009b43351/content.htm
<b>3. SQL trace</b>
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801f7c454211d189710000e8322d00/content.htm
<b>4. CATT - Computer Aided Testing Too</b>
http://help.sap.com/saphelp_47x200/helpdata/en/b3/410b37233f7c6fe10000009b38f936/frameset.htm
<b>
5. Test Workbench</b>
http://help.sap.com/saphelp_47x200/helpdata/en/a8/157235d0fa8742e10000009b38f889/frameset.htm
<b>
6. Coverage Analyser</b>
http://help.sap.com/saphelp_47x200/helpdata/en/c7/af9a79061a11d4b3d4080009b43351/content.htm
<b>
7. Runtime Monitor</b>
http://help.sap.com/saphelp_47x200/helpdata/en/b5/fa121cc15911d5993d00508b6b8b11/content.htm
<b>
8. Memory Inspector</b>
http://help.sap.com/saphelp_47x200/helpdata/en/a2/e5fc84cc87964cb2c29f584152d74e/content.htm
<b>9. ECATT - Extended Computer Aided testing tool.</b>
http://help.sap.com/saphelp_47x200/helpdata/en/20/e81c3b84e65e7be10000000a11402f/frameset.htm -
Sales order Update indicator in the include program MV45AFZZ
Hi All,
Can somebody will give idea how do we can find whether the sales order is creating or changing when we are writing some code in the user exit MV45AFZZ.I checked in this program we can find only at item level XVBAP-UPDKZ but i want this at the header level.
One way we can find this is by checking SY-TOCDE = VA01 but this condition fail if we create sales order using the BAPI.
Regards
MaheshIn create mode XVBAK-VBELN will be initial, where as in change mode it contains sales order number.
-
Subroutine in function module exit include program
Hi Friend,
I want to modularise the code inside the include program defined in funtion module exit. but it is giving out errors.
Can any one help on this.
Regards
GauthamHello Gautam,
Use the PERFORM (FORM ................. ENDFORM.) for modularizing the code inside the function module exit. You can not use the include inside the function module directly but once u create a PERFORM (FORM ................. ENDFORM.). Inside this FORM ................. ENDFORM .. u can create any number of include's.
I hope it will resolve your problem.
Thanks.
Anurag -
Finding include program of the subroutine by program
Hi All
Is it possible to find the include program name of the sub-routine by any FM .
Thanks
Vinay kollai have got sub routine name , is there way to program and find the main include program of it .if yes how .
Thanks
Vinay kolla -
Subroutine inconsistency due to deletion of Include program
Hi All,
I created an include program(saved in local object) within my report(this was previously stored in a package) and I copied a few performs and forms from my report into the include program, but then i decided to go for the code without the include and commented the include statement in my report and deleted the include program(in se38). But now when I click on the perform statement in my report it gives a message "Object ZXY not found". The ZXY is my include program. Also when I view the report in se80 I find repetitive sub routines.Also I am not able to delete the duplicate sub routines in se80.
How can we overcome this inconsistency in duplication of subroutines, how to suppress the message and make sure the code is consistent?Hi,
So currently all the performs in program are part of some other include which is part of your main program?Because if not , obviously an error will be thrown.
Have you tried the option of rebuilding object list for the whole program?
Right click on the program name in SE80--> Other functions->Rebuild object List
Regards,
Arun
Edited by: arun warrier on Nov 30, 2011 1:36 PM -
Regarding the userexits Include program
hi frndz,
plz don't give me the program which is circulating in forum bcoz i kno tht progm it gives the userexit and BADI but i want to get the include programs for eg:MV45FZZ for VA01 tcode....how to get the include programs like this for other tcodes.
i think this include progm is to validate the fields in VA01....like this how to validate the fields of other tcodes or screens.
Thanks.
Points will be rewarded for rgt ans.
Arunprasad.Phi frndz,
plz don't give me the program which is circulating in forum bcoz i kno tht progm it gives the userexit and BADI but i want to get the include programs for eg:MV45FZZ for VA01 tcode....how to get the include programs like this for other tcodes.
i think this include progm is to validate the fields in VA01....like this how to validate the fields of other tcodes or screens.
Thanks.
Points will be rewarded for rgt ans.
Arunprasad.P -
How to identify userexits include program which can be modified
hi frndz,
plz don't give me the program which is circulating in forum bcoz i kno tht progm it gives the userexit and BADI but i want to get the include programs for eg:MV45FZZ for VA01 tcode....how to get the include programs like this for other tcodes.
i think this include progm is to validate the fields in VA01....like this how to validate the fields of other tcodes or screens.
Thanks.
Points will be rewarded for rgt ans.
Arunprasad.PHello,
as the real world is - there are very different types of 'userexits' inside SAP.
These programs identifing SMOD-Exits and BADI's are quite helpful, but they won't find any old exit's
like the MV45AFZZ.
I don't know a program which could do that - it would have to scan programs for subroutines maned 'userexit'. But this logic is the oldest logic existing from release 3.0 (or older ??). And (i think) only in SD-related programs. In that area you find the exit's via transaction SPRO -> Sales and Distribution -> system modification.
Regards Wolfgang -
To improve the system performance of the code
Please help me to improve the system performance of the following program. its very urgent
report zsdr0125
no standard page heading
* LINE-SIZE 170 " SIR 061880
line-size 210 " SIR 061880
line-count 58
message-id zz.
** Report header ******************************************************
** Report name: Activity Costing Report
** Report id: RO-01148
** Designed/Coded. Tori Chandler. Reporting Team.
** Date: March 01, 2000.
** Original SIR: 016113
** Application Area: V - Sales & Distribution (OTC)
** Correction/Transport: D10K951579
** Description: It is normal business practice for logistics
** operations to charge business units for the activity
** incurred on their behalf. This is consistent with
** activity based costing principles between BU and
** shared resources. The activities involved are picking
** storage, shipping and receiving. The purpose of this
** report is to provide data for the first 3.
** QRB2 - 03/13/2000 - Tracy, Antoine, Christian, Tori
** History:
* 06/14/2001 SIR 032383 CTS Antoine Dailly
* A plant (WERKS) can have several Distrib points (VSTEL)
* SIGN = 032383
* Modification History:
* Date Modified by SIR CTS Description
*11/14/2001 J.CAMPION 034606 D10K979189 Logistics Activity report
* Logistics Activity reports
* We added fields ship to customer and country and we also make another
* total
* QRB2 Tracy L. Obrien
* Modification History:
* Date Modified by SIR CTS Description
*11/14/2001 J.CAMPION 37838 D10K982890 Select only
* material type HALB
*06/12/2002 T OBrien 38784 D10K988181
* Allow option to get material weight from Master data or
* from the delivery.
* Modified by SIR CTS Date
* Jim Harwood 42730 D10K993119 10 Oct 2002
* Description: Code amended to default the Goods Issue Date range to
* the previous month. Also amended to print out the Select Options.
* Modified by SIR CTS Date
* Jim Harwood 44381 D10K994598 18 Nov 2002
* Description: Correct date range processing. APPEND statement added
* so that record is added ot internal table S_WADAT. Also S_VKORG
* removed as it was NO DISPLAY and nothing was assigned to it. It's use
* in an SQL call may be causing the wrong optimization.
* Modified by SIR CTS Date
* Tori Chandler 45567 D10K995875 03 Jan 2003
* Description: Correct reporting of weights for non-pickable items
* when the Material Master Data radiobutton is selected. Also found
* from SIR 37838, that material type is hardcoded on the LIPS. I
* created a new select option and the person needing the report
* can control if they want only HALB or all line items. Also,
* because of this the delivery weight is obtain from header,
* changing to accumulate from LIPS to match which lines are selected
* QRB2: 1/15/2003: Eileen, Jerome and Tori
*{ INSERT D11K901833 1
* Modified by Sir CTS Date
* Sue Kastan 48712/054042 D11K901833 28 Aug, 2003
* Fix overcounting of records from LIPS
*} INSERT
* Modified by SIR CTS Date *
* Vijay Andea 061880 D11K918628 04/20/2006 *
* D11K946194 *
* Description: Enhence ZSDR0125 Activity Cost Driver Report to allow *
* Analysis by Product Groupings. *
*} INSERT
* Modified by SIR CTS Date *
* Prakash Arunachalam 091510 D11K950288 09/26/2006 *
* Description: Correct Activity Cost report - material weight *
* calculation *
* Modified by SIR CTS Date *
* Murali Krishna 301978 D50K903293 01/20/2008
* Description: Improve the system performance of this report and
* clean-up of code into various form routine
* Table declaration.
tables: likp, " SD Document: Delivery Header Data
lips, " SD document: Delivery: Item data
vepo, " SD Document: Shipping Unit Item (Content)
vekp, " SD Document: Shipping Unit Header
knvv, " Customer Master Sales Data
kna1, " General Data in Customer Master SIR 34606
marm, " Units of Measure
mara, " Material Master: General Data SIR 38784
t001l, " Stge locs
t001k, " Valuation area
tvswz, " Shipping Points per Plant
t134, " Material types
z0234. " Alternative Unit of Measure
*** Selection screen.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like t001l-werks obligatory memory id wrk.
select-options: s_lgort for t001l-lgort,
* S_VKORG FOR TVKO-VKORG NO-DISPLAY ," SIR 34606, 42730
* S_WADAT FOR LIKP-WADAT_IST OBLIGATORY NO-EXTENSION,
s_wadat for likp-wadat_ist no-extension, " SIR 42730
s_mtart for t134-mtart, " SIR 45567
s_lfart for likp-lfart no-display no intervals.
selection-screen skip 2.
selection-screen comment 1(21) text-002. " SIR 38784
parameters: p_delwt radiobutton group grp1, " SIR 38784
p_mstwt radiobutton group grp1. " SIR 38784
*--------------------------------------------------*Start of SIR 061880
selection-screen skip 2.
selection-screen comment 1(21) text-006.
parameters: p_voldl radiobutton group 2, " Volume from Delivery
p_volmd radiobutton group 2. " Volume from Master Data
*-----------------------------------------------------End of SIR 061880
selection-screen end of block b1.
*--------------------------------------------------*Start of SIR 061880
selection-screen begin of block b2 with frame title text-007.
select-options: s_cbuun for knvv-kvgr1 no intervals, " Customer BU
s_mbuun for mara-prdha+1(2) no intervals, " Material BU
s_lobus for mara-prdha+3(3) no intervals, " LOB
s_pac1 for mara-prdha+6(3) no intervals. " PAC1
selection-screen end of block b2.
*----------------------------------------------------*End of SIR 061880
*---Type Declaration for Internal Tables------------------------------*
types: begin of t_likp,
vbeln like likp-vbeln, " delivery
vstel like likp-vstel, " shipping point
lfart like likp-lfart, " delivery type
vkorg like likp-vkorg, " Sales organization
kunag like likp-kunag, " sold-to party
kunnr like likp-kunnr, " ship to party SIR 34606
btgew like likp-btgew, " Delivery weight
gewei like likp-gewei, " Unit of weight
anzpk like likp-anzpk, " Number of Packages SIR 61880
volum like likp-volum, " Delivery Volume SIR 61880
voleh like likp-voleh, " Volume Unit SIR 61880
vtwiv like likp-vtwiv, " Distribution channel
spaiv like likp-spaiv, " Division
wadat_ist like likp-wadat_ist, " actual goods issue date
del_flg(1) type c, "(+) SIR 301978
end of t_likp.
types: begin of t_lips,
vbeln like lips-vbeln, " delivery
posnr like lips-posnr, " delivery line
matnr like lips-matnr, " material
lgort like lips-lgort, " storage location
prodh like lips-prodh, " product hierarchy
meins like lips-meins, " base UoM
brgew like lips-brgew, " Material weight
gewei like lips-gewei, " Unit of weight
volum like lips-volum, " Material Volume SIR 61880
voleh like lips-voleh, " Volume Unit SIR 61880
lgmng like lips-lgmng, " actual delivery quantity
komkz like lips-komkz, " Indicator for picking control
mtart like lips-mtart, " Material type " SIR 37838
del_flg(1) type c, "(+) SIR 301978
end of t_lips.
types: begin of t_vepo,
venum like vepo-venum, " shipping unit number
vbeln like vepo-vbeln, " delivery
end of t_vepo.
types: begin of t_vekp,
venum like vekp-venum, " shipping unit number
brgew like vekp-brgew, " actual weight
gewei_max like vekp-gewei_max, " unit of weight
vpobjkey like vekp-vpobjkey, " key for assigned object
end of t_vekp.
types: begin of t_knvv,
kunnr like knvv-kunnr, " customer number
ktgrd like knvv-ktgrd, " acct assign group
kvgr1 like knvv-kvgr1, " customer group 1
end of t_knvv.
types: begin of t_kna1, " SIR 34606
kunnr like kna1-kunnr, " customer number " SIR 34606
land1 like kna1-land1, " contry " SIR 34606
end of t_kna1. " SIR 34606
types: begin of t_marm,
matnr like marm-matnr, " material
meinh like marm-meinh, " Alt unit of measure 032383
umrez like marm-umrez, " numerator
umren like marm-umren, " denominator
end of t_marm.
types: begin of t_mara, " SIR 38784
matnr like mara-matnr, " material " SIR 38784
prdha like mara-prdha, " Product Hierarchy " SIR 61880
brgew like lips-brgew, " gross weight " SIR 38784
gewei like mara-gewei, " Unit of weight " SIR 38784
volum like mara-volum, " Volume " SIR 61880
voleh like mara-voleh, " Volume Unit " SIR 61880
del_flg(1) type c, "(+) SIR 301978
end of t_mara. " SIR 38784
types: begin of t_tvswz,
vstel like tvswz-vstel, " shipping point
end of t_tvswz.
types: begin of t_z0234, "032383
vstel like z0234-vstel, " shipping point 032383
zpaluom like z0234-zpaluom," pallet unit of measure 032383
zcsuom like z0234-zcsuom," Case unit of measure 032383
end of t_z0234. "032383
types: begin of t_output_dt,
wadat_ist like likp-wadat_ist, " Goods issue date
ktgrd like knvv-ktgrd," acct assign group
bu like knvv-kvgr1," business unit
kunnr like kna1-kunnr," ship to location SIR 34606
land1 like kna1-land1," ship to location SIR 34606
d_btgew like likp-btgew," delivery weight
m_brgew like lips-brgew," material weight
a_brgew like vekp-brgew," actual weight of ship unit
num_del type i, " counter of deliveries
num_pallets type i, " number of pallets
num_cases type i, " number of cases
num_loose type i, " loose quantity
num_delln type i, " counter of delivery lines
* packages like likp-anzpk," Number of Packages " SIR 61880
packages(3) type p, " Number of Packages " SIR 61880
volume like lips-volum," Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_dt.
types: begin of t_output_ag,
ktgrd like knvv-ktgrd," acct assign group
bu like knvv-kvgr1," business unit
land1 like kna1-land1," country SIR 34606
d_btgew like likp-btgew," delivery weight
m_brgew like lips-brgew," material weight
a_brgew like vekp-brgew," actual weight of ship unit
num_del type i, " counter of deliveries
num_pallets type i, " number of pallets
num_cases type i, " number of cases
num_loose type i, " loose quantity
num_delln type i, " counter of delivery lines
* packages like likp-anzpk," Number of Packages " SIR 61880
packages(3) type p, " Number of Packages " SIR 61880
volume like lips-volum," Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_ag.
types: begin of t_output_gs, " SIR 34606
ktgrd like knvv-ktgrd," acct assign group " SIR 34606
bu like knvv-kvgr1," business unit " SIR 34606
d_btgew like likp-btgew," delivery weight " SIR 34606
m_brgew like lips-brgew," material weight " SIR 34606
a_brgew like vekp-brgew," actual weight " SIR 34606
num_del type i, " counter of deliv " SIR 34606
num_pallets type i, " number of pallets " SIR 34606
num_cases type i, " number of cases " SIR 34606
num_loose type i, " loose quantity " SIR 34606
num_delln type i, " counter of deliv " SIR 34606
* packages like likp-anzpk, " Number of Package " SIR 61880
packages(3) type p, " Number of Packages" SIR 61880
volume like lips-volum, " Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_gs. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* Material Type
types: begin of t_mtart,
mtart like t134-mtart, " Material Type
end of t_mtart.
* Customer Business Unit.
types: begin of t_kvgr1,
kvgr1 like knvv-kvgr1, " Customer Group 1
end of t_kvgr1.
* sales Organization.
types: begin of t_lgort,
lgort like t001l-lgort, " Sales Organization
end of t_lgort.
* Begin of SIR 301978
* Header: Material Document
types: begin of t_mkpf,
vgart type mkpf-vgart,
xblnr type likp-vbeln,
end of t_mkpf.
* End of SIR 301978
*---------------------------------------------------* End of SIR 061880
*---Internal Tables---------------------------------------------------*
data: i_likp type t_likp occurs 0 with header line,
i_temp_likp type t_likp occurs 0 with header line,
v_likp type t_likp,
i_lips type t_lips occurs 0 with header line,
i_temp_lips type t_lips occurs 0 with header line,
v_lips type t_lips,
i_vepo type t_vepo occurs 0,
* V_VEPO TYPE T_VEPO,
i_vekp type t_vekp occurs 0,
v_vekp type t_vekp,
i_knvv type t_knvv occurs 0 with header line,
v_knvv type t_knvv,
i_kna1 type t_kna1 occurs 0, " SIR 34606
v_kna1 type t_kna1, " SIR 34606
i_z0234 type t_z0234 occurs 0, " 032383
v_z0234 type t_z0234, " 032383
i_z0234_uom type t_z0234 occurs 0, " 032383
v_z0234_uom type t_z0234, " 032383
i_marm type t_marm occurs 0 with header line," SIR 61880
i_marm_pallet type t_marm occurs 0 with header line,
v_marm_pallet type t_marm,
i_marm_case type t_marm occurs 0 with header line,
v_marm_case type t_marm,
*-------------------------------------------------* Begin of SIR 061880
* I_MARA TYPE T_MARA OCCURS 0, " SIR 38784
i_mara1 type t_mara occurs 0 with header line,
i_mtart type t_mtart occurs 0 with header line,
i_kvgr1 type t_kvgr1 occurs 0 with header line,
i_lgort type t_lgort occurs 0 with header line,
v_kvgr1 type t_kvgr1,
*---------------------------------------------------* End of SIR 061880
v_mara type t_mara, " SIR 38784
i_tvswz type t_tvswz occurs 0,
v_tvswz type t_tvswz, "(+) SIR 301978
i_output_dt type t_output_dt occurs 0,
v_output_dt type t_output_dt,
i_output_ag type t_output_ag occurs 0,
v_output_ag type t_output_ag,
i_output_gs type t_output_gs occurs 0, " SIR 34606
v_output_gs type t_output_gs, " SIR 34606
i_mkpf type table of t_mkpf with header line."SIR 301978
*** Data Declarations *
data: v_page(3) type c, " Page Counter
v_comp like t001k-bukrs, " zbsn0001 company code
v_title(24) type c, " zbsn0001 report title
v_rpttyp type c, " report type
v_ok type c, " control While... endwhile
v_diff_date type p, " days between selection
v_werks like t001l-werks, " plant
* v_z0234_zpaluom like z0234-zpaluom, " Pallet Unit of Measure
* v_z0234_zcsuom like z0234-zcsuom, " Case Unit of Measure
v_palwto type p decimals 6, " SIR 091510
* "like likp-btgew, " Weight after conversion
v_vekp_tabix like sy-tabix, " index on read
v_vekp_sum_brgew like vekp-brgew, " actual weight
v_pallet_qty like lips-lgmng, " calculated pallet qty
v_pallet_integer type i, " true pallet qty
v_case_qty like lips-lgmng, " calculated case qty
v_case_integer type i, " true case qty
v_qty_not_pallets like lips-lgmng, " calculated
v_num_pallets like lips-lgmng, " calculated nbr of pallets
v_num_pallets_int type i, " true nbr of pallets
v_num_cases like lips-lgmng, " calculated nbr of cases
v_num_cases_int type i, " true nbr of cases
v_total_case_qty like lips-lgmng, " case quantity
v_loose_qty type i, " calculated loose quantity
*-------------------------------------------------* Begin of SIR 061880
v_volume like lips-volum, " Volume After Convertion
v_cbuun like knvv-kvgr1, " Customer BU
v_mbuun like knvv-kvgr1, " Material BU
v_lobus(3) type c, " Line of Business
v_pac1(3) type c, " PAC1
v_flag type c. " Flag Indicator for No Data
*---------------------------------------------------* End of SIR 061880
* Begin of SIR 301978
* Ranges
ranges : r_vstel for tvswz-vstel.
* End of SIR 301978
* Constants
data: c_uom(3) type c value 'KG'. " Kilogram Unit of Meas.
data : c_vom like mara-voleh value 'M3'. " Metter Cube. " SIR 061880
constants : c_wl(2) type c value 'WL'. "(+) SIR 301978
* Initialization.
initialization.
s_lfart-sign = 'I'.
s_lfart-option = 'EQ'.
s_lfart-low = 'LF '.
append s_lfart.
s_lfart-low = 'NL '.
append s_lfart.
s_lfart-low = 'NLCC'.
append s_lfart.
s_lfart-low = 'ZLFI'.
append s_lfart.
* AT SELECTION-SCREEN.
at selection-screen.
* SIR 42730 - If no Goods Issue Date has been specified in the
* Select Options set the range to the previous month.
if s_wadat-low is initial.
s_wadat-sign = 'I'.
s_wadat-option = 'BT'.
s_wadat-high = sy-datum. " Today's date
s_wadat-high+6(2) = '01'. " First of this month
s_wadat-high = s_wadat-high - 1. " End of last month
s_wadat-low = s_wadat-high. " End of last month
s_wadat-low+6(2) = '01'. " First of last month
append s_wadat.
endif. " SIR 42730 IF S_WADAT-LOW IS INITIAL.
clear v_werks. "(+) SIR 301978
* Validate Plant/Storage Location from selection screen
select werks up to 1 rows into v_werks from t001l
where werks = p_werks and
lgort in s_lgort.
endselect.
if sy-subrc ne 0.
message e045 with text-e01.
endif.
* Validate Storage Location
if not s_lgort[] is initial.
select lgort from t001l into table i_lgort where lgort in s_lgort.
if sy-subrc ne 0.
message e045 with text-e09.
endif.
endif.
* Validate date range. do not allow more that 31 days
if not s_wadat-high is initial.
v_diff_date = s_wadat-high - s_wadat-low.
if v_diff_date >= '31'.
message e045 with text-e02.
endif.
endif.
*-------------------------------------------------* Begin of SIR 061880
* Validation for Material Type in Selection Screen
if not s_mtart[] is initial.
select mtart from t134 into table i_mtart where mtart in s_mtart.
if sy-subrc ne 0.
message e045 with text-e07.
endif.
endif.
at selection-screen on block b2.
* Validation for Material Business Unit and Customer Business Unit.
if s_cbuun-low is not initial and s_mbuun-low is not initial.
message e045 with text-e05.
endif.
* Validation for Possible combinations of Material BU, Line of Business
* and PAC1
if ( s_mbuun-low is not initial and s_lobus-low is not initial
and s_pac1-low is not initial )
or ( s_mbuun-low is not initial and s_lobus-low is not initial )
or ( s_lobus-low is not initial and s_pac1-low is not initial )
or ( s_mbuun-low is not initial and s_pac1-low is not initial ).
message e045 with text-e06.
endif.
* Validation for Customer Business Unit.
if not s_cbuun[] is initial.
select kvgr1 from tvv1 into table i_kvgr1 where kvgr1 in s_cbuun.
if sy-subrc ne 0.
message e045 with text-e08.
endif.
* free: i_kvgr1.
endif.
*---------------------------------------------------- End of SIR 061880
* TOP-OF-PAGE
* Top of the page routine to print the headers and columns
top-of-page.
format color col_heading on.
if v_rpttyp = 'D'.
v_title = text-h01.
else.
v_title = text-h02.
endif.
perform zbsn0001_standard_header " Standard Report Heading Form
using v_comp v_title 'U' v_page.
skip.
if v_rpttyp = 'D'.
perform write_dtlvl_headings.
else.
perform write_aglvl_headings.
endif.
* FORM WRITE_DTLVL_HEADINGS *
* for date detail level, print the column headers *
form write_dtlvl_headings.
write: /001 text-h03, " Acct
038 text-h04, " ------ P I C K I N G ------
105 text-h05, " ----- S H I P P I N G -----
/001 text-h06, " Group
007 text-h07, " Date
017 text-h08, " BU
021 text-h17, " ship to party 34606
030 text-h18, " country
039 text-h09, " Pallets
057 text-h10, " Cases
075 text-h11, " Loose
093 text-h12, " Lines
105 text-h13, " Material Kg
124 text-h16, " Delivery Kg
143 text-h14, " Actual Kg
161 text-h15, " Deliveries
*----------------------------------------------------Start of SIR 61880
173 text-h20, " Packages
189 text-h21, " Volume
201 text-h22, " LOB
207 text-h23. " PAC1
*-----------------------------------------------------*End of SIR 61880
skip.
endform. " end of write_dtlvl_headings.
* FORM WRITE_AGLVL_HEADINGS *
* for account group detail level, print the column headers *
form write_aglvl_headings.
write: /001 text-h03, " Acct
038 text-h04, " ------ P I C K I N G ------
105 text-h05, " ----- S H I P P I N G -----
/001 text-h06, " Group
017 text-h08, " BU
030 text-h18, " country SIR 34606
039 text-h09, " Pallets
057 text-h10, " Cases
075 text-h11, " Loose
093 text-h12, " Lines
105 text-h13, " Material Kg
124 text-h16, " Delivery Kg
143 text-h14, " Actual Kg
161 text-h15, " Deliveries
*---------------------------------------------------*Start of SIR 61880
173 text-h20, " Packages
189 text-h21, " Volume
201 text-h22, " LOB
207 text-h23. " PAC1
*-----------------------------------------------------*End of SIR 61880
skip.
endform. " end of write_aglvl_headings.
*-------------------------- SUBBROUTINES -----------------------------*
include zbsn0001. " Include to print all Standard Report Titles
include zsdn0004. " Print the Select Options
*** MAIN SELECTION. *
start-of-selection.
refresh: i_likp, i_temp_likp, i_lips, i_temp_lips, i_vepo,
i_vekp, i_knvv, i_marm_pallet, i_marm_case, i_tvswz,
i_output_dt, i_output_ag, i_mara1.
clear: v_likp, v_lips, v_vekp, v_knvv, v_mara,
v_marm_pallet, v_marm_case, v_output_dt, v_output_ag.
v_rpttyp = 'D'.
* SIR 42730 - Echo the Select Options to the output listing and print
* the Goods Issue Date range being used.
write: /,/. " SIR 43730 - Skip a couple of lines to centre it.
perform zsdn0004_print_select_options using sy-cprog ' '.
if s_wadat-high is initial.
write: /,/, text-003, 34 s_wadat-low.
else.
write: /,/, text-003, 34 s_wadat-low, 44 text-004, 47 s_wadat-high.
endif.
new-page.
* Main Processing. *
perform get_data.
if not i_lips[] is initial.
perform create_output.
endif.
* END-OF-SELECTION
end-of-selection.
*-------------------------------------------------* Start of SIR 061880
* PERFORM WRITE_REPORT.
if not i_output_dt[] is initial and not i_output_ag[] is initial and
not i_output_gs[] is initial.
perform write_report.
else.
skip 2.
write:/ text-e03.
skip 2.
uline.
clear: v_flag.
endif.
*---------------------------------------------------* End of SIR 061880
* FORM GET_DATA *
* build all of the internal tables needed for the report *
* selects on t001k, z0234, likp, lips, vepo, vekp, knvv & marm, mara *
form get_data.
perform get_data_t001k. " SIR 301978
perform get_data_tvswz. " SIR 301978
if sy-subrc = 0. " Build shipping point range
perform get_data_Z0234. " SIR 301978
if sy-subrc ne 0.
v_flag = 'X'.
* stop.
else.
sort i_z0234 by vstel. " 032383
endif.
* Begin of SIR 301978
* The data retrievalfrom LIKP has been modified for performance
* reasons
perform get_data_mkpf. " SIR 301978
if sy-subrc eq 0.
* Deleting data other than Goods issued for delivery
delete i_mkpf where vgart ne c_wl.
sort i_mkpf by xblnr.
endif.
* Deleting the data from the internal table i_likp by comparing
* shipping point
r_vstel-sign = 'I'.
r_vstel-option = 'EQ'.
clear : v_tvswz.
loop at i_tvswz into v_tvswz.
r_vstel-low = v_tvswz-vstel.
append r_vstel.
endloop.
if not i_mkpf[] is initial.
perform get_data_likp. " SIR 301978
endif.
if sy-subrc = 0.
delete i_likp where not lfart in s_lfart.
* End of SIR 301978
* Get data for the delivery lines
if not i_likp[] is initial.
perform get_data_lips. " SIR 301978
* Begin of SIR 301978
if i_lips[] is initial.
v_flag = 'X'.
message i089 with text-i02.
leave list-processing.
endif. " Return code for LIPS select
* End of SIR 301978
endif.
*-------------------------------------------------* Begin of SIR 061880
* Get Data From MARA (Material Master) to Read Material Weight and
* Material Voluem from Master Data.
if not i_lips[] is initial.
* Begin of SIR 301978
* Delete the duplicate material from delivery item table
i_temp_lips[] = i_lips[].
sort i_temp_lips by matnr.
delete adjacent duplicates from i_temp_lips comparing matnr.
perform get_data_mara. " SIR 301978
if sy-subrc = 0.
sort i_mara1 by matnr.
clear i_temp_lips.
refresh i_temp_lips.
* End of SIR 301978
else.
v_flag = 'X'.
message i089 with text-i01.
leave list-processing.
endif.
endif.
* Filter I_LIPS and I_MARA1 When Either material BU or Line of
* Business (LOB) or PAC1 are not left Balnk
perform filter_data_for_prdha.
* Get data for the sold-to customer
perform i_knvv_fill_data.
* Filter I_LIKP & I_LIPS & I_MARA for Cust-BU, When Cust-Bu is not
* left Blank.
perform filter_likp_lips_mara_custbu.
*---------------------------------------------------- End of SIR 061880
*-------------------------------------------------* Begin of SIR 034606
* Get data for the ship to party
i_temp_likp[] = i_likp[].
sort i_temp_likp by kunnr.
delete adjacent duplicates from i_temp_likp comparing kunnr.
perform get_data_kna1. " SIR 301978
if sy-subrc = 0.
sort i_kna1 by kunnr.
endif.
*---------------------------------------------------* End of SIR 034606
else.
v_flag = 'X'.
message i089 with text-i04.
leave list-processing.
endif. " return code to LIKP select
* endif. " SIR 061880
free: i_temp_likp.
endif. " return code for TVSWZ select
* Process table LIPS
if not i_lips[] is initial.
i_temp_lips[] = i_lips[].
sort i_temp_lips by vbeln.
delete adjacent duplicates from i_temp_lips comparing vbeln.
* Get actual weight
perform get_data_vepo. " SIR 301978
if sy-subrc = 0.
sort i_vepo by venum.
delete adjacent duplicates from i_vepo comparing venum.
perform get_data_vekp. " SIR 301978
sort i_vekp by vpobjkey.
endif.
free: i_vepo, i_temp_lips.
i_temp_lips[] = i_lips[].
sort i_temp_lips by matnr.
delete adjacent duplicates from i_temp_lips comparing matnr.
* Get Units of Measure for Material
perform read_data_from_marm. " SIR 061880
* Begin of SIR 032383
i_z0234_uom = i_z0234.
sort i_z0234_uom by zpaluom.
delete adjacent duplicates from i_z0234_uom comparing zpaluom.
* End of SIR 032383
clear i_marm_pallet. " SIR 061880
refresh i_marm_pallet. " SIR 061880
loop at i_z0234_uom into v_z0234_uom. "LOOP Z0234 032383
*-------------------------------------------------* Begin of SIR 061880
* Get Alternative Unit of Measure for Pallets
perform i_marm_pallet_fill.
endloop. "ENDLOOP Z0234 032383
** get alternative UoM for pallets
* SELECT MATNR " material
* MEINH " Alt unit of measure " 032383
* UMREZ " numerator
* UMREN " denominator
** into table i_marm_pallet " 032383
* APPENDING TABLE I_MARM_PALLET "032383
* FROM MARM
* FOR ALL ENTRIES IN I_TEMP_LIPS
* WHERE MATNR = I_TEMP_LIPS-MATNR AND
** meinh = v_z0234_zpaluom. " 032383
* MEINH = V_Z0234_UOM-ZPALUOM. " 032383
*---------------------------------------------------* End of SIR 061880
sort i_marm_pallet by matnr meinh.
free i_z0234_uom. "032383
i_z0234_uom = i_z0234. "032383
sort i_z0234_uom by zcsuom. "032383
delete adjacent duplicates from i_z0234_uom comparing zcsuom."32383
clear i_marm_case. " SIR 061880
refresh i_marm_case. " SIR 061880
loop at i_z0234_uom into v_z0234_uom. "LOOP Z0234 032383
*-------------------------------------------------* Begin of SIR 061880
* Get Alternative Unit of Measure for Cases
perform i_marm_case_fill.
endloop. "ENDLOOP Z0234 032383
*---------------------------------------------------* End of SIR 061880
sort i_marm_case by matnr meinh.
else.
v_flag = 'X'.
message i089 with text-i02.
* leave list-processing.
endif. " table LIPS is empty
endform. " get_data
* FORM CREATE_OUTPUT *
* process internal table LIPS, for each delivery/delivery lines create*
* an output record and collect into i_output internal table. Fields *
* used for header are goods issue date, acct assign, BU for customer, *
* total weight, total weight for shipping unit and count of *
* deliveries, the remaining fields will have a value of zero for the *
* collect. For each delivery line, fields used are goods issue date, *
* acct assign, BU for material, number of pallets, number of cases, *
* loose quantity and number of delivery lines. The remaining header *
* fiels will be zero for the collect. *
form create_output.
*-------------------------------------------------* Begin of SIR 061880
sort i_mara1 by matnr.
sort i_lips by vbeln posnr matnr.
sort i_likp by vbeln.
sort i_z0234 by vstel.
sort i_knvv by kunnr.
sort i_kna1 by kunnr.
sort i_vekp by vpobjkey.
sort i_marm_pallet by matnr meinh.
sort i_marm_case by matnr meinh.
* LOOP AT I_LIPS INTO V_LIPS.
loop at i_lips.
clear v_lips.
v_lips = i_lips.
*---------------------------------------------------* End of SIR 061880
at new vbeln.
perform collect_header_data.
endat.
if not v_lips-komkz is initial. " SIR 45567
perform collect_item_data.
endif. " SIR 45567
endloop.
endform. " create_output
* FORM COLLECT_HEADER_DATA *
* Fields used for header are goods issue date, acct assign, *
* BU for customer, total weight, total weight for shipping unit *
* and count ofdeliveries, the remaining fields will have a value of *
* zero for the collect. *
form collect_header_data.
clear: v_likp, v_knvv, v_vekp, v_vekp_sum_brgew.
v_ok = 'Y'.
read table i_likp into v_likp with key vbeln = v_lips-vbeln
binary search.
if sy-subrc = 0. " SIR 061880
clear v_z0234. "(+) SIR 301978
read table i_z0234 into v_z0234 "32383
with key vstel = v_likp-vstel "32383
binary search. "32383
read table i_knvv into v_knvv with key kunnr = v_likp-kunag
binary search.
if sy-subrc ne 0.
select single ktgrd kvgr1 into (v_knvv-ktgrd, v_knvv-kvgr1)
from knvv where kunnr = v_likp-kunag and
vkorg = v_likp-vkorg and
vtweg = '01' and " intercompany values
spart = '01'. " intercompany values
endif.
clear v_kna1. " SIR 34606
read table i_kna1 into v_kna1 " SIR 34606
with key kunnr = v_likp-kunnr " SIR 34606
binary search. " SIR 34606
read table i_vekp into v_vekp
with key vpobjkey(10) = v_likp-vbeln
binary search.
if sy-subrc = 0.
v_vekp_tabix = sy-tabix.
while v_ok = 'Y'.
if v_vekp-gewei_max ne c_uom.
perform z_unit_conversion
using v_vekp-brgew v_vekp-gewei_max c_uom v_palwto.
v_vekp_sum_brgew = v_vekp_sum_brgew + v_palwto.
else.
v_vekp_sum_brgew = v_vekp_sum_brgew + v_vekp-brgew.
endif.
v_vekp_tabix = v_vekp_tabix + 1.
read table i_vekp into v_vekp
index v_vekp_tabix.
if sy-subrc = 0.
if v_vekp-vpobjkey(10) ne v_likp-vbeln.
v_ok = 'N'.
endif.
else.
v_ok = 'N'.
endif.
endwhile.
endif.
endif. " SIR 061880
* populate output tables
clear: v_output_dt, v_output_ag,v_output_gs. " SIR 34606
v_output_dt-wadat_ist = v_likp-wadat_ist.
v_output_dt-ktgrd = v_knvv-ktgrd.
v_output_ag-ktgrd = v_knvv-ktgrd.
v_output_gs-ktgrd = v_knvv-ktgrd. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* V_OUTPUT_DT-BU = V_KNVV-KVGR1.
* V_OUTPUT_AG-BU = V_KNVV-KVGR1.
* V_OUTPUT_GS-BU = V_KNVV-KVGR1. " SIR 34606
* Populate Business Unit,Line of Busness and PAC1 Values in Header Data
perform get_busunit_lobus_pac1_data1.
*---------------------------------------------------* End of SIR 061880
v_output_dt-kunnr = v_kna1-kunnr. " SIR 34606
* V_OUTPUT_AG-KUNNR = V_KNA1-KUNNR. " SIR 34606
v_output_dt-land1 = v_kna1-land1. " SIR 34606
v_output_ag-land1 = v_kna1-land1. " SIR 34606
v_output_dt-a_brgew = v_vekp_sum_brgew.
v_output_ag-a_brgew = v_vekp_sum_brgew.
v_output_gs-a_brgew = v_vekp_sum_brgew. " SIR 34606
if s_mbuun[] is initial and " SIR 61880
s_lobus[] is initial and " SIR 61880
s_pac1[] is initial. " SIR 61880
v_output_dt-num_del = 1.
v_output_ag-num_del = 1.
v_output_gs-num_del = 1. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* Number of Packages
v_output_dt-packages = v_likp-anzpk.
v_output_ag-packages = v_likp-anzpk.
v_output_gs-packages = v_likp-anzpk.
else.
clear: v_output_dt-num_del,
v_output_ag-num_del,
v_output_gs-num_del,
v_output_dt-packages,
v_output_ag-packages,
v_output_gs-packages.
endif.
*---------------------------------------------------* End of SIR 061880
collect v_output_dt into i_output_dt.
collect v_output_ag into i_output_ag.
collect v_output_gs into i_output_gs. " SIR 34606
endform. " collect_header_data
* FORM COLLECT_ITEM_DATA *
* For each delivery line, fields used are goods issue date, *
* acct assign, BU for material, number of pallets, number of cases, *
* loose quantity and number of delivery lines. The remaining header *
* fiels will be zero for the collect. *
form collect_item_data.
clear: v_pallet_qty, v_pallet_integer,
v_case_qty, v_case_integer,
v_num_pallets, v_num_pallets_int,
v_num_cases, v_num_cases_int,
v_qty_not_pallets, v_total_case_qty, v_loose_qty.
read table i_marm_pallet into v_marm_pallet
with key matnr = v_lips-matnr
meinh = v_z0234-zpaluom binary search."32382
if sy-subrc = 0.
v_pallet_qty = v_marm_pallet-umrez / v_marm_pallet-umren.
* round down partial pallets
v_pallet_integer = v_pallet_qty - '.499'.
endif.
read table i_marm_case into v_marm_case
with key matnr = v_lips-matnr
meinh = v_z0234-zcsuom binary search."32382
if sy-subrc = 0.
v_case_qty = v_marm_case-umrez / v_marm_case-umren.
* round down partial cases
v_case_integer = v_case_qty - '.499'.
endif.
if v_pallet_integer > 0.
v_num_pallets = v_lips-lgmng / v_pallet_integer.
v_num_pallets_int = v_num_pallets - '.499'.
endif.
v_qty_not_pallets = v_lips-lgmng -
( v_num_pallets_int * v_pallet_integer ).
if v_case_integer > 0.
v_num_cases = v_qty_not_pallets / v_case_integer.
v_num_cases_int = v_num_cases - '.499'.
endif.
v_total_case_qty = v_num_cases_int * v_case_integer.
if v_qty_not_pallets = v_total_case_qty.
v_loose_qty = 0.
else.
v_loose_qty = 1.
endif.
* populate output tables
clear: v_output_dt, v_output_ag, v_output_gs. " SIR 34606
v_output_dt-wadat_ist = v_likp-wadat_ist.
v_output_dt-ktgrd = v_knvv-ktgrd.
v_output_ag-ktgrd = v_knvv-ktgrd.
v_output_gs-ktgrd = v_knvv-ktgrd. " SIR 34606
v_output_dt-kunnr = v_kna1-kunnr. " SIR 34606
* V_OUTPUT_AG-KUNNR = V_KNA1-KUNNR. " SIR 34606
v_output_dt-land1 = v_kna1-land1. " SIR 34606
v_output_ag-land1 = v_kna1-land1. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* V_OUTPUT_DT-BU = V_LIPS-PRODH+1(2).
* V_OUTPUT_AG-BU = V_LIPS-PRODH+1(2).
* V_OUTPUT_GS-BU = V_LIPS-PRODH+1(2). " SIR 34606
* Populate Business Unit,Line of Business and PAC1 Values for Item Data.
perform get_busunit_lobus_pac1_data2.
if V_OUTPUT_DT-BU is initial.
clear V_OUTPUT_DT.
exit.
endif.
*---------------------------------------------------* End of SIR 061880
* get delivery weight from delivery lines instead of header " SIR 45567
if v_lips-gewei = c_uom.
v_output_dt-d_btgew = v_lips-brgew.
v_output_ag-d_btgew = v_lips-brgew.
v_output_gs-d_btgew = v_lips-brgew. " SIR 34606
else.
perform z_unit_conversion
using v_lips-brgew v_lips-gewei c_uom v_palwto.
v_output_dt-d_btgew = v_palwto.
v_output_ag-d_btgew = v_palwto.
v_output_gs-d_btgew = v_palwto. " SIR 34606
endif.
* Get material weight from delivery (LIPS)(IF P_DELWT = 'X')" SIR 38784
if p_delwt = 'X'. " SIR 38784
if v_lips-gewei = c_uom.
v_output_dt-m_brgew = v_lips-brgew.
v_output_ag-m_brgew = v_lips-brgew.
v_output_gs-m_brgew = v_lips-brgew. " SIR 34606
else.
perform z_unit_conversion
using v_lips-brgew v_lips-gewei c_uom v_palwto.
v_output_dt-m_brgew = v_palwto.
v_output_ag-m_brgew = v_palwto.
v_output_gs-m_brgew = v_palwto. " SIR 34606
endif.
else. " SIR 38784
* Get material weight from Master data (MARA) " SIR 38784
read table i_mara1 into v_mara " SIR 38784
with key matnr = v_lips-matnr " SIR 38784
binary search. " SIR 38784
if v_mara-gewei = c_uom. " SIR 38784
v_output_dt-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
v_output_ag-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
v_output_gs-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
else. " SIR 38784
perform z_unit_conversion " SIR 38784
using v_mara-brgew v_mara-gewei c_uom v_palwto. " SIR 38784
v_output_dt-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
v_output_ag-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
v_output_gs-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
endif. " SIR 38784
endif. " SIR 38784
*-------------------------------------------------* Begin of SIR 061880
* To Get the Volume Data.
perform get_volume_data.
*---------------------------------------------------* End of SIR 061880
v_output_dt-num_pallets = v_num_pallets_int.
v_output_ag-num_pallets = v_num_pallets_int.
v_output_gs-num_pallets = v_num_pallets_int. " SIR 34606
v_output_dt-num_cases = v_num_cases_int.
v_output_ag-num_cases = v_num_cases_int.
v_output_gs-num_cases = v_num_cases_int. " SIR 34606
v_output_dt-num_loose = v_loose_qty.
v_output_ag-num_loose = v_loose_qty.
v_output_gs-num_loose = v_loose_qty. " SIR 34606
*{ INSERT D11K901833 1
* Sir 054042/48712 insert code to put in 0 instead of 1 for collect
* value for delivery lines
if v_lips-lgmng = 0.
v_output_dt-num_delln = 0.
v_output_ag-num_delln = 0.
v_output_gs-num_delln = 0.
else.
* end of insert for 054042/48712
*} INSERT
v_output_dt-num_delln = 1.
v_output_ag-num_delln = 1.
v_output_gs-num_delln = 1.Since this is your first post, let me clue you in. This forum is meant for asking very short and specific questions. For example, if you've asked, how could you improve a particular one SELECT statement, I'm sure many people would have helped you.
But you cannot seriously expect someone on this forum to spend his/her time and review such a long program. For this people are normally getting paid, you know.
Maybe you are looking for
-
How do I get my photos from elements 10 to elemente 12
How do I get all my photos from elements 10 into elements 12 ?
-
Modeler error messages - more info not provided!
Dear Friends, I got an error executing a planning sequence of function type 'generate combinations'. The system messages on the top section of the modeler are : 1. first message : "Planning function Gen Combinations ( ended with errors" 2. subsequent
-
Question on AM Client Interface
Hello gurus, I want to understand , what happens behind the screens , when an AM method is exposed via client interface. The reason being , I want to handle the following scenario : 1) I need to add one of the webservice method to the AM client inter
-
CS3 not responding on fresh Win7 Pro install
It was working fine before on my Windows 7 64-bit. I re-installed Windows 7 Pro, installed CS3 from the cd and now as soon as I launch it I get "not responding." I won't even let me put in the serial number. Any suggestions?
-
Does anyone know of a smooth troublefree way of having the same files, applications and everything on two Macs? I recently installed a new (bigger) drive on my MacBook so that can have all the same data on the MacBook as I have on my desktop iMac. So