2009 Feb 10 7:54 AM
Hi,
I had made a code in which i am taking the data from the JEST table and then take the data to the AUFK table. But it is not working . Here's d code:-
report zsample.
**********************************************************************
TABLES:AUFK,AUFM,JEST.
**********************************************************************
***********************INETERNAL TABLES DECLARATION*********************************************
**********************************************************************
DECLARATION FOR JEST TABLE
**********************************************************************
DATA: BEGIN OF ITPO1 OCCURS 0,
OBJNR LIKE JEST-OBJNR, "Object number
STAT LIKE JEST-STAT, "Object status
INACT LIKE JEST-INACT, "Indicator: Status Is Inactive
END OF ITPO1.
DATA: BEGIN OF ITPO2 OCCURS 0,
OBJNR LIKE JEST-OBJNR, "Object number
STAT LIKE JEST-STAT, "Object status
INACT LIKE JEST-INACT, "Indicator: Status Is Inactive
END OF ITPO2.
**********************************************************************
DECLARATION FOR AUFK TABLE
**********************************************************************
DATA: BEGIN OF ITPO3 OCCURS 0,
OBJNR LIKE AUFK-OBJNR, "Object number
AUFNR LIKE AUFK-AUFNR, "Order Number
WERKS LIKE AUFK-WERKS, "Plant
END OF ITPO3.
**********************************************************************
DECLARATION FOR AUFM TABLE
**********************************************************************
DATA: BEGIN OF ITPO4 OCCURS 0,
AUFNR LIKE AUFM-AUFNR, "Order Number
BWART LIKE AUFM-BWART, "Movement Type (Inventory Management)
MENGE LIKE AUFM-MENGE, "Quantity
MEINS LIKE AUFM-MEINS, "Base Unit of Measure
BLDAT LIKE AUFM-BLDAT, "Document Date in Document
WERKS LIKE AUFM-WERKS, "Plant
END OF ITPO4.
**********************************************************************
*********************************************************************
PARAMETERS N SELECT-OPTIONS
*********************************************************************
PARAMETERS: PLANT LIKE AUFM-WERKS.
SELECT-OPTIONS: PO_NO FOR JEST-OBJNR.
************************************************************************************************************
SELECT AOBJNR ASTAT A~INACT
FROM JEST AS A
INTO TABLE ITPO1
WHERE ASTAT = 'I0045' AND AINACT = ' ' AND A~OBJNR IN PO_NO= 'OR00000'.
SORT ITPO1 BY OBJNR STAT.
SELECT DISTINCT BOBJNR BSTAT B~INACT
FROM JEST AS B
INTO TABLE ITPO2
WHERE BOBJNR <> ITPO1-OBJNR AND BOBJNR IN PO_NO.
SORT ITPO2 BY OBJNR STAT.
SELECT COBJNR CAUFNR C~WERKS
FROM AUFK AS C
INTO TABLE ITPO3
WHERE COBJNR = ITPO2-OBJNR ."AND COBJNR IN PO_NO.
SORT ITPO3 BY AUFNR OBJNR.
**********************************************************************
LOOP AT ITPO3.
WRITE: / ITPO3-AUFNR,ITPO3-OBJNR."ITPO3-BWART,ITPO3-MENGE,ITPO3-MEINS.
ENDLOOP.
**********************************************************************
Plzz provide me guidelines to solve this problem.
Edited by: Julius Bussche on Feb 10, 2009 9:59 AM
Please use meaningfull subject titles
2009 Feb 10 7:58 AM
hi,
Check this Code You need to Use the For All Entries statement
SELECT OBJNR STAT INACT
FROM JEST
INTO TABLE ITPO1
WHERE STAT = 'I0045' AND INACT = ' ' AND OBJNR IN PO_NO.
SORT ITPO1 BY OBJNR STAT.
SELECT DISTINCT OBJNR STAT INACT
FROM JEST
INTO TABLE ITPO2
FOR ALL ENTRIES IN ITPO1
WHERE OBJNR EQ ITPO1-OBJNR.
SORT ITPO2 BY OBJNR STAT.
SELECT OBJNR AUFNR WERKS
FROM AUFK
INTO TABLE ITPO3
FOR ALL ENTRIES IN ITPO2
WHERE OBJNR = ITPO2-OBJNR .
SORT ITPO3 BY AUFNR OBJNR.
2009 Feb 10 8:09 AM
Hi,
I want to have the entries in the ITPO2 which are not equal to ITPO1. 1 thing more how do the program know that the Prd Order i am looking for as i am using objnr(Object Id) in the selection parameters and i want to have the prd.ord in for further processing.
Please provide me for solving this problem.
Edited by: ricx .s on Feb 10, 2009 9:10 AM
2009 Feb 10 8:14 AM
Hi,
SELECT DISTINCT bobjnr bstat b~inact
FROM jest AS b
INTO TABLE itpo2
FOR ALL ENTRIES IN itpo1
WHERE b~objnr <> itpo1-objnr.
Regards,
Siddarth
2009 Feb 10 8:15 AM
HI,
The link b/w them is working fine but last problem is that when i execute the program the select - options are using the OBJNR field where as i want to use AUFNR(Production Order Number) .
How do i use it as i am getting it in the 3rd Internal Table (ITPO3).
Plzz provide me guidelines to solve this problem .
Edited by: ricx .s on Feb 10, 2009 9:54 AM
2009 Feb 10 12:40 PM
Hi,
To make myself clear ,
you want to use aufnr field as select-options instead of objnr....
if that is the case then you can use it as select-option,
get the records from aufk table
and then populate data to itpo2 using for all entries in ipto2 where objnr = itpo3-objnr..
Regards,
Siddarth
2009 Feb 10 8:05 AM
Hi,
use this code
REPORT yh1307_sample.
**********************************************************************
TABLES:aufk,aufm,jest.
**********************************************************************
***********************INETERNAL TABLES DECLARATION*********************************************
**********************************************************************
*DECLARATION FOR JEST TABLE
**********************************************************************
DATA: BEGIN OF itpo1 OCCURS 0,
objnr LIKE jest-objnr, "Object number
stat LIKE jest-stat, "Object status
inact LIKE jest-inact, "Indicator: Status Is Inactive
END OF itpo1.
DATA: BEGIN OF itpo2 OCCURS 0,
objnr LIKE jest-objnr, "Object number
stat LIKE jest-stat, "Object status
inact LIKE jest-inact, "Indicator: Status Is Inactive
END OF itpo2.
**********************************************************************
*DECLARATION FOR AUFK TABLE
**********************************************************************
DATA: BEGIN OF itpo3 OCCURS 0,
objnr LIKE aufk-objnr, "Object number
aufnr LIKE aufk-aufnr, "Order Number
werks LIKE aufk-werks, "Plant
END OF itpo3.
**********************************************************************
*DECLARATION FOR AUFM TABLE
**********************************************************************
DATA: BEGIN OF itpo4 OCCURS 0,
aufnr LIKE aufm-aufnr, "Order Number
bwart LIKE aufm-bwart, "Movement Type (Inventory Management)
menge LIKE aufm-menge, "Quantity
meins LIKE aufm-meins, "Base Unit of Measure
bldat LIKE aufm-bldat, "Document Date in Document
werks LIKE aufm-werks, "Plant
END OF itpo4.
**********************************************************************
*********************************************************************
*PARAMETERS N SELECT-OPTIONS
*********************************************************************
PARAMETERS: plant LIKE aufm-werks.
SELECT-OPTIONS: po_no FOR jest-objnr.
************************************************************************************************************
SELECT aobjnr astat a~inact
FROM jest AS a
INTO TABLE itpo1
WHERE astat = 'I0045' AND ainact = ' ' AND a~objnr IN po_no. "= 'OR00000'.
SORT itpo1 BY objnr stat.
SELECT DISTINCT bobjnr bstat b~inact
FROM jest AS b
INTO TABLE itpo2
FOR ALL ENTRIES IN itpo1
WHERE bobjnr = itpo1-objnr AND bobjnr IN po_no.
SORT itpo2 BY objnr stat.
SELECT cobjnr caufnr c~werks
FROM aufk AS c
INTO TABLE itpo3
FOR ALL ENTRIES IN itpo2
WHERE cobjnr = itpo2-objnr ."AND COBJNR IN PO_NO.
SORT itpo3 BY aufnr objnr.
**********************************************************************
LOOP AT itpo3.
WRITE: / itpo3-aufnr,itpo3-objnr."ITPO3-BWART,ITPO3-MENGE,ITPO3-MEINS.
ENDLOOP.
**********************************************************************
Regards,
Siddarth
2009 Feb 10 8:06 AM