LOC Report
Hi every body
can anybody flash lingt on me regarding Letter Of Credit and consolidate reports, i mean how many LOC's we have received etc ., details
Hi,
The requirement is to show the list of Missing storage locations for all the materials collectively for the Plant etc.,
MMSC comes close to this requirement , but it is showing for the One material at a time for the plant as selection screen Material
and plant are mandatory inputs.
As far as MM50 is concerned, it just does not show the missing storage locations at all.
So Eventually,i guess this will take for the new development. Any idea abt the function modules for the same.
Also While developing if any performace issue may come suppose if there are more than a lakh entries for MARC-MATNR ? ..
So while output this may go for more depends on LGORT entries.
pls suggest.
Regards,
Shrenu
Edited by: Shrenu on May 25, 2010 7:20 AM
Similar Messages
-
New Report for Opens Sales order and P.O from Plant and S.Loc
Dear Gurus
We have repory requiement for Open sales order and P.O to deliver from particular plant and S.Loc.
If you have already developed this kiond of report help me inthis case.
Thanks
ramkiclosed
-
Hi,
if I run the report "RALM_ME_FUNCLOC_LIST" with SE38 and selection parameter func. loc. typs "S" I don't receive a newly created func. loc.
If I do the same using transaction IH06 with the same parameter, I receive the newly created func. loc.
The same happens I I start the initial replication for func. locs. The newly created isn't transfered.
Any idea?
Thank you and regards,
FlorianHello Florian,
Unfortunatly, if you look at the code a note is reffered: 772443 . There it says you cannot select from the FLTYP field (even if it is available for data entry).
Sorry,
Julien. -
Note:589024(Reports in BW with St.Loc and St.Type)
Dear Guys,
I got an situation with the Query on 0IC_C03 Cube.The "0TOTALSTCK"KF is getting the values at the Query for all movment types except 311,101,641.Further i found that i need to apply note:589024 to resolve this,but i am having difficulty in Restricting : 0Stocktype,restricted to all values greater than or less than "INITIAL"(="#/#")(Exclude from selection).. I did try by R,clicking the 0Stocktype-->Restrict....But there's no option like "Greater than or Less than",leave alone options like "Greater than" or "Less than"...It would be fantastic if someone could take time to help me out with this..
Manythanks
ArunI did try by R,clicking the 0Stocktype-->Restrict....But there's no option like "Greater than or Less than",leave alone options like "Greater than" or "Less than"...It would be fantastic if someone could take time to help me out with this..
Arun, if the above issue is going to resolve by restricting the stocktype. i think Stocktype restrict with < or > is not possible in this case better go for custom exit variable for stock type and in the user exit you can restrict with < or > values if the values are less and try to get the values of kf as per your requirements.
Try it out and hope it helps.
Regs,
Vachan -
hi guy's,
i am doing report for the stock statement .... my issue is in MB5B if i reverse some document it shows as it move's to issue QTY and my receipt is same but my closing stock is correct ...is there any std report avalible ....
thank's in advanceUse this code :
TABLES : MSEG,MKPF,MARA,MAKT,BEWART,MSLB,BSIM.
TYPE-POOLS : SLIS.
DATA : IT_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_LIST_HEADER TYPE SLIS_T_LISTHEADER,
IT_EVENTS TYPE SLIS_T_EVENT,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
REPID LIKE SY-REPID,
FRM_DATE(10),TO_DATE(10),
DISPTEXT(255),DISPTEXT2(255).
TYPES : BEGIN OF ST_OPBAL,
MATNR LIKE MSEG-MATNR,
MAKTX LIKE MAKT-MAKTX,
BATCH LIKE MSEG-CHARG,
BWART LIKE MSEG-BWART,
MENGE LIKE MSEG-MENGE,
ZEILE LIKE MSEG-ZEILE,
WERKS LIKE MSEG-WERKS,
SOBKZ LIKE MSEG-SOBKZ,
BUDAT LIKE MKPF-BUDAT,
SHKZG LIKE MSEG-SHKZG,
DMBTR LIKE MSEG-DMBTR,
MBLNR LIKE MSEG-MBLNR,
LGORT LIKE MSEG-LGORT,
END OF ST_OPBAL.
DATA : OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE,
TMP_OPBAL TYPE ST_OPBAL OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF BAL_NOREF OCCURS 0,
MATNR LIKE MARA-MATNR,
SHKZG LIKE MSEG-SHKZG,
DMBTR LIKE MSEG-DMBTR,
END OF BAL_NOREF.
DATA : BEGIN OF OPBAL2 OCCURS 0,
SNO(3) TYPE N,
MATNR LIKE MSEG-MATNR,
MAKTX LIKE MAKT-MAKTX,
OP_BAL LIKE MSEG-MENGE,
OP_STKVAL LIKE MSEG-DMBTR, "NEW
REC LIKE MSEG-MENGE,
T_OPBAL_REC LIKE MSEG-MENGE,
REC_STKVAL LIKE MSEG-DMBTR, "NEW
ISS LIKE MSEG-MENGE,
ISS_STKVAL LIKE MSEG-DMBTR, "NEW
SALES LIKE MSEG-MENGE,
T_ISS LIKE MSEG-MENGE,
CL_BAL LIKE MSEG-MENGE,
BATCH LIKE MSEG-CHARG,
SUBCON LIKE MSEG-MENGE,
CL_STKVAL LIKE MSEG-DMBTR,
END OF OPBAL2.
DATA SERNO(4) TYPE C.
DATA OPTOT TYPE P DECIMALS 3.
DATA RECTOT TYPE P DECIMALS 3.
DATA ISSTOT TYPE P DECIMALS 3.
DATA TOTALL TYPE P DECIMALS 3.
DATA FLG TYPE N.
DATA FLAG TYPE N.
DATA STOCKVAL TYPE MSEG-DMBTR.
DATA REC_STOCKVAL TYPE MSEG-DMBTR.
DATA ISS_STOCKVAL TYPE MSEG-DMBTR.
DATA CL_STKVAL TYPE MSEG-DMBTR.
SELECTION-SCREEN BEGIN OF BLOCK X WITH FRAME.
SELECT-OPTIONS: P_MATNR FOR MSEG-MATNR,
P_MGRP FOR MARA-MATKL,
P_DATE FOR MKPF-BUDAT,
P_PLANT FOR MSEG-WERKS DEFAULT 'NB01' OBLIGATORY NO INTERVALS
NO-EXTENSION .
SELECT-OPTIONS: P_STLOC FOR MSEG-LGORT NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN END OF BLOCK X.
INITIALIZATION.
REPID = SY-REPID.
PERFORM FILL_FLDCAT USING IT_FLDCAT.
PERFORM FILL_EVENTS USING IT_EVENTS.
PERFORM FILL_LAYOUT USING GS_LAYOUT.
START-OF-SELECTION.
CONCATENATE P_DATE-LOW6(2) '.' P_DATE-LOW4(2) '.' P_DATE-LOW+0(4)
INTO FRM_DATE.
CONCATENATE P_DATE-HIGH6(2) '.' P_DATE-HIGH4(2) '.' P_DATE-HIGH+0(4)
INTO TO_DATE.
CONCATENATE TEXT-003 FRM_DATE' TO : ' TO_DATE INTO DISPTEXT.
CONCATENATE TEXT-004 P_PLANT-LOW ' Storage Location : ' P_STLOC-LOW
INTO DISPTEXT2.
PERFORM FILL_HEADER USING IT_LIST_HEADER.
SELECT A~MATNR
F~MAKTX
A~CHARG
A~BWART
A~MENGE
A~ZEILE
A~WERKS
A~SOBKZ
D~BUDAT
A~SHKZG
A~DMBTR
A~MBLNR
A~LGORT
INTO TABLE OPBAL
FROM MKPF AS D JOIN MSEG AS A
ON DMBLNR = AMBLNR AND
DMJAHR = AMJAHR
JOIN MARA AS E
ON EMATNR = AMATNR
JOIN MAKT AS F
ON FMATNR = AMATNR
WHERE A~MATNR IN P_MATNR
AND A~WERKS IN P_PLANT
AND A~KZBEW IN (' ','B')
AND E~MATKL IN P_MGRP
AND A~BWART NOT IN ('541','542','321','322','121')
AND A~KZVBR NOT IN ('A')
AND D~BUDAT LE P_DATE-HIGH.
LOOP AT OPBAL WHERE BWART EQ '544' AND LGORT EQ ''.
TMP_OPBAL = OPBAL.
APPEND TMP_OPBAL.
ENDLOOP.
DELETE OPBAL WHERE ( BWART EQ '309' AND DMBTR EQ 0 ).
DELETE OPBAL WHERE ( BWART NE '543' AND LGORT EQ '' ).
LOOP AT TMP_OPBAL.
OPBAL = TMP_OPBAL.
APPEND OPBAL.
ENDLOOP.
STOCKVAL = 0.
SORT OPBAL BY MATNR BATCH BUDAT.
LOOP AT OPBAL.
SELECT SINGLE LBLAB INTO MSLB-LBLAB FROM MSLB
WHERE MATNR = OPBAL-MATNR.
IF OPBAL-BUDAT LT P_DATE-LOW.
IF OPBAL-SHKZG = 'H'.
OPTOT = OPTOT - OPBAL-MENGE.
ELSEIF OPBAL-SHKZG = 'S'.
OPTOT = OPTOT + OPBAL-MENGE.
ENDIF.
For the duration II part *****************
ELSEIF OPBAL-BUDAT IN P_DATE.
IF OPBAL-SHKZG = 'H'.
ISSTOT = ISSTOT + OPBAL-MENGE.
ELSEIF OPBAL-SHKZG = 'S'.
RECTOT = RECTOT + OPBAL-MENGE.
ENDIF.
ENDIF.
AT END OF BATCH. " modified for chek
READ TABLE OPBAL INDEX SY-TABIX.
CLEAR BAL_NOREF. REFRESH BAL_NOREF.
SELECT MATNR SHKZG SUM( DMBTR )
INTO TABLE BAL_NOREF
FROM BSIM
WHERE BUDAT LT P_DATE-LOW AND
MATNR EQ OPBAL-MATNR AND
BWTAR EQ OPBAL-BATCH AND
BWKEY IN P_PLANT AND
BLART IN ('RE','WE','WA','PR')
GROUP BY MATNR SHKZG.
LOOP AT BAL_NOREF.
IF BAL_NOREF-SHKZG = 'H'.
STOCKVAL = STOCKVAL - BAL_NOREF-DMBTR.
ELSE.
STOCKVAL = STOCKVAL + BAL_NOREF-DMBTR.
ENDIF.
ENDLOOP.
CLEAR BAL_NOREF. REFRESH BAL_NOREF.
SELECT MATNR SHKZG SUM( DMBTR )
INTO TABLE BAL_NOREF
FROM BSIM
WHERE BUDAT IN P_DATE AND
MATNR EQ OPBAL-MATNR AND
BWTAR EQ OPBAL-BATCH AND
BWKEY IN P_PLANT AND
BLART IN ('RE','WE','WA','PR')
GROUP BY MATNR SHKZG.
LOOP AT BAL_NOREF.
IF BAL_NOREF-SHKZG = 'H'.
ISS_STOCKVAL = ISS_STOCKVAL + BAL_NOREF-DMBTR.
ELSE.
REC_STOCKVAL = REC_STOCKVAL + BAL_NOREF-DMBTR.
ENDIF.
ENDLOOP.
" MSLB-LBLAB (STOCK WITH SUBCONTRACTOR).
CL_STKVAL = STOCKVAL + REC_STOCKVAL - ISS_STOCKVAL.
TOTALL = OPTOT + RECTOT - ISSTOT.
IF OPTOT = '0' AND RECTOT = '0' AND ISSTOT = '0'.
FLG = 1.
ENDIF.
IF FLG = 1.
CLEAR FLG.
ELSE.
SERNO = SERNO + 1.
OPBAL2-SNO = SERNO.
OPBAL2-MATNR = OPBAL-MATNR.
OPBAL2-MAKTX = OPBAL-MAKTX.
OPBAL2-OP_BAL = OPTOT.
OPBAL2-REC = RECTOT.
OPBAL2-T_OPBAL_REC = OPTOT + RECTOT.
OPBAL2-ISS = ISSTOT.
OPBAL2-T_ISS = ISSTOT.
OPBAL2-CL_BAL = TOTALL.
OPBAL2-BATCH = OPBAL-BATCH.
OPBAL2-SUBCON = MSLB-LBLAB.
OPBAL2-OP_STKVAL = STOCKVAL.
OPBAL2-ISS_STKVAL = ISS_STOCKVAL.
OPBAL2-REC_STKVAL = REC_STOCKVAL.
OPBAL2-CL_STKVAL = CL_STKVAL.
APPEND OPBAL2.
ENDIF.
OPTOT = 0.
RECTOT = 0.
ISSTOT = 0.
STOCKVAL = 0.
ISS_STOCKVAL = 0.
REC_STOCKVAL = 0.
CL_STKVAL = 0.
ENDAT.
ENDLOOP.
WA_SORT-SPOS = 1.
WA_SORT-FIELDNAME = 'MATNR'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = IT_FLDCAT
IT_EVENTS = IT_EVENTS
IS_LAYOUT = GS_LAYOUT
IT_SORT = IT_SORT
TABLES
T_OUTTAB = OPBAL2.
FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
PERFORM FILL_PARAM_FLDCAT USING 1 'SNo' 'SNO' ' ' 'X'
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 2 'Material No.' 'MATNR' ' ' 'X'
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 3 'Description' 'MAKTX' ' ' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 4 'Op.Bal' 'OP_BAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 5 'Op.Stock Val' 'OP_STKVAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 6 'Receipts' 'REC' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 7 'Total' 'T_OPBAL_REC' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 8 'Rect.Val.' 'REC_STKVAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 9 'Issues' 'ISS' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 10 'Iss. Val.' 'ISS_STKVAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 11 'Cl. Bal.' 'CL_BAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 12 'Cl.Stock Val' 'CL_STKVAL' 'X' ' '
'OPBAL2' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 13 'BATCH ' 'BATCH' ' ' ' '
'OPBAL2' P_FLDCAT.
ENDFORM.
FORM FILL_PARAM_FLDCAT USING VALUE(P_COL) VALUE(P_TEXT) VALUE(P_FLDNAME)
VALUE(P_DOSUM) VALUE(P_NOZERO) VALUE(P_TABNAME)
PP_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA : WA_FLDCAT TYPE SLIS_FIELDCAT_ALV.
CLEAR WA_FLDCAT.
WA_FLDCAT-COL_POS = P_COL.
WA_FLDCAT-SELTEXT_M = P_TEXT.
WA_FLDCAT-FIELDNAME = P_FLDNAME.
WA_FLDCAT-TABNAME = P_TABNAME.
WA_FLDCAT-DO_SUM = P_DOSUM.
WA_FLDCAT-NO_ZERO = P_NOZERO.
APPEND WA_FLDCAT TO PP_FLDCAT.
ENDFORM.
FORM FILL_HEADER USING P_IT_LIST_HEADER TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-INFO = TEXT-002.
APPEND LS_LINE TO P_IT_LIST_HEADER.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-INFO = DISPTEXT.
APPEND LS_LINE TO P_IT_LIST_HEADER.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-INFO = DISPTEXT2.
APPEND LS_LINE TO P_IT_LIST_HEADER.
ENDFORM.
FORM FILL_EVENTS USING P_IT_EVENTS TYPE SLIS_T_EVENT.
DATA LS_EVENT TYPE SLIS_ALV_EVENT.
MOVE 'TOP_OF_PAGE' TO LS_EVENT-FORM.
MOVE 'TOP_OF_PAGE' TO LS_EVENT-NAME.
APPEND LS_EVENT TO P_IT_EVENTS.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LIST_HEADER.
ENDFORM.
FORM FILL_LAYOUT USING P_GS_LAYOUT TYPE SLIS_LAYOUT_ALV.
P_GS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
P_GS_LAYOUT-ZEBRA = 'X'.
P_GS_LAYOUT-FLEXIBLE_KEY = 'X'.
ENDFORM.
FOR TESTING PURPOSE.
*SORT OPBAL BY BUDAT.
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = REPID
IT_FIELDCAT = IT_FLDCAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = OPBAL.
*FORM FILL_FLDCAT USING P_FLDCAT TYPE SLIS_T_FIELDCAT_ALV.
PERFORM FILL_PARAM_FLDCAT USING 1 'MBLNR' 'MBLNR'
'OPBAL' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 2 'CREDIT/DEBIT' 'SHKZG'
'OPBAL' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 3 'MOV.TYP.' 'BWART'
'OPBAL' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 4 'ST.LOC.' 'LGORT'
'OPBAL' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 5 'STOCK VAL' 'DMBTR'
'OPBAL' P_FLDCAT.
PERFORM FILL_PARAM_FLDCAT USING 6 'POS.DATE' 'BUDAT'
'OPBAL' P_FLDCAT.
*ENDFORM. -
Report including open purchase order quantity for one storage location
Hello gurus,
I am looking for a report giving me the total/available stock and the open purchase order quantity for all materials stored in a certain storage location.
I.e. like this:
Plant 0001, storage loc. 01
Material stock open purchase order quantity
100000 200 pcs. 50pcs.
Is there such a report in SAP standard?
Thanks
AliciahI
U want the report like this ,
MAterial stock availablein storage location and with Open PO quantity for the same material.???
This report u can get in 2 different transaction . the n u can combine and create one custom transaction .
One is for materil stock in storage location is MB52 or MB5B
THen ME2N for open PO quantity for that material. -
My Microsoft Word gives me an error report as soon as I try to open Word Document
I have the Microsoft Word for Mac 2011 and I've had it for almost 3 years now. I didn't have any problems until I decided to update it since I haven't done so when I installed Microsoft on my Macbook pro. After about 3 or 4 updates I started having difficulties when it suddenly gives me an error once I tried creating a new document that says: "Microsoft Word has encountered a problem and needs to close. We are sorry for the inconvenience." and underneath it says More Information so I clicked on it and this is what it gave me:
Microsoft Error Reporting log version: 2.0
Error Signature:
Exception: EXC_BAD_ACCESS
Date/Time: 2015-02-16 05:22:55 +0000
Application Name: Microsoft Word
Application Bundle ID: com.microsoft.Word
Application Signature: MSWD
Application Version: 14.2.0.120402
Crashed Module Name: libobjc.A.dylib
Crashed Module Version: unknown
Crashed Module Offset: 0x000010a7
Blame Module Name: Microsoft Word
Blame Module Version: 14.2.0.120402
Blame Module Offset: 0x0021002b
Application LCID: 1033
Extra app info: Reg=en Loc=0x0409
Crashed thread: 0
I clicked on check for updates just in case I missed any, but it says there's no updates available. Also, I restarted my computer twice and it still doesn't work. Did the updates messed it up? I really need to fix this problem soon because I'm going to need Word for school. Please and thank you!
Edit: I'll be moving this question over the other forum, but can anyone at least solve this problem for me here?Microsoft Word is a Microsoft app. You should post your question to a Microsoft forum.
Cheers,
GB -
Whenever I try to open Microsoft Word it doesn't open and shows me an error report!
Whenever I try to open Microsoft Word it doesn't open and shows me an error report! I don't know what to do! Help!!!!
This is the extra info that comes along with the error report:
Microsoft Error Reporting log version: 2.0
Error Signature:
Exception: EXC_BAD_ACCESS
Date/Time: 2013-08-30 16:41:14 -0400
Application Name: Microsoft Word
Application Bundle ID: com.microsoft.Word
Application Signature: MSWD
Application Version: 14.1.0.110310
Crashed Module Name: MBURibbon
Crashed Module Version: 14.3.4.130416
Crashed Module Offset: 0x000072f0
Blame Module Name: MBURibbon
Blame Module Version: 14.3.4.130416
Blame Module Offset: 0x000072f0
Application LCID: 1033
Extra app info: Reg=en Loc=0x0409
Crashed thread: 0
What should I do??????It might be a good idea to also ask here:
Office for Mac forums -
Consignment stock in MC.9 report
Hi All.
In MC.9 report, consignment stock is consider under valuated stock or non valuated stock.
I run MC.9 report in two different system. In one system consignment stock is under valuated stock while in other it is not considered as valuated stock. Which system is correct.
If consignment stock is valuated stock then why it is not considered as valuated stock in other system.
Please help.
Thanks in advance
Regards
chetanHello,
The stock of MC.9 reflects the complete stock at plant level. It includes also the sock of material which one is send to vendor.(Subcontracting) You can also cross check through MMBE in which stock prov. to vendor is different.
While MB5B had three radio buttons for stock type.
1 - Storage loc/Batch stock - which not include the materials provided to vendor.
2 - Valuated stock - - Total valuated stock as per your selection crieteria.
3 - Special stock -- all the special stock such as subcontracting/pipeline/consignment.
If you click on Valuated radio button and execute it, you will get same stock under head Closing stock and the value will same as the value in MC.9
--Just click Valuated stock radio button.
RGDS
Rajan -
please tell me how to start. i want to know from which table to start for the following requirement.
please tell all the steps. starting table and end table.
Report for Purchase Details:
Input Parameters:
**Plant: - -
to -
(Multiple options)
Storage Loc - -
to -
(Multiple options)
Vendor - -
to -
(Multiple options)
**GR Date - -
to -
(Multiple options)
Material Type - -
to -
(Multiple options)
- Mandatory &
Sto.Loc, Material Type & Vendor should give any one input
Output Option:
- Summary of Purchase in Rs. (Storage loc. wise)
- Summary of Purchase in Rs. (Valuation Class wise)
- Detail Report Line item wise
Display Option:
- ALV Output
- List Output
Required Output:
GR No.
GR Date
Material code
Material description
GR Qty
GR Value
PO No. & Line item.
Vendor code
Vendor Name
Plant
Storage Loc.
Valuation class
MRP controller
Wt. of Mateial (as per GR)
Mvt. Type
Reference (DC No.)
Report Logic:
It should consider 101, 102 & 122 Mvt. made against Purchase orders(Std, FP & SC POs) and the outcome (Purchase value) will be net of these values.
Ensure only labour charges are considered for s/c receipts
Other Details:
It should take the weight of ROH (castings) from GR
Authorization to be given to all MRP, FIFO & Audit user
Report can be executed in Background also.mseg table price is inclusive of delivery cost so i want to take from EKBE table. ekbe value contains without delivery cost.
i know how to join and which table to consider. but i dont know from which table i have to strat writing logic.
my requirement is as follows.
REPORT FOR PURCHASE DETAILS:
Input Parameters:
** Plant -to-(Multiple Options)
Material -to-(Multiple Options)
Storage Location -to-(Multiple Options)
Material group -to-(Multiple Options)
Material Type -to-(Multiple Options)
Purchse group -to-(Multiple Options)
MRP Controller -to-(Multiple Options)
PO Type -to-(Multiple Options)
Vendor -to-(Multiple Options)
** GR Date -to-(Multiple Options)
**- Mandatory
Output Option:
-Summary of purchase in Rs. (Storage loc. wise)
-Summary of purchase in Rs. (Valuation class wise)
-Detail report -Line item wise
Display Option:
- ALV Output
- List output
Required Output:
GR NO.
GR Date
Material code
Material description
GR QTY
GR value
PO. NO. & line item.
Vendor code
Vendor Name
Plant
Storage Loc
Valuation class MRP controller
WT. of material (as per GR)
MVT.Type
Reference (DC.NO.)
It should consider 101, 102 and 122 MVT. made against purchse orders(Std, FP &SC POs(SCFX,SCEF and sch agreement))
and the outcome (purchase value) will be net of these values. ensure only labour charges are considered for S/C receipts.
Other Details:
It should take the weight of ROh (castings) from GR
Authorization to be given to all MRP, FIFO & audit user
Report can be executed in background also. -
Master Detail Report for PDF Printing
Dear All,
While trying to create a master detail report using Oracle APEX 4.2 and BI Publisher. I tried creating report queries and report layout following the below mentioned steps.
CREATE TYPE emp_row AS OBJECT (
EMPNO NUMBER(4),
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2)
CREATE TYPE emp_tab AS TABLE OF emp_row;
CREATE TYPE dept_row AS OBJECT (
DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
EMP_LIST emp_tab
SELECT SYS_XMLAGG (
SYS_XMLGEN(
dept_row(
d.deptno, d.dname, d.loc,
CAST(MULTISET(SELECT e.empno, e.ename, e.job, e.mgr, e.hiredate, e.sal, e.comm
FROM emp e
WHERE e.deptno = d.deptno) AS emp_tab)
SYS.XMLGENFORMATtYPE.createFormat('DEPT')
) AS "XML_QUERY"
FROM dept d
WHERE d.deptno = 10;
Though the above steps generates xml output while trying to generate in APEX it says unsupported datatype. Tried using DBMS_LOB as well no luck. Any inputs will be quite helpful. Should there be any other way to incorporate master detail report printing in APEX kindly advise.
Thanks
AhmedHi Ahmed_Jed,
Ahmed_Jed wrote:
Thanks Kiran for your prompt response. I tried following the steps already using this link (How To Create a Master-Detail PDF Report) somehow the detail record was not getting processed perhaps was trying to generate xml data using the above query. Any other reference will be highly appreciated.
Regards
Ahmed
Well the problem lies here:
SELECT SYS_XMLAGG (
SYS_XMLGEN(
dept_row(
d.deptno, d.dname, d.loc,
CAST(MULTISET(SELECT e.empno, e.ename, e.job, e.mgr, e.hiredate, e.sal, e.comm
FROM emp e
WHERE e.deptno = d.deptno) AS emp_tab)
SYS.XMLGENFORMATtYPE.createFormat('DEPT')
) AS "XML_QUERY"
FROM dept d
WHERE d.deptno = 10;
The Report Query itself generates XML data (in the required BI Publisher format). So, no need to generate it like this.
As you are using table functions your query should be of the type:
SELECT EMPNO
, ENAME
, JOB
, MGR
, HIREDATE
, SAL
, COMM
FROM TABLE ( EMP_PKG.GET_EMPLOYEES ( :PXX_DEPTNO ))
where EMP_PKG.GET_EMPLOYEES is packaged table function which returns the Object Table of type EMP_TAB mentioned above.
When you test the above Report Query with sample DEPTNO, it will generate the sample XML, which you can use to generate Report Layout in RTF format using BI Publisher Desktop.
Hope this helps!
Regards,
Kiran -
Re: Report for Stock Movement
Hi All,
Can we get a report from SAP for the receipts and issues material wise for
any particular period - for a particular plant & overall?
Plant Part Code Description Opg Bal Receipts Issues/Sale
Closing stock
Best Regards
SivaDear,
MB5B--stock on posting date.
MB51--Material document list inthis report u can get desire result with help of m.type
Mc.2 stock analysys by plant
Mc.6---stock anylaysys by s.loc
Regards,
Gopala.S -
Daily Production Report In coois
Dear All
When we r checking in Coois report for production entry Of SFG.FG--it will give us the Total qty,
exactly we want that suppose one order qty is 15000 and i have put a production order of that Qty. But according to Production Its going On With 500 or 600 per day produce. then how can we see the production report of particular production confirmed qty and delivered qty 500 on which day . or we can see the Daily production report of Particular FG & SFG.
Rgds
Pankaj AgarwalDear Pankaj,
One way of addressing this issue is go to MB51, movement type 101 & 102 7 other relevant criteria.
Plant n storage location.
Execute>CtrlShftF12, you will see the list of material recvd. in the storage loc. you can also find the Production Order no.
you can see when GR has happened against Prod. order. -
Regarding report for material status
HI All,
Can u guys pls help me thre is an error in the report
which iam presenting now. The error is that iam getting
the output for units in simple report is 'PC' and iam getting the out put for units in ALV as 'ST'.
why, i need an immediate reply.
*& Report ZSTOCKDETAILS4 *
REPORT zstockdetails4 NO STANDARD PAGE HEADING
LINE-SIZE 160
LINE-COUNT 60(3).
tables declaration *
TABLES : mara, "general material data
marc, "plant data for material
mard, "storage location data for material
makt. "material description
TYPE-POOLS : slis.
internal table declaration *
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
mtart TYPE mtart,
meins TYPE meins,
END OF ty_mara.
TYPES : BEGIN OF ty_marc,
matnr TYPE matnr,
werks TYPE werks,
END OF ty_marc.
TYPES : BEGIN OF ty_mard,
matnr TYPE matnr,
werks TYPE werks,
lgort TYPE lgort_d,
labst TYPE labst,
END OF ty_mard.
TYPES : BEGIN OF ty_makt,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
DATA:t_mara TYPE TABLE OF ty_mara WITH HEADER LINE,
t_marc TYPE TABLE OF ty_marc WITH HEADER LINE,
t_mard TYPE TABLE OF ty_mard WITH HEADER LINE,
t_makt TYPE TABLE OF ty_makt WITH HEADER LINE.
PARAMETER : p_alv AS CHECKBOX DEFAULT 'X'.
final internal table *
TYPES : BEGIN OF ty_out,
matnr TYPE matnr,
werks TYPE werks,
lgort TYPE lgort_d,
labst TYPE labst,
meins TYPE meins,
mtart TYPE mtart,
maktx TYPE maktx,
END OF ty_out.
DATA:t_out TYPE TABLE OF ty_out WITH HEADER LINE.
DATA DECLARATION FOR ALV *
DATA : fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_repid LIKE sy-repid,
gd_layout TYPE slis_layout_alv,
gd_tab_group TYPE slis_t_sp_group_alv,
gt_list_top_of_page TYPE slis_t_listheader,
it_sortcat TYPE slis_sortinfo_alv OCCURS 1,
wa_sort LIKE LINE OF it_sortcat.
selection screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_werks FOR marc-werks OBLIGATORY,
s_matnr FOR mara-matnr,
s_mtart FOR mara-mtart,
s_lgort FOR mard-lgort.
SELECTION-SCREEN END OF BLOCK b1.
start-of-selection *
START-OF-SELECTION.
SELECT matnr mtart meins
FROM mara
INTO TABLE t_mara
WHERE matnr IN s_matnr
AND mtart IN s_mtart.
SORT t_mara BY matnr.
SELECT matnr werks
FROM marc
INTO TABLE t_marc
FOR ALL ENTRIES IN t_mara
WHERE matnr = t_mara-matnr
AND werks IN s_werks.
SORT t_marc BY matnr.
SELECT matnr lgort labst
FROM mard
INTO CORRESPONDING FIELDS OF TABLE t_mard
FOR ALL ENTRIES IN t_mara
WHERE matnr = t_mara-matnr
AND lgort IN s_lgort.
SORT t_mard BY matnr.
LOOP AT t_mara.
READ TABLE t_marc WITH KEY matnr = t_mara-matnr BINARY SEARCH.
READ TABLE t_mard WITH KEY matnr = t_mara-matnr BINARY SEARCH.
MOVE : t_mara-matnr TO t_out-matnr.
MOVE : t_mara-mtart TO t_out-mtart.
MOVE : t_mara-meins TO t_out-meins.
MOVE : t_marc-werks TO t_out-werks.
MOVE : t_mard-lgort TO t_out-lgort.
MOVE : t_mard-labst TO t_out-labst.
SELECT SINGLE matnr maktx
FROM makt
INTO CORRESPONDING FIELDS OF makt
WHERE matnr = t_mara-matnr.
MOVE-CORRESPONDING makt TO t_out.
LOOP AT t_mard WHERE matnr = t_mara-matnr.
MOVE : t_mard-lgort TO t_out-lgort.
MOVE : t_mard-labst TO t_out-labst.
APPEND t_out.
CLEAR : t_out-lgort, t_out-labst.
ENDLOOP.
CLEAR t_out.
ENDLOOP.
SORT t_out BY werks lgort matnr.
IF
p_alv = 'X'.
PERFORM build_fieldcatalog.
PERFORM display_alv_report.
ELSE.
DATA: tot_lgort TYPE labst,
tot_werks TYPE labst,
tot TYPE labst.
LOOP AT t_out.
NEW-LINE.
WRITE :/ sy-vline, t_out-matnr,
15 t_out-werks,
35 t_out-lgort,
45 t_out-labst,
85 t_out-meins,
100 t_out-mtart,
120 t_out-maktx,160 sy-vline.
tot_lgort = tot_lgort + t_out-labst.
tot_werks = tot_werks + t_out-labst.
tot = tot + t_out-labst.
AT LAST.
ULINE.
WRITE : / 'THE GRAND TAOTAL IS', 52 tot.
ENDAT.
ENDLOOP.
ENDIF.
TOP-OF-PAGE *
TOP-OF-PAGE.
ULINE.
WRITE : sy-vline, 'MATERIAL',
15 'PLANT',
32 'STOR LOC',
56 'STOCK',
80 'UNITS',
95 'MAT TYPE',
115 'MAT DESCR',160 sy-vline.
ULINE.
*& Form build_fieldcatalog
text
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'WERKS'.
fieldcatalog-seltext_m = 'Plant'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'LGORT'.
fieldcatalog-seltext_m = 'Storage Location'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'LABST'.
fieldcatalog-seltext_m = 'Stock'.
fieldcatalog-col_pos = 3.
fieldcatalog-outputlen = 15.
fieldcatalog-do_sum = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Unit of Measure'.
fieldcatalog-col_pos = 4.
fieldcatalog-datatype = 'PC'.
fieldcatalog-reptext_ddic = 'Unit of Measure'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MTART'.
fieldcatalog-seltext_m = 'Material Type'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MAKTX'.
fieldcatalog-seltext_m = 'Material Description'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. "build_fieldcatalog
*& Form display_alv_report
text
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = gd_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP-OF-PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = it_sortcat
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = t_out
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.
ENDFORM. "display_alv_reportHi Sai,
Please do the following:
While populating the fileld catalog for "MEINS".
<u>
add the shown code in bold:</u>
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Unit of Measure'.
<b>fieldcatalog-CFIELDNAME = 'MEINS'.
fieldcatalog-CTABNAME = 'MARA'</b>.
fieldcatalog-col_pos = 4.
fieldcatalog-datatype = 'PC'.
fieldcatalog-reptext_ddic = 'Unit of Measure'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
This will bring you "EA" in place of ST.
Hope this will work for you.
Lanka -
REPORT TAKING MORE CPU UTILIZATION
Hello Experts,
my following report is of sales order report it gives me an output in less than 250 seconds,
But taking 80 percentage CPU time so tell me how to overcome this problem ??
<b>&----
*& Report ZMSL_SALES_ORDER_REPORT
REPORT ZMSL_SALES_ORDER_REPORT.
DEFINE: M_FIELDCAT.
ADD 1 TO LS_FIELDCAT-COL_POS.
LS_FIELDCAT-FIELDNAME = &1.
LS_FIELDCAT-SELTEXT_L = &2.
LS_FIELDCAT-OUTPUTLEN = &3.
LS_FIELDCAT-TABNAME = 'gt_final_data'.
APPEND LS_FIELDCAT TO FELD_CAT.
END-OF-DEFINITION.
*==================Start of Datebase tables Declaration=================
TABLES : VBAK, "Sales Document: Header Data
VBAP, "Sales Document: Item Data
MARA, "Matrial Master
VBEP, "Sales Document: Schedule Line Data
VBPA, "Sales Document: Partner
TVROT,
YMSLT_MAIL_ID.
*=================End of Datebase tables Declaration====================
*==================Start of Virable ALV declaration=================
**=============================
TYPE POOLS
*=============================
TYPE-POOLS: SLIS.
*=============================
*FIELD CATALOG DECLARATION
*=============================
CONSTANTS : CO_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME
VALUE 'TOP_OF_PAGE'.
DATA : G_TABNAME_HEADER TYPE SLIS_TABNAME,
G_TABNAME_ITEM TYPE SLIS_TABNAME.
DATA: FELD_CAT TYPE SLIS_T_FIELDCAT_ALV," WITH HEADER LINE ,
ALV_LAYOUT TYPE SLIS_LAYOUT_ALV,
T_EVENTS TYPE SLIS_T_EVENT,
G_SAVE(1) TYPE C,
G_VARIANT LIKE DISVARIANT,
GX_VARIANT LIKE DISVARIANT,
EVENTS TYPE SLIS_T_EVENT,
G_EXIT(1) TYPE C,
LAYOUT TYPE SLIS_LAYOUT_ALV,
ALV_PRINT TYPE SLIS_PRINT_ALV,
ALV_DETAIL_FUNC(30),
EVENTS TYPE SLIS_T_EVENT,
T_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
RANGES : R_PARVW FOR VBPA-PARVW.
*=================End of Virable tables Declaration====================
*==================Start of Selection Screen Declaration================
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF BLOCK VAR WITH FRAME TITLE VARIANT.
PARAMETERS : P_VARI LIKE DISVARIANT-VARIANT.
SELECTION-SCREEN END OF BLOCK VAR.
SELECTION-SCREEN :BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS : S_VKORG FOR VBAK-VKORG OBLIGATORY, " Sales Org.
S_VKBUR FOR VBAK-VKBUR, " Sales Office
S_VKGRP FOR VBAK-VKGRP, " Sales Group
S_VTWEG FOR VBAK-VTWEG. " Distribution Channel
SELECTION-SCREEN :END OF BLOCK B2.
SELECTION-SCREEN :BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS : S_KUNNR FOR VBAK-KUNNR, "Customer Number
S_VBELN FOR VBAK-VBELN, "Sales Order Number
S_ERDAT FOR VBAK-ERDAT, "OBLIGATORY, "Sales Order Date
S_AUGRU FOR VBAK-AUGRU, "Order Reason
S_BSTNK FOR VBAK-BSTNK, "PO Number
S_AUART FOR VBAK-AUART. "Sales order type
SELECTION-SCREEN :END OF BLOCK B3.
SELECTION-SCREEN :BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-004.
SELECT-OPTIONS : S_WERKS FOR VBAP-WERKS, "plant,
S_MATNR FOR VBAP-MATNR, " Matrial Code
S_PSTYV FOR VBAP-PSTYV, "Sales Order Item cat.
S_EDATU FOR VBEP-EDATU, "Conformatin Date
S_REQDAT FOR VBAP-ZZCUST_REQDAT. "Req.Del Date
SELECTION-SCREEN :END OF BLOCK B4.
SELECTION-SCREEN :BEGIN OF BLOCK B5 WITH FRAME TITLE TEXT-005.
SELECT-OPTIONS : S_ZE FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION , "Partner Function
S_ZS FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
S_ZA FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
S_ZR FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION, "Partner Function
S_ZI FOR VBPA-KUNNR NO INTERVALS NO-EXTENSION. "Partner Function
*FOR VBPA-KUNNR MATCHCODE OBJECT ZSMR ,
***SELECT-OPTIONS : S_ZE FOR VBPA-PARVW NO INTERVALS NO-EXTENSION , "Partner Function
S_ZS FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
S_ZA FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
S_ZR FOR VBPA-PARVW NO INTERVALS NO-EXTENSION, "Partner Function
S_ZI FOR VBPA-PARVW NO INTERVALS NO-EXTENSION. "Partner Function
SELECTION-SCREEN :END OF BLOCK B5.
SELECTION-SCREEN : BEGIN OF BLOCK B6 WITH FRAME TITLE TEXT-006.
PARAMETER : P_SCREEN RADIOBUTTON GROUP RTYP DEFAULT 'X' USER-COMMAND
UCOMM ,
P_FILE RADIOBUTTON GROUP RTYP,
P_MAIL RADIOBUTTON GROUP RTYP.
SELECTION-SCREEN :END OF BLOCK B6.
SELECTION-SCREEN : BEGIN OF BLOCK B7 WITH FRAME TITLE TEXT-007.
PARAMETER : P_PEN RADIOBUTTON GROUP RE1 DEFAULT 'X' USER-COMMAND
UCOMM , " Pending Sales order
P_ALL RADIOBUTTON GROUP RE1, " ALL Sales order
P_BLOCK RADIOBUTTON GROUP RE1. " Blocked Sales order
P_DELE RADIOBUTTON GROUP RE1. " Delevered Sales order
SELECTION-SCREEN :END OF BLOCK B7.
SELECTION-SCREEN : END OF BLOCK B1.
*=================End of Selection Screen Declaration===================
*==================Start of Internal table Declaration==================
Internal table for vbak
DATA : BEGIN OF GT_VBAK OCCURS 0 ,
VBELN LIKE VBAK-VBELN , " Sales Document Number
ERDAT LIKE VBAK-ERDAT , " Order Date
AUART LIKE VBAK-AUART, "Sales Document Type
VTWEG LIKE VBAK-VTWEG, "Distribution Channel
SPART LIKE VBAK-SPART, "Division
KNUMV LIKE VBAK-KNUMV , "Number of the document condition
BSTNK LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
BSTDK LIKE VBAK-BSTDK, "Customer purchase order date
KUNNR LIKE VBAK-KUNNR, " Customer Code
ZOA_RECP_PLAN_DT LIKE VBAK-ZOA_RECP_PLAN_DT, "Order receipt at plant
END OF GT_VBAK.
Internal table for VBAP
DATA : BEGIN OF GT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, " Sales Document Number
POSNR LIKE VBAP-POSNR, " Sales Doc. Line item number
MATNR LIKE VBAP-MATNR,
ABGRU LIKE VBAP-ABGRU, "Reason for rejection
MEINS LIKE VBAP-MEINS, "Base Unit of Measure
FAKSP LIKE VBAP-FAKSP,
NETWR LIKE VBAP-NETWR, " Net Value
KWMENG LIKE VBAP-KWMENG, " Order Quantity
WERKS LIKE VBAP-WERKS, "PLANT
LGORT LIKE VBAP-LGORT, "S.Loc
ROUTE LIKE VBAP-ROUTE, " Route
ZZWIDTH LIKE VBAP-ZZWIDTH, " widht
ZZKDMAT LIKE VBAP-ZZKDMAT, " customer Matrial
ZZBRAND LIKE VBAP-ZZBRAND, " bRAND
ZZSPLDIA LIKE VBAP-ZZSPLDIA, "Spool Diameter
ZZCUST_REQDAT LIKE VBAP-ZZCUST_REQDAT, " REquested Date
ZZCOATING LIKE VBAP-ZZCOATING,
ZZWEIGHT LIKE VBAP-ZZWEIGHT,
ZZWEIGHT_UMO LIKE VBAP-ZZWEIGHT_UMO,
END OF GT_VBAP.
Internal table for VBEP
DATA : BEGIN OF GT_VBEP OCCURS 0,
VBELN LIKE VBEP-VBELN, " Sales Doc. Number
POSNR LIKE VBEP-POSNR, " Sales Doc. Item Number
ETENR LIKE VBEP-ETENR, "Delivery Schedule Line Number
EDATU LIKE VBEP-EDATU, "Schedule line date
END OF GT_VBEP.
Internal table for VBPA
DATA : BEGIN OF GT_VBPA OCCURS 0,
VBELN LIKE VBAP-VBELN, "Sales Document Number
POSNR LIKE VBAP-POSNR, "Sales Document Item Number
PARVW LIKE VBPA-PARVW, "Partner Function
KUNNR LIKE VBPA-KUNNR, " Customer Number
END OF GT_VBPA.
Internal table for VBKD
DATA : BEGIN OF GT_VBKD OCCURS 0,
VBELN LIKE VBKD-VBELN , " Sales Documet number
KDGRP LIKE VBKD-KDGRP, " Custoemr Group
INCO1 LIKE VBKD-INCO1, "Incoterms (Part 1)
INCO2 LIKE VBKD-INCO2, "Incoterms (Part 2)
ZTERM LIKE VBKD-ZTERM, " Payment Term
STCUR LIKE VBKD-STCUR, " Exchang Rate
END OF GT_VBKD.
Internal table VBFA
DATA : BEGIN OF GT_VBFA OCCURS 0 ,
VBELV LIKE VBFA-VBELV, " Preceding sales and distribution document
POSNV LIKE VBFA-POSNV, "Preceding item of an SD document
VBELN LIKE VBFA-VBELN, "Subsequent sales and distribution document
POSNN LIKE VBFA-POSNN, "Subsequent item of an SD document
VBTYP_N LIKE VBFA-VBTYP_N, "Document category of subsequent document
RFMNG LIKE VBFA-RFMNG, "Referenced quantity in base unit of measure
END OF GT_VBFA.
Internal table for KONV
DATA : BEGIN OF GT_KONV OCCURS 0,
KNUMV LIKE KONV-KNUMV, "Number of the document condition
KPOSN LIKE KONV-KPOSN, "Condition item number
KSCHL LIKE KONV-KSCHL , "Cond Type.
KBETR LIKE KONV-KBETR, " Rate per KG
WAERS LIKE KONV-WAERS, "currency
KWERT LIKE KONV-KWERT, "Condition value
END OF GT_KONV.
Internal table for MSKA,
DATA : BEGIN OF GT_MSKA OCCURS 0,
MATNR LIKE MSKA-MATNR, "Matrial
WERKS LIKE MSKA-WERKS, "PLANT
LGORT LIKE MSKA-LGORT, "S. Loc
CHARG LIKE MSKA-CHARG,"Batch Number
SOBKZ LIKE MSKA-SOBKZ, "Special Stock Indicator
VBELN LIKE MSKA-VBELN , "Sales Doc Number
POSNR LIKE MSKA-POSNR, "Sales Doc Item Number
KALAB LIKE MSKA-KALAB, "Unrestricted-Use Stock
KAINS LIKE MSKA-KAINS, " Stock in Quality Inspection
END OF GT_MSKA.
Internal table for MARD
DATA : BEGIN OF GT_MARD OCCURS 0 ,
MATNR LIKE MARD-MATNR, "Matrial
WERKS LIKE MARD-WERKS, "PLANT
LGORT LIKE MARD-LGORT, "S. Loc
LABST LIKE MARD-LABST, "Valuated Unrestricted-Use Stock
END OF GT_MARD.
Internal table for KNA1
DATA : BEGIN OF GT_KNA1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR , " Customer Number
NAME1 LIKE KNA1-NAME1, "Customer Name
NAME2 LIKE KNA1-NAME2, " Customer Name
ORT01 LIKE KNA1-ORT01, "City
END OF GT_KNA1.
DATA: BEGIN OF GT_KNA1_1 OCCURS 0,
KUNNR LIKE KNA1-KUNNR , " Customer Number
NAME1 LIKE KNA1-NAME1, "Customer Name
ORT01 LIKE KNA1-ORT01,
END OF GT_KNA1_1.
Internal table for KNVV
DATA : BEGIN OF GT_KNVV OCCURS 0,
KUNNR LIKE KNVV-KUNNR , " Customer Number
KLABC LIKE KNVV-KLABC, " Custoemr Class
END OF GT_KNVV.
Internal table for MAKT,
DATA : BEGIN OF GT_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR, "Matrial
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX, "Matrial DESC
MAKTG LIKE MAKT-MAKTG,
END OF GT_MAKT.
Internal table for MVKE
DATA : BEGIN OF GT_MVKE OCCURS 0 ,
MATNR LIKE MVKE-MATNR, "Matrial
MVGR1 LIKE MVKE-MVGR1, " Matrial Group
END OF GT_MVKE.
Internal table for TVM1T
DATA : BEGIN OF GT_TVM1T OCCURS 0 ,
SPRAS LIKE TVM1T-SPRAS,
MVGR1 LIKE TVM1T-MVGR1, " Matrial Group
BEZEI LIKE TVM1T-BEZEI, " Matrial Group DESC
END OF GT_TVM1T.
Internal table for TSPAT
DATA : BEGIN OF GT_TSPAT OCCURS 0,
SPRAS LIKE TSPAT-SPRAS,
SPART LIKE VBAK-SPART, "Division
VTEXT LIKE TSPAT-VTEXT, "Division Desc
END OF GT_TSPAT.
Internal table for TVTWT
DATA : BEGIN OF GT_TVTWT OCCURS 0 ,
SPRAS LIKE TVTWT-SPRAS,
VTWEG LIKE VBAK-VTWEG, " Distribution Channel
VTEXT LIKE TVTWT-VTEXT, "Distribution Channel Desc
END OF GT_TVTWT.
Internal table for TVAKT
DATA : BEGIN OF GT_TVAKT OCCURS 0,
SPRAS LIKE TVAKT-SPRAS,
AUART LIKE VBAK-AUART, "Sales Document Type
BEZEI LIKE TVAKT-BEZEI, "sALES dOC TYPE Description
END OF GT_TVAKT .
Internal table for T151t
DATA: BEGIN OF GT_VBUP OCCURS 0,
VBELN LIKE VBUP-VBELN,
POSNR LIKE VBUP-POSNR,
GBSTA LIKE VBUP-GBSTA,
END OF GT_VBUP.
DATA : BEGIN OF GT_T151T OCCURS 0,
SPRAS LIKE T151T-SPRAS,
KDGRP LIKE VBKD-KDGRP, " Custoemr Group
KTEXT LIKE T151T-KTEXT, " Custoemr Group Desc
END OF GT_T151T.
DATA : BEGIN OF GT_TVROT OCCURS 0,
SPRAS LIKE TVROT-SPRAS,
ROUTE LIKE TVROT-ROUTE, " Route code
BEZEI LIKE TVROT-BEZEI , " Route Desc
END OF GT_TVROT.
DATA : BEGIN OF GT_T052U OCCURS 0,
SPRAS LIKE T052U-SPRAS,
ZTERM LIKE T052U-ZTERM, " Payment terms
TEXT1 LIKE T052U-TEXT1, " text
END OF GT_T052U.
DATA: BEGIN OF GT_VBUK OCCURS 0,
VBELN LIKE VBUK-VBELN,
WBSTK LIKE VBUK-WBSTK,
END OF GT_VBUK.
*-------fINAL iNTERNAL TABLE FOR OUTPUT
DATA : BEGIN OF GT_FINAL_DATA OCCURS 0,
KUNNR LIKE VBAK-KUNNR, " cUSTOMER CODE
NAME(70) TYPE C, " cUSTOMER NAME
ORT01 LIKE KNA1-ORT01, "cITY
S_KUNNR LIKE VBAK-KUNNR, " cUSTOMER CODE
S_NAME(70) TYPE C, " cUSTOMER NAME
S_ORT01 LIKE KNA1-ORT01, "cITY
KLABC LIKE KNVV-KLABC, " Custoemr Class
VBELN(70) TYPE C, " LIKE VBAK-VBELN, "sALES oRDER nUMBER
POSNR LIKE VBAP-POSNR, "SALES ORDER LINE NUMBER
INCO1 LIKE VBKD-INCO1, "Incoterms (Part 1)
INCO2 LIKE VBKD-INCO2, "Incoterms (Part 2)
KALAB LIKE MSKA-KALAB, "Unrestricted-Use Stock
KAINS LIKE MSKA-KAINS, " Stock in Quality Inspection
LABST LIKE MARD-LABST, "Valuated Unrestricted-Use Stock
ERDAT LIKE VBAK-ERDAT , " Order Date
MATNR LIKE MAKT-MATNR, "Matrial
MAKTX LIKE MAKT-MAKTX, "Matrial DESC
MAKTG LIKE MAKT-MAKTG, "Matrial DESC
ZZKDMAT LIKE VBAP-ZZKDMAT, "Customter Mat. Number
ABGRU LIKE VBAP-ABGRU, " Reason for rejection
COLOR(20) TYPE C, "Color
COMPLEX(20) TYPE C, "Complex
WIDTH(10) TYPE C, "Width
KBETR LIKE KONV-KBETR, " Rate per KG
WAERS LIKE KONV-WAERS, "currency
STCUR LIKE VBKD-STCUR, " Exchang Rate
MEINS LIKE VBAP-MEINS, "Base Unit of Measure
KWMENG LIKE VBAP-KWMENG, " Order Quantity
RFMNG LIKE VBFA-RFMNG, "Referenced quantity in base unit of measure
BAL_QTY LIKE VBFA-RFMNG, " Balance QTY
EDATU LIKE VBEP-EDATU, "Schedule line date
DAYS(5) TYPE C, " Sch.Delay
BSTNK LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
BSTDK LIKE VBAK-BSTDK, "Customer purchase order date
VTWEG LIKE VBAK-VTWEG, "Distribution Channel
SPART LIKE VBAK-SPART, "Division
DIST_NAME LIKE TVTWT-VTEXT, "Distribution Channels NAME
DIV_NAME LIKE TSPAT-VTEXT, "Sales Divisions NAME
ZA_KUNNR LIKE KNA1-KUNNR,
ZA_NAME LIKE KNA1-NAME1,
ZE_KUNNR LIKE KNA1-KUNNR,
ZE_NAME LIKE KNA1-NAME1,
ZI_KUNNR LIKE KNA1-KUNNR,
ZI_NAME LIKE KNA1-NAME1,
ZR_KUNNR LIKE KNA1-KUNNR,
ZR_NAME LIKE KNA1-NAME1,
ZS_KUNNR LIKE KNA1-KUNNR,
ZS_NAME LIKE KNA1-NAME1,
MVGR1(20) TYPE C , " Matrial Group
B_VALUE LIKE KONV-KWERT, "bASIC value
EX_VALUE LIKE KONV-KWERT, "eXCISE value
EC_VALUE LIKE KONV-KWERT, "ecess value
HE_VALUE LIKE KONV-KWERT, "hcess value
VAT_VALUE LIKE KONV-KWERT, "VAT value
CST_VALUE LIKE KONV-KWERT, "CST
F_VALUE LIKE KONV-KWERT, "fREIGJT
C_VALUE LIKE KONV-KWERT, "cOMISSION
KDGRP(70) TYPE C, " Custoemr Group
NETWR LIKE VBAP-NETWR, " Net Value
INR LIKE VBAP-NETWR, " inr Net Value
AUART LIKE VBAK-AUART, "Sales Document Type
BEZEI LIKE TVAKT-BEZEI, "SALES DOC TYPE DESC
ZOA_RECP_PLAN_DT LIKE VBAK-ZOA_RECP_PLAN_DT, "Order receipt at plant
ZZCUST_REQDAT LIKE VBAP-ZZCUST_REQDAT, " REquested Date
ROUTE LIKE VBAP-ROUTE, " Route
ROUTE_NAME LIKE TVROT-BEZEI , "Route name
ZZBRAND LIKE VBAP-ZZBRAND, " bRAND
ZZSPLDIA LIKE VBAP-ZZSPLDIA, "Spool Diameter
ZTERM LIKE VBKD-ZTERM, " Payment Term
Z_TERM_TEXT(50) TYPE C, "Payment Terms Text
Z001(50) TYPE C, "text
Z002(50) TYPE C, "text
Z003(50) TYPE C, "text
Z004(50) TYPE C, "text
ZI_001(50) TYPE C, "text
ZI_002(50) TYPE C, "text
ZZCOATING(20) TYPE C,
ZZWEIGHT LIKE VBAP-ZZWEIGHT,
ZZWEIGHT_UMO LIKE VBAP-ZZWEIGHT_UMO,
WBSTK LIKE VBUK-WBSTK,
T_NETWR LIKE VBAP-NETWR, " Net Value
FAKSP LIKE VBAP-FAKSP,
END OF GT_FINAL_DATA.
*****Mail Data Decleration.
DATA : BEGIN OF MAIL_TAB OCCURS 0 ,
ZE_NAME LIKE KNA1-NAME1,
ZS_NAME LIKE KNA1-NAME1,
NAME LIKE KNA1-NAME1,
ORT01 LIKE KNA1-ORT01, "cITY
S_NAME LIKE KNA1-NAME1,
S_ORT01 LIKE KNA1-ORT01, "cITY
KLABC LIKE KNVV-KLABC, " Custoemr Class
VBELN LIKE VBAK-VBELN, "sALES oRDER nUMBER
POSNR LIKE VBAP-POSNR, "SALES ORDER LINE NUMBER
ERDAT LIKE VBAK-ERDAT , " Order Date
MATNR LIKE MAKT-MATNR, "Matrial
MAKTX LIKE MAKT-MAKTX, "Matrial DESC
ZZKDMAT LIKE VBAP-ZZKDMAT, "Customter Mat. Number
COLOR(20) TYPE C, "Color
COMPLEX(20) TYPE C, "Complex
WIDTH(10) TYPE C, "Width
KBETR LIKE KONV-KBETR, " Rate per KG
WAERS LIKE KONV-WAERS, "currency
MEINS LIKE VBAP-MEINS, "Base Unit of Measure
KWMENG LIKE VBAP-KWMENG, " Order Quantity
BAL_QTY LIKE VBFA-RFMNG, " Balance QTY
EDATU LIKE VBEP-EDATU, "Schedule line date
DAYS(5) TYPE C, " Sch.Delay
BSTNK LIKE VBAK-BSTNK, " cUSTOMER pURCHASE ORDER NUMBER
BSTDK LIKE VBAK-BSTDK, "Customer purchase order date
ZA_NAME LIKE KNA1-NAME1,
ZI_NAME LIKE KNA1-NAME1,
ZR_NAME LIKE KNA1-NAME1,
MVGR1(20) TYPE C , " Matrial Group
ZZCUST_REQDAT LIKE VBAP-ZZCUST_REQDAT, " REquested Date
ZZBRAND LIKE VBAP-ZZBRAND, " bRAND
END OF MAIL_TAB.
DATA : IT_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
DATA : SM_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
DATA : SP_MAIL_ID TYPE YMSLT_MAIL_ID OCCURS 0 WITH HEADER LINE.
DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
DATA STR_VAL TYPE STRING.
CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
CONSTANTS:
CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
DATA: GT_VBAK_KNA1 LIKE GT_VBAK OCCURS 0 WITH HEADER LINE,
GT_VBAP_VBPA LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
GT_VBAP_MAKT LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
GT_MVKE_TVM1T LIKE GT_MVKE OCCURS 0 WITH HEADER LINE,
GT_VBAP_MSKA LIKE GT_VBAP OCCURS 0 WITH HEADER LINE,
GT_VBPA_KNA1 LIKE GT_VBPA OCCURS 0 WITH HEADER LINE,
GT_VBFA_VBUK LIKE GT_VBFA OCCURS 0 WITH HEADER LINE,
GT_VBAP_INOB LIKE GT_VBAP OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF GT_INOB OCCURS 0.
INCLUDE STRUCTURE INOB.
DATA : END OF GT_INOB.
DATA: BEGIN OF GT_YCAT_PARAMS OCCURS 0,
KEY01 TYPE YYKEY01_C10,
KEY02 TYPE YYKEY02_C16,
KEY03 TYPE YYKEY03_C20,
SRNO TYPE YYSRNO_N4,
VALUE TYPE YYVALUE_C25,
END OF GT_YCAT_PARAMS.
DATA: BEGIN OF GT_CABN OCCURS 0,
ATINN LIKE CABN-ATINN,
ATNAM LIKE CABN-ATNAM,
END OF GT_CABN.
DATA: BEGIN OF GT_AUSP OCCURS 0,
OBJEK LIKE AUSP-OBJEK,
ATINN LIKE AUSP-ATINN,
ATWRT LIKE AUSP-ATWRT,
END OF GT_AUSP.
DATA: BEGIN OF GT_CUOBJ OCCURS 0,
CUOBJ(18) TYPE C,
CUOBJ TYPE OBJNUM,
END OF GT_CUOBJ.
DATA: BEGIN OF GT_CAWN OCCURS 0,
ATINN LIKE CAWN-ATINN,
ATZHL LIKE CAWN-ATZHL,
ATWRT LIKE CAWN-ATWRT,
END OF GT_CAWN.
DATA: BEGIN OF GT_CAWNT OCCURS 0,
ATINN LIKE CAWNT-ATINN,
ATZHL LIKE CAWNT-ATZHL,
SPRAS LIKE CAWNT-SPRAS,
ATWTB LIKE CAWNT-ATWTB,
END OF GT_CAWNT.
START-OF-SELECTION *
INITIALIZATION.
VARIANT = 'Display Options'.
RB1 = 'X'.
REPNAME = SY-REPID.
PERFORM BUILD_EVENTTAB USING EVENTS[].
PERFORM BUILD_LAYOUT .
PERFORM INITIALIZE_VARIANT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
PERFORM F4_FOR_VARIANT.
AT SELECTION-SCREEN.
PERFORM PAI_OF_SELECTION_SCREEN.
END-OF-SELECTION.
PERFORM SELECT_DATA.
PERFORM PROCESS_DATA.
PERFORM FILTER_PATNER_DATA.
IF P_FILE = 'X'.
PERFORM OUT_PUT_FILE.
ELSEIF P_SCREEN = 'X'.
PERFORM FILED_CAT_LOG.
PERFORM CREATE_ALV_LAYOUT.
PERFORM fill_events.
PERFORM OUT_PUT_DATA.
ELSEIF P_MAIL = 'X'.
PERFORM MAIL_RPT.
ENDIF.
*=================Start of Internal table Declaration===================
*===========
*& Form SELECT_DATA
sELECTING DATA FROM dATA bASE
FORM SELECT_DATA .
REFRESH R_PARVW.
R_PARVW-SIGN = 'I'.
R_PARVW-OPTION = 'EQ'.
IF NOT S_ZE[] IS INITIAL.
R_PARVW-LOW = S_ZE-LOW.
APPEND R_PARVW.
ENDIF.
IF NOT S_ZS[] IS INITIAL.
R_PARVW-LOW = S_ZS-LOW.
APPEND R_PARVW.
ENDIF.
IF NOT S_ZA[] IS INITIAL.
R_PARVW-LOW = S_ZA-LOW.
APPEND R_PARVW.
ENDIF.
IF NOT S_ZR[] IS INITIAL.
R_PARVW-LOW = S_ZR-LOW.
APPEND R_PARVW.
ENDIF.
IF NOT S_ZI[] IS INITIAL.
R_PARVW-LOW = S_ZI-LOW.
APPEND R_PARVW.
ENDIF.
R_PARVW-LOW = 'SH'.
APPEND R_PARVW.
sELECTING DATA FROM VBAK TABLE INTO INTERNAL TABLE GT_VBAK
SELECT VBELN ERDAT AUART
VTWEG SPART KNUMV
BSTNK BSTDK KUNNR
ZOA_RECP_PLAN_DT
INTO TABLE GT_VBAK
FROM VBAK
WHERE VBELN IN S_VBELN
AND ERDAT IN S_ERDAT
AND VBTYP = 'C'
AND AUART IN S_AUART
AND AUGRU IN S_AUGRU
AND VKORG IN S_VKORG
AND VTWEG IN S_VTWEG
AND VKGRP IN S_VKGRP
AND VKBUR IN S_VKBUR
AND BSTNK IN S_BSTNK
AND KUNNR IN S_KUNNR.
SORT GT_VBAK[] BY VBELN.
IF NOT GT_VBAK[] IS INITIAL.
Selecting data from VBAP into Internal tabl gt_vbap
IF P_BLOCK = 'X' .
SELECT VBELN POSNR
MATNR ABGRU
MEINS FAKSP
NETWR KWMENG
WERKS LGORT
ROUTE ZZWIDTH
ZZKDMAT ZZBRAND
ZZSPLDIA ZZCUST_REQDAT
ZZCOATING ZZWEIGHT
ZZWEIGHT_UMO
INTO TABLE GT_VBAP
FROM VBAP
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELN = GT_VBAK-VBELN
AND MATNR IN S_MATNR
AND ABGRU <> ''
AND WERKS IN S_WERKS
ELSEIF P_PEN = 'X'.
SELECT VBELN POSNR
MATNR ABGRU
MEINS FAKSP
NETWR KWMENG
WERKS LGORT
ROUTE ZZWIDTH
ZZKDMAT ZZBRAND
ZZSPLDIA ZZCUST_REQDAT
ZZCOATING ZZWEIGHT
ZZWEIGHT_UMO
INTO TABLE GT_VBAP
FROM VBAP
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELN = GT_VBAK-VBELN
AND MATNR IN S_MATNR
AND FAKSP <> '10'
AND WERKS IN S_WERKS.
ELSE.
SELECT VBELN POSNR
MATNR ABGRU
MEINS FAKSP
NETWR KWMENG
WERKS LGORT
ROUTE ZZWIDTH
ZZKDMAT ZZBRAND
ZZSPLDIA ZZCUST_REQDAT
ZZCOATING ZZWEIGHT
ZZWEIGHT_UMO
INTO TABLE GT_VBAP
FROM VBAP
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELN = GT_VBAK-VBELN
AND MATNR IN S_MATNR
AND WERKS IN S_WERKS.
ENDIF.
ENDIF.
IF P_PEN = 'X'.
SELECT VBELN POSNR GBSTA FROM VBUP INTO TABLE GT_VBUP
FOR ALL ENTRIES IN GT_VBAP
WHERE VBELN = GT_VBAP-VBELN AND POSNR = GT_VBAP-POSNR AND
GBSTA <> 'C'.
SORT GT_VBUP[] BY VBELN.
LOOP AT GT_VBAP.
READ TABLE GT_VBUP WITH KEY VBELN = GT_VBAP-VBELN
POSNR = GT_VBAP-POSNR.
IF SY-SUBRC <> 0.
DELETE GT_VBAP.
ENDIF.
CLEAR GT_VBUP.
ENDLOOP.
LOOP AT GT_VBAK.
READ TABLE GT_VBAP WITH KEY VBELN = GT_VBAK-VBELN.
IF SY-SUBRC <> 0.
DELETE GT_VBAK.
ENDIF.
CLEAR GT_VBAP.
ENDLOOP.
ENDIF.
IF NOT GT_VBAP[] IS INITIAL.
GT_VBAP_INOB[] = GT_VBAP[].
SORT GT_VBAP_INOB[] BY MATNR.
DELETE ADJACENT DUPLICATES FROM GT_VBAP_INOB COMPARING MATNR.
SELECT * FROM INOB INTO TABLE GT_INOB
WHERE KLART = '023'
AND OBTAB = 'MARA'.
IF SY-SUBRC = 0.
SELECT KEY01 KEY02 KEY03 SRNO VALUE
INTO TABLE Gt_YCAT_PARAMS
FROM YCAT_PARAMS
WHERE KEY01 = 'CHAR_NAME'
AND KEY02 = 'ATNAM'
AND ( KEY03 = 'COLOR' OR KEY03 = 'COMPLEX' )
AND SRNO = '0001'.
SELECT ATINN ATNAM INTO TABLE GT_CABN FROM CABN
WHERE ( ATNAM = 'COLOUR' OR ATNAM = 'COMPLEX' ).
LOOP AT GT_INOB.
GT_CUOBJ-CUOBJ = GT_INOB-CUOBJ.
APPEND GT_CUOBJ.
ENDLOOP.
SELECT OBJEK ATINN ATWRT
INTO TABLE GT_AUSP FROM AUSP
FOR ALL ENTRIES IN GT_CUOBJ
WHERE OBJEK = GT_CUOBJ-CUOBJ.
AND ATINN = L_ATINN.
SELECT ATINN ATZHL ATWRT INTO TABLE GT_CAWN
FROM CAWN FOR ALL ENTRIES IN GT_AUSP
WHERE ATWRT = GT_AUSP-ATWRT.
SELECT ATINN ATZHL SPRAS ATWTB INTO TABLE GT_CAWNT
FROM CAWNT FOR ALL ENTRIES IN GT_CAWN
WHERE ATINN = GT_CAWN-ATINN
AND ATZHL = GT_CAWN-ATZHL
AND SPRAS = 'EN'.
ENDIF.
Selecting data from VBeP into Internal tabl gt_vbep
SORT GT_VBAP[] BY VBELN POSNR.
SELECT VBELN POSNR
ETENR EDATU
INTO TABLE GT_VBEP
FROM VBEP
FOR ALL ENTRIES IN GT_VBAP
WHERE VBELN = GT_VBAP-VBELN
AND POSNR = GT_VBAP-POSNR
AND EDATU IN S_EDATU
AND BMENG <> 0.
SELECT SPRAS ROUTE BEZEI
INTO TABLE GT_TVROT
FROM TVROT
WHERE SPRAS = 'EN'.
ENDIF.
IF NOT GT_VBAP[] IS INITIAL.
GT_VBAP_VBPA[] = GT_VBAP[].
SORT GT_VBAP_VBPA[] BY VBELN.
DELETE ADJACENT DUPLICATES FROM GT_VBAP_VBPA COMPARING VBELN.
Selecting data from VBPA into Internal tabl GT_VBPA
IF NOT R_PARVW[] IS INITIAL.
SELECT VBELN POSNR
PARVW KUNNR
INTO TABLE GT_VBPA
FROM VBPA
FOR ALL ENTRIES IN GT_VBAP_VBPA
WHERE VBELN = GT_VBAP_VBPA-VBELN
AND ( PARVW IN R_PARVW
OR PARVW = 'WE' ).
ELSE.
SELECT VBELN POSNR
PARVW KUNNR
INTO TABLE GT_VBPA
FROM VBPA
FOR ALL ENTRIES IN GT_VBAP_VBPA
WHERE VBELN = GT_VBAP_VBPA-VBELN
AND ( PARVW = 'ZE'
OR PARVW = 'ZS'
OR PARVW = 'ZA'
OR PARVW = 'ZR'
OR PARVW = 'ZI' OR PARVW = 'WE' ).
ENDIF.
ENDIF.
SORT GT_VBPA[].
GT_VBPA_KNA1[] = GT_VBPA[].
SORT GT_VBPA_KNA1[] BY KUNNR.
DELETE ADJACENT DUPLICATES FROM GT_VBPA_KNA1 COMPARING KUNNR.
IF NOT GT_VBPA_KNA1[] IS INITIAL.
SELECT KUNNR NAME1 ORT01 FROM KNA1 INTO TABLE
GT_KNA1_1 FOR ALL ENTRIES IN GT_VBPA_KNA1
WHERE KUNNR = GT_VBPA_KNA1-KUNNR.
ENDIF.
Selecting data from VBKD into Internal tabl GT_VBKD
IF NOT GT_VBAK[] IS INITIAL.
SELECT VBELN KDGRP
INCO1 INCO2
ZTERM STCUR
INTO TABLE GT_VBKD
FROM VBKD
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELN = GT_VBAK-VBELN
AND PRSDT <> ''.
Selecting data from VBFA into Internal table gt_vbfa
IF P_PEN = 'X'.
SELECT VBFAVBELV VBFAPOSNV
VBFAVBELN VBFAPOSNN
VBFAVBTYP_N VBFARFMNG
INTO TABLE GT_VBFA
FROM VBFA INNER JOIN
VBAK ON VBFAVBELV = VBAKVBELN
WHERE
( VBFA~VBTYP_N = 'J' OR
VBFA~VBTYP_N = 'R').
LOOP AT GT_VBFA.
READ TABLE GT_VBAK WITH KEY VBELN = Gt_VBFA-VBELV.
IF SY-SUBRC <> 0.
DELETE GT_VBFA.
ENDIF.
CLEAR GT_VBFA.
ENDLOOP.
SELECT VBELV POSNV
VBELN POSNN
VBTYP_N RFMNG
INTO TABLE GT_VBFA
FROM VBFA
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELV = GT_VBAK-VBELN
AND ( VBTYP_N = 'J' OR
VBTYP_N = 'R').
ELSE.
SELECT VBELV POSNV
VBELN POSNN
VBTYP_N RFMNG
INTO TABLE GT_VBFA
FROM VBFA
FOR ALL ENTRIES IN GT_VBAK
WHERE VBELV = GT_VBAK-VBELN
AND VBTYP_N = 'J'.
ENDIF.
SORT GT_VBFA[].
IF GT_VBFA[] IS NOT INITIAL.
GT_VBFA_VBUK[] = GT_VBFA[].
SORT GT_VBFA_VBUK[] BY VBELN.
DELETE ADJACENT DUPLICATES FROM GT_VBFA_VBUK COMPARING VBELN.
SELECT VBELN WBSTK FROM VBUK INTO TABLE GT_VBUK
FOR ALL ENTRIES IN GT_VBFA_VBUK
WHERE VBELN = GT_VBFA_VBUK-VBELN.
ENDIF.
-----------Selection data from KONv into Internal table gt_konv
SORT GT_VBAK[] BY KNUMV.
SELECT KNUMV KPOSN KSCHL
KBETR WAERS KWERT
INTO TABLE GT_KONV
FROM KONV
FOR ALL ENTRIES IN GT_VBAK
WHERE KNUMV = GT_VBAK-KNUMV
AND ( KSCHL = 'ZBAP'
OR KSCHL = 'JEXP'
OR KSCHL = 'JEDC'
OR KSCHL = 'JEDH'
OR KSCHL = 'ZJIP'
OR KSCHL = 'ZCOM'
OR KSCHL = 'JIVC'
OR KSCHL = 'JFRE' ).
ENDIF.
IF NOT GT_VBAP[] IS INITIAL.
sELECING dATA FROM MSKA INTO INTERNAL TABLE GT_MSKA
GT_VBAP_MSKA[] = GT_VBAP[].
SORT GT_VBAP_MSKA[] BY MATNR WERKS VBELN POSNR.
DELETE ADJACENT DUPLICATES FROM GT_VBAP_MSKA COMPARING MATNR WERKS VBELN POSNR.
SELECT MATNR WERKS
LGORT CHARG
SOBKZ VBELN
POSNR
KALAB KAINS
INTO TABLE GT_MSKA
FROM MSKA
FOR ALL ENTRIES IN GT_VBAP_MSKA
WHERE MATNR = GT_VBAP_MSKA-MATNR
AND WERKS = GT_VBAP_MSKA-WERKS
AND LGORT = GT_VBAP-LGORT
AND VBELN = GT_VBAP_MSKA-VBELN
AND POSNR = GT_VBAP_MSKA-POSNR.
SORT GT_MSKA[].
DATA :BEGIN OF TMP_MATNR OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF TMP_MATNR.
LOOP AT GT_VBAP.
TMP_MATNR-MATNR = GT_VBAP-MATNR.
TMP_MATNR-MATNR+0(1) ='S'.
APPEND TMP_MATNR.
ENDLOOP.
SORT TMP_MATNR[].
DELETE ADJACENT DUPLICATES FROM TMP_MATNR COMPARING MATNR.
SELECT MATNR
WERKS
LGORT
LABST
FROM MARD
INTO TABLE GT_MARD
FOR ALL ENTRIES IN TMP_MATNR
WHERE MATNR = TMP_MATNR-MATNR."'SDX25000B040GC01'."GT_VBAP-MATNR.
ENDIF.
SORT GT_MARD[].
IF NOT GT_VBAK[] IS INITIAL.
GT_VBAK_KNA1[] = GT_VBAK[].
SORT GT_VBAK_KNA1[] BY KUNNR.
DELETE ADJACENT DUPLICATES FROM GT_VBAK_KNA1 COMPARING KUNNR.
SELECT KUNNR
NAME1
NAME2
ORT01
FROM KNA1
INTO TABLE GT_KNA1
FOR ALL ENTRIES IN GT_VBAK_KNA1
WHERE KUNNR = GT_VBAK_KNA1-KUNNR.
SELECT KUNNR KLABC
FROM KNVV
INTO TABLE GT_KNVV
FOR ALL ENTRIES IN GT_VBAK_KNA1
WHERE KUNNR = GT_VBAK_KNA1-KUNNR.
ENDIF.
IF NOT GT_VBAP[] IS INITIAL.
GT_VBAP_MAKT[] = GT_VBAP[].
SORT GT_VBAP_MAKT[] BY MATNR.
DELETE ADJACENT DUPLICATES FROM GT_VBAP_MAKT COMPARING MATNR.
SELECT MATNR
SPRAS
MAKTX
FROM MAKT
INTO TABLE GT_MAKT
FOR ALL ENTRIES IN GT_VBAP_MAKT
WHERE MATNR = GT_VBAP_MAKT-MATNR AND
SPRAS = 'EN'.
SELECT MATNR
MVGR1
FROM MVKE
INTO TABLE GT_MVKE
FOR ALL ENTRIES IN GT_VBAP_MAKT
WHERE MATNR = GT_VBAP_MAKT-MATNR
AND MVGR1 <> ''.
ENDIF.
IF NOT GT_MVKE[] IS INITIAL.
GT_MVKE_TVM1T[] = GT_MVKE[].
SORT GT_MVKE_TVM1T[] BY MVGR1.
DELETE ADJACENT DUPLICATES FROM GT_MVKE_TVM1T COMPARING MVGR1.
SELECT SPRAS MVGR1 BEZEI
FROM TVM1T
INTO TABLE GT_TVM1T
FOR ALL ENTRIES IN GT_MVKE_TVM1T
WHERE SPRAS = 'EN' AND
MVGR1 = GT_MVKE_TVM1T-MVGR1.
ENDIF.
IF NOT GT_VBAK[] IS INITIAL.
SELECT SPRAS
SPART
VTEXT
FROM TSPAT
INTO TABLE GT_TSPAT
WHERE SPRAS = 'EN'.
SELECT SPRAS
VTWEG
VTEXT
FROM TVTWT
INTO TABLE GT_TVTWT
WHERE SPRAS = 'EN'.
SELECT SPRAS AUART BEZEI
FROM TVAKT
INTO TABLE GT_TVAKT
WHERE
SPRAS = 'EN'.
ENDIF.
IF NOT GT_VBKD[] IS INITIAL.
SELECT SPRAS KDGRP
KTEXT
FROM T151T
INTO TABLE GT_T151T
FOR ALL ENTRIES IN GT_VBKD
WHERE SPRAS = 'EN' .
AND
KDGRP = GT_VBKD-KDGRP.
ENDIF.
IF NOT GT_VBKD[] IS INITIAL.
SELECT SPRAS ZTERM TEXT1
FROM T052U
INTO TABLE GT_T052U
FOR ALL ENTRIES IN GT_VBKD
WHERE SPRAS = 'EN'.
AND ZTERM = GT_VBKD-ZTERM.
ENDIF.
ENDFORM. " SELECT_DATA
*& Form PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM PROCESS_DATA .
DATA : T_FLAG(2) TYPE C,
J_AMT LIKE VBFA-RFMNG,
M_AMT LIKE VBFA-RFMNG,
R_AMT LIKE VBFA-RFMNG,
N_AMT LIKE VBFA-RFMNG,
JR_AMT LIKE VBFA-RFMNG,
MN_AMT LIKE VBFA-RFMNG,
TMP_WBSTK LIKE VBUK-WBSTK,
SFG_MATNR LIKE MARD-MATNR.
LOOP AT GT_VBAP.
CLEAR : GT_FINAL_DATA,
J_AMT ,
M_AMT ,
R_AMT,
N_AMT ,
JR_AMT ,
SFG_MATNR,
MN_AMT .
READ TABLE GT_VBAK WITH KEY VBELN = GT_VBAP-VBELN.
IF SY-SUBRC = 0.
GT_FINAL_DATA-KUNNR = GT_VBAK-KUNNR.
GT_FINAL_DATA-VBELN = GT_VBAK-VBELN.
GT_FINAL_DATA-POSNR = GT_VBAP-POSNR.
GT_FINAL_DATA-ABGRU = GT_VBAP-ABGRU.
ENDIF.
READ TABLE GT_KNA1 WITH KEY KUNNR = GT_VBAK-KUNNR.
IF SY-SUBRC = 0.
GT_FINAL_DATA-NAME = GT_KNA1-NAME1.
GT_FINAL_DATA-ORT01 = GT_KNA1-ORT01.
ENDIF.
READ TABLE GT_KNVV WITH KEY KUNNR = GT_VBAK-KUNNR.
IF SY-SUBRC = 0.
GT_FINAL_DATA-KLABC = GT_KNVV-KLABC.
ENDIF.
IF SY-SUBRC = 0.
READ TABLE GT_VBKD WITH KEY VBELN = GT_VBAK-VBELN.
GT_FINAL_DATA-INCO1 = GT_VBKD-INCO1. "Incoterms (Part 1)
GT_FINAL_DATA-INCO2 = GT_VBKD-INCO2. "Incoterms (Part 2)
GT_FINAL_DATA-ZTERM = GT_VBKD-ZTERM. " Payment Term
ENDIF.
LOOP AT GT_MSKA WHERE MATNR = GT_VBAP-MATNR
AND WERKS = GT_VBAP-WERKS
AND LGORT = GT_VBAP-LGORT
AND VBELN = GT_VBAP-VBELN
AND POSNR = GT_VBAP-POSNR.
GT_FINAL_DATA-KALAB = GT_FINAL_DATA-KALAB + GT_MSKA-KALAB. "Unrestricted-Use Stock
GT_FINAL_DATA-KAINS = GT_FINAL_DATA-KAINS + GT_MSKA-KAINS. " Stock in Quality Inspection
ENDLOOP.
SFG_MATNR = GT_VBAP-MATNR.
SFG_MATNR+0(1) ='S'.
READ TABLE GT_MARD WITH KEY MATNR = SFG_MATNR
WERKS = GT_VBAP-WERKS
LGORT = 'SF01'.
loop at gt_mard where MATNR = SFG_MATNR
and WERKS = GT_VBAP-WERKS.
IF SY-SUBRC = 0.
GT_FINAL_DATA-LABST = GT_FINAL_DATA-LABST + GT_MARD-LABST . "Valuated Unrestricted-Use Stock
ENDIF.
endloop.
GT_FINAL_DATA-MATNR = GT_VBAP-MATNR. "Matrial
GT_FINAL_DATA-ZZKDMAT = GT_VBAP-ZZKDMAT. " Customer Mat. NHi Rajan,
There is a lot of scope for performance tuning the code:
1. Read statement should be with BINARY SEARCH
2. Select statement should have FIELDS in the same order as they exist in the table
3. Select statement where clause should have fields in same order as they exist in the table.
4. Internal tables seem to be having a huge number of fields. If possible, please limit the fields to only required fields in the internal table.
Best regards,
Prashant
Maybe you are looking for
-
Problems: VC3 Publish errors
Hi, I am evaluating Visual Communicator 3 for use within my company. I am recording via Firewire using a miniDV camera. Recording does not show any problem (audio and video appear synchronized). The Review also plays fine. The problem comes when I tr
-
InDesign asking for location of embedded files
I embedded two links in an InDesign document before I sent them to another designer, so I would only have to send one file and not 3. However, the designer called to say InDesign was asking him to locate the embedded files or something, and he couldn
-
Reg - Work flow not receive...
Gurus, Workflow is working fine. 1 person only not receive the PR / PO's in workplace. The release strategies & Zwf_relcodes are ok. Pls advise how to check... Rajesh
-
Problems with the sie of an array
I�m reading data from an InputStream, byte[] readBuffer = new byte[200] ; try { while (inputStream.available() > 0) { int numBytes = inputStream.read(readBuffer); }My pro
-
N97 - using songs as ringtones issue
If i choose a random contact and push edit I can choose ringtone. I get a menu with different folders, and i would pick the music folder. But, just a few of my songs from the musiclibrary shows up. But if i go to the musicplayer I am able to take wha