Want to restrict redandend data and find therelevant workcenter

Hi friends
       i am developing the following report in pp
output is coming but same data comes in two times and also fetched the workcenter irrelavant.
pl give me a solutions
  SELECT F~MATNR F~AUFNR F~PSMNG G~XMNGA G~PERNR G~BUDAT G~GRUND G~VORNR  G~AUFPL  G~IEDD H~GRDTX INTO CORRESPONDING FIELDS OF TABLE IT_AFPO_IDEL
         FROM AFPO AS F
         INNER JOIN AFRU AS G ON F~AUFNR = G~AUFNR
         LEFT OUTER  JOIN TRUGT AS H ON G~GRUND = H~GRUND
         WHERE F~MATNR IN S_MATNR AND
               F~AUFNR IN S_AUFNR   AND
              G~ISDD IN S_ISDD AND
               G~IEDD IN S_IEDD AND
               G~WERKS IN S_WERKS AND
               G~XMNGA <> 0.
SELECT H~ARBPL H~OBJID I~AUFPL I~ARBID I~VORNR INTO CORRESPONDING FIELDS OF TABLE IT_CRHD_IDEL
                            FROM CRHD AS H
                            INNER JOIN V_QAPO AS I ON H~OBJID = I~ARBID
                            FOR ALL ENTRIES IN IT_AFPO_IDEL
                            WHERE VORNR = IT_AFPO_IDEL-VORNR .
IF SY-SUBRC = 0.
SELECT A~MATNR  B~MAKTX B~SPRAS C~MENGE D~STPRS E~NETPR
                 INTO CORRESPONDING FIELDS OF TABLE IT_MARA_IDEL
                 FROM MARA AS A
                 INNER JOIN MAKT AS B ON A~MATNR = B~MATNR
                 INNER JOIN MSEG AS C ON A~MATNR = C~MATNR
                 INNER JOIN MBEW AS D ON A~MATNR = D~MATNR
                 INNER JOIN EKPO AS E ON A~MATNR = E~MATNR
                 FOR ALL ENTRIES IN IT_AFPO_IDEL
                 WHERE A~MATNR = IT_AFPO_IDEL-MATNR AND B~SPRAS = 'E' AND A~MATKL IN S_MATKL.
     ENDIF.
DATA : PEDATE(10),
        POSDATE(10).
LOOP AT IT_AFPO_IDEL.
  CONCATENATE IT_AFPO_IDEL-IEDD6(2) IT_AFPO_IDEL-IEDD4(2) IT_AFPO_IDEL-IEDD+0(4)
    INTO PEDATE SEPARATED BY '.'.
IT_FINAL_IDEL-IEDD  = IT_AFPO_IDEL-IEDD.
  IT_FINAL_IDEL-IEDD = PEDATE.
   CONCATENATE IT_AFPO_IDEL-BUDAT6(2) IT_AFPO_IDEL-BUDAT4(2) IT_AFPO_IDEL-BUDAT+0(4)
    INTO POSDATE SEPARATED BY '.'.
  IT_FINAL_IDEL-BUDAT = POSDATE.
  IT_FINAL_IDEL-PERNR = IT_AFPO_IDEL-PERNR.
  IT_FINAL_IDEL-MATNR = IT_AFPO_IDEL-MATNR.
  IT_FINAL_IDEL-AUFNR = IT_AFPO_IDEL-AUFNR.
  IT_FINAL_IDEL-PSMNG = IT_AFPO_IDEL-PSMNG.
IT_FINAL_IDEL-PSAMG = IT_AFPO_IDEL-PSAMG.
IT_FINAL_IDEL-XMNGA = IT_AFPO_IDEL-XMNGA.
  IT_FINAL_IDEL-GRUND = IT_AFPO_IDEL-GRUND.
  IT_FINAL_IDEL-GRDTX = IT_AFPO_IDEL-GRDTX.
  READ TABLE IT_CRHD_IDEL WITH KEY AUFPL = IT_AFPO_IDEL-AUFPL.
READ TABLE IT_CRHD_IDEL WITH KEY VORNR = IT_AFPO_IDEL-VORNR.
IT_FINAL_IDEL-ARBPL = IT_CRHD_IDEL-ARBPL.
READ TABLE IT_MARA_IDEL WITH KEY MATNR = IT_AFPO_IDEL-MATNR.
IF SY-SUBRC = 0.
  IT_FINAL_IDEL-MAKTX = IT_MARA_IDEL-MAKTX.
IT_FINAL_IDEL-MENGE = IT_MARA_IDEL-MENGE.
  IT_FINAL_IDEL-STPRS = IT_MARA_IDEL-STPRS.
  IT_FINAL_IDEL-NETPR = IT_MARA_IDEL-NETPR.
  IT_FINAL_IDEL-TC    =  IT_AFPO_IDEL-XMNGA * IT_MARA_IDEL-STPRS.
ENDIF.
  APPEND IT_FINAL_IDEL.
  CLEAR : IT_FINAL_IDEL,IT_AFPO_IDEL,IT_MARA_IDEL,IT_CRHD_IDEL.
  ENDLOOP.
ENDFORM.

hi,
BADI you mentioned is not present in Definition view ie se18.
To implement BADI using se19 you need to check 1st wether it is present in definition view.
Once you find appropiate BADI you will have to write code in its interface method.
For this purpose you should be aware of ABAP OOPs concept.
Regards,
SUDHIR

Similar Messages

  • HT1382 how can I restore my back up files from my laptop? i want to see the dates and time that I backed up  my files. is it posssible?

    how can I restore my back up files from my laptop? i want to see the dates and time that I backed up  my files. is it posssible?

    What backed up files?
    Available backups for an iOS device can be found in Edit > Preferences > Devices.

  • Intel iMac running 10.5.8. Belonged to a relative who has passed away. I want to wipe all data and give the iMac to my grandson. I have no install discs. How do I proceed?

    Intel iMac running 10.5.8. Belonged to a relative who has passed away. I want to wipe all data and give the iMac to my grandson. I have no install discs. How do I proceed?

    Contact Apple (call AppleCare) and for a nominal fee the discs will be replaced.  You can do that or purchase Snow Leopard (still availble from Apple for $20) and do an erase and install of OS X making the machine like a new machine.

  • I have a 4s Iphone and want to add a date and time stamp to photos taken on the regular camera installed on the phone.  Does this require a separate app?

    I have a 4s iphone and want to date and time stamp photos taken with the regular camera installed on the phone.  Does this require a separate app?

    For such to be visible, yes. Many such apps in the app store.

  • Want to change Del Date and Goods Issue date in Delivery scdl tab of PO

    Hi Gurus,
    I am in a situation wherein i need to change the Goods Issue date in Delivery schedule tab of Purchase Order and make it equivalent to Delivery date in the same tab.
    Currently the Goods issue date that is taken by default will always be one day after the Delivery date.
    Where is the control for this???
    Regards,
    Trishul

    Hi Jürgen,
    Thanks for your response. You are right. The Process is STO.
    The delivery has not been created as yet.  Everything is happening while creating the PO. The settings are such that the delivery date will be taken by the system automatically by doing the Availability check and simultaneously the goods issue date will be updated. But it will be one day later to the delivery date. But i want this to be same.
    Incase if i change the Goods Issue date manually, this is the message i get "Goods issue cannot be carried out in the past"
    Message no. V1062
    Please let me know if i am not clear.
    Regards,
    Trishul
    Edited by: Trishul Das on Mar 17, 2009 4:09 PM

  • I want to load  uk data and us data ?

    Hi guru's,
    i have One infopackage, i want load uk data for 6.30am and us data for 6.30 pm same infopackage,
    if possible, can u give me the step by step.
    Thanks
    prabha reddy

    Hello Prabha,
    I recommend you to load it with two infopacks if this is applicable for you. By this way you can control scheduling options differently.
    Sarhan.

  • Want to Read BLOB data and display on Oracle form

    Hi All,
    I have a table with a BLOB field and there is blob data saved here against a account id.
    I want to display the blob data on the oracle forms front end for the queried account id
    Any one to help me out how to read and display blob data in Oracle and display the same
    Tks

    this is a commoon request please try to search the forum.

  • I have had my old iPhone 4S unlocked by my provider. I have given the phone to my husband and we want to erase my data and get him an Apple ID so he can put his data on the iPhone  will this lock the phone?

    I have had my iPhone 4S unlocked by my provider. I am successfully using a monthly plan and a new SIM card. I have given the iPhone to my husband. We would like to erase my data so my husband can add his and use the Cloud to back up his data. If we go through the erase process what is the safest way to do this so we don't re-lock the phone and disable the current SIM card?

    Hi
    If it was unlocked legitimately it will never relock. As you said you have sent this to your carrier to unlock this will always be unlocked however many times you restore the phone.
    Hope this helps

  • HT5569 i just got the 5s and im trying to connect to my home wifi since i dont want to use my data. and it wont let me i type in the correct password and it keeps telling me its unable to join it.

    why wont it let me connect

    Hi Logan,
    If you are having an issue connecting to your WiFi network, you may find the following article helpful:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/TS1398
    Regards,
    - Brenden

  • Regarding email notifications, I want to receive "Submitted Data" and Formatted Text... Is this possible?

    It seems as though I cannot receive formatted text, which is crucial to my form submissions making sense.

    Thank you so much, Ram!  I REALLY APPRECIATE YOUR HELP!
    I am wondering if it possible to manually create a node in RSA6 for the InfoSet.  I tried it by doing the following:
    I went to RSA6 and clicked on the white icon for "Create Node".  I then entered the number "8", followed  by the name of the InfoSet.  (I entered an "8", because all our DataSources seem to start with an "8".  I'm not sure why.) 
    The DataSource now shows up, but when I double-click on it, nothing happens.  When I select it in the hierarchy and then click the icons for "Display" or "Change" or "Check", I just get an error message that says, "You have not selected any DataSources."
    Also, do you know where I can get my hands on the white paper? 
    Thanks again!
    Regards,
    Sarah-Jane

  • My iphone4 is not accessable anymore a message came out in the screen saying to connect it to itunes and i did but itunes requested me to restore my iphone and update software. i dont want to restore my data

    Hi,
    I am not able to access my iphone4 due to some automatic updates happened in the device and now it asked me to connect it to itunes and itune asked me to restore my device, i dont want to restore my data and i want to update my iphone. please help me open my iphone again with your best and easy solutions.

    You need to restore.
    Everything should be on your computer, so you can just sync it back.
    iPod touch User Guide (For iOS 4.3 Software)

  • Query Help pls dates and logic.

    Hi all gurus
    I have a need where I need to put togahter series of timeline events that occurred in past as a one row concerning dates.
    This is my table .
      CREATE TABLE "SORS"."SOR_TRACKING"
       ( "TRACKING_ID" NUMBER NOT NULL ENABLE,
      "LETTER_ID" NUMBER NOT NULL ENABLE,
      "OFFENDER_ID" NUMBER NOT NULL ENABLE,
      "LOCATION_ID" NUMBER NOT NULL ENABLE,
      "OFFICE_ID" NUMBER,
      "MAIL_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
      "RESPONSE_DATE" DATE,
      "STATUS" VARCHAR2(30 BYTE) DEFAULT 'Mailed',
      "ENTRY_DATE" DATE DEFAULT SYSDATE NOT NULL ENABLE,
      "ENTRY_USER" VARCHAR2(30 BYTE) NOT NULL ENABLE,
      "COMMENTS" VARCHAR2(2000 BYTE),
      "FIRST_NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
      "MIDDLE_NAME" VARCHAR2(80 BYTE),
      "LAST_NAME" VARCHAR2(80 BYTE) NOT NULL ENABLE,
      "SIR_NAME" VARCHAR2(30 BYTE),
      "ADDRESS1" VARCHAR2(80 BYTE),
      "ADDRESS2" VARCHAR2(80 BYTE),
      "CITY" VARCHAR2(50 BYTE),
      "STATE" VARCHAR2(30 BYTE),
      "ZIP" VARCHAR2(20 BYTE),
      "COUNTY" VARCHAR2(80 BYTE),
      "OFFENDER_TYPE" VARCHAR2(30 BYTE),
      "LAST_MAIL_DATE" DATE,
      "BATCH_ID" NUMBER NOT NULL ENABLE,
      "JURISDICTION" NUMBER,
      "DL_NAME" VARCHAR2(60 BYTE),
      "DL_OFFICE" VARCHAR2(60 BYTE),
      "DL_ADDRESS" VARCHAR2(60 BYTE),
      "DL_MAILING_ADDRESS" VARCHAR2(60 BYTE),
      "DL_CITY" VARCHAR2(60 BYTE),
      "DL_STATE" VARCHAR2(30 BYTE),
      "DL_ZIP" VARCHAR2(20 BYTE),
      "TITLE" VARCHAR2(10 BYTE),
      "MODIFIED_USER" VARCHAR2(30 BYTE),
      "MODIFIED_DATE" DATE,
      CONSTRAINT "PK_SOR_TRACKING" PRIMARY KEY ("TRACKING_ID"))
    Sample date
    REM INSERTING into SOR_TRACKING
    SET DEFINE OFF;
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (781410,1,4557,110207,2809,to_date('05-NOV-13','DD-MON-RR'),null,'Mailed',to_date('05-NOV-13','DD-MON-RR'),'NEEL',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('15-FEB-12','DD-MON-RR'),30211,2809,null,null,null,null,null,null,null,'Ms.','NEEL',to_date('05-NOV-13','DD-MON-RR'));
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (190294,1,4557,110207,2809,to_date('08-FEB-12','DD-MON-RR'),to_date('15-FEB-12','DD-MON-RR'),'Verified',to_date('17-FEB-12','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('13-DEC-11','DD-MON-RR'),28442,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (184647,1,4557,110207,2809,to_date('05-DEC-11','DD-MON-RR'),to_date('13-DEC-11','DD-MON-RR'),'Verified',to_date('15-DEC-11','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'20535 Valleyview Rd ',null,'Boo','OK','74840','potter','STANDARD',to_date('09-NOV-11','DD-MON-RR'),27985,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (157253,1,4557,102288,2809,to_date('03-FEB-11','DD-MON-RR'),null,'Mailed',to_date('03-FEB-11','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('08-NOV-10','DD-MON-RR'),25613,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (149710,1,4557,102288,2809,to_date('01-NOV-10','DD-MON-RR'),to_date('08-NOV-10','DD-MON-RR'),'Verified',to_date('16-NOV-10','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('18-OCT-10','DD-MON-RR'),24939,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (138268,1,4557,99564,2809,to_date('03-JUN-10','DD-MON-RR'),to_date('17-JUN-10','DD-MON-RR'),'Letter Returned',to_date('17-JUN-10','DD-MON-RR'),'Boo','Post office: No mail receptacle','BOB','Jolene','Luna',null,'20535 Valley View Rd.',null,'Boo','OK','74840','potter','STANDARD',to_date('19-MAY-10','DD-MON-RR'),24216,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (128798,1,4557,91503,2809,to_date('04-FEB-10','DD-MON-RR'),null,'Mailed',to_date('04-FEB-10','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('10-NOV-09','DD-MON-RR'),23369,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (115073,1,4557,91503,2809,to_date('07-AUG-09','DD-MON-RR'),to_date('10-NOV-09','DD-MON-RR'),'Verified',to_date('10-NOV-09','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('06-MAY-09','DD-MON-RR'),21926,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (108510,1,4557,91503,2809,to_date('05-MAY-09','DD-MON-RR'),to_date('06-MAY-09','DD-MON-RR'),'Verified',to_date('07-MAY-09','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('01-MAY-09','DD-MON-RR'),21316,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (101463,1,4557,88052,2809,to_date('05-FEB-09','DD-MON-RR'),null,'Mailed',to_date('05-FEB-09','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('15-DEC-08','DD-MON-RR'),20525,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (97272,1,4557,88052,2809,to_date('05-DEC-08','DD-MON-RR'),to_date('15-DEC-08','DD-MON-RR'),'Verified',to_date('17-DEC-08','DD-MON-RR'),'Casper',null,'BOB','Jolene','Luna',null,'PO Box 146',null,'Boo','OK','74840','potter','STANDARD',to_date('12-NOV-08','DD-MON-RR'),20018,2809,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (68398,1,4557,76399,1070,to_date('10-OCT-07','DD-MON-RR'),to_date('15-NOV-07','DD-MON-RR'),'Letter Returned',to_date('15-NOV-07','DD-MON-RR'),'KERRYMIN','post office: not delivaerable as addressed ','BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('17-MAY-07','DD-MON-RR'),16596,1070,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (63767,1,4557,76399,1070,to_date('09-AUG-07','DD-MON-RR'),to_date('20-AUG-07','DD-MON-RR'),'Letter Returned',to_date('20-AUG-07','DD-MON-RR'),'KERRYMIN','post office: not deliverable as addressed ','BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('17-MAY-07','DD-MON-RR'),16077,1070,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (59499,1,4557,76399,1070,to_date('14-MAY-07','DD-MON-RR'),to_date('17-MAY-07','DD-MON-RR'),'Verified',to_date('17-MAY-07','DD-MON-RR'),'LAWANHAM',null,'BOB','Jolene','Luna',null,'752 Boo',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('14-MAY-07','DD-MON-RR'),15569,1070,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (54783,1,4557,74693,1070,to_date('01-MAR-07','DD-MON-RR'),to_date('06-MAR-07','DD-MON-RR'),'Verified',to_date('13-MAR-07','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'1203 Rebecca Lane',null,'Norman','OK','73072','Cleveland','STANDARD',to_date('01-MAR-07','DD-MON-RR'),14994,1070,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (34100,1,4557,58761,1094,to_date('08-FEB-06','DD-MON-RR'),null,'Mailed',to_date('31-MAR-06','DD-MON-RR'),'LAWANHAM','per M. Splawn','BOB','Jolene','Luna',null,'Rt. 1 Box 42',null,'Wewoka','OK','74884','Seminole','STANDARD',to_date('03-FEB-06','DD-MON-RR'),9560,1094,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (27562,1,4557,52781,1115,to_date('08-NOV-05','DD-MON-RR'),null,'Mailed',to_date('08-NOV-05','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'5590 Rebel Ridge Rd',null,'El Reno','OK','73036','Canadian','STANDARD',to_date('16-OCT-05','DD-MON-RR'),8034,1115,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (11822,1,4557,39238,1094,to_date('03-MAR-05','DD-MON-RR'),null,'Mailed',to_date('03-MAR-05','DD-MON-RR'),'Boo',null,'BOB','Jolene','Luna',null,'Rt. 1, Box 42',null,'Wewoka','OK','74884','Seminole','STANDARD',to_date('17-FEB-05','DD-MON-RR'),306,null,null,null,null,null,null,null,null,'Ms.',null,null);
    Insert into SOR_TRACKING (TRACKING_ID,LETTER_ID,OFFENDER_ID,LOCATION_ID,OFFICE_ID,MAIL_DATE,RESPONSE_DATE,STATUS,ENTRY_DATE,ENTRY_USER,COMMENTS,FIRST_NAME,MIDDLE_NAME,LAST_NAME,SIR_NAME,ADDRESS1,ADDRESS2,CITY,STATE,ZIP,COUNTY,OFFENDER_TYPE,LAST_MAIL_DATE,BATCH_ID,JURISDICTION,DL_NAME,DL_OFFICE,DL_ADDRESS,DL_MAILING_ADDRESS,DL_CITY,DL_STATE,DL_ZIP,TITLE,MODIFIED_USER,MODIFIED_DATE) values (2257,1,4557,18958,1087,to_date('03-AUG-04','DD-MON-RR'),null,'Mailed',to_date('29-JAN-05','DD-MON-RR'),'SYSTEM',null,'BOB','Jolene','Luna',null,'1037 Tabor Drive',null,'Oklahoma City','OK','73107','Oklahoma',null,null,178,null,null,null,null,null,null,null,null,null,null,null);
    I want to find the all the records whose mail date(earliest of all with no reply) and no response date and find the earlier one with reponse date and display it as a one row.
    For example 
    mail_Date+45 mail_Date in table    earliest date of reponse
    BEGIN_DATE   DEL_DATES           END_DATE                 TRACKING_ID
    17-SEP-04    03-AUG-04 06-          MAR-07                                2257
    Other date and their response date should be shown same way
    The issue is I am not able to retrieve other records in the tables because I am using MIN function.
    here is my query
    SELECT   t.MAIL_DATE + 45 begin_Date,
      del_date.del_dates,
      (SELECT MIN(st2.RESPONSE_DATE) Del_end_date
      FROM sor_tracking st2
      WHERE t.OFFENDER_ID   = st2.OFFENDER_ID
      AND st2.RESPONSE_DATE > del_date.del_dates
      ) End_date,
      t.OFFENDER_ID,
      t.TRACKING_ID
    FROM
      (SELECT MIN(st1.MAIL_DATE) del_dates
        FROM sor_tracking st1
      WHERE st1.OFFENDER_ID  = 4557
      AND st1.RESPONSE_DATE IS NULL
      AND st1.MAIL_DATE      < SysDate - 45
      AND st1.STATUS                  IN ('Letter Returned', 'Mailed')
      AND st1.LETTER_ID               IN (1, 4)
      ) del_date,
      sor_tracking t
    WHERE t.MAIL_DATE   <= del_date.del_dates
    AND (t.OFFENDER_ID   = 4557
         AND t.RESPONSE_DATE IS NULL)
    ORDER BY 1 desc
    Thanks for you time and help.

    with
    sor_tracking as
    (select 4557 offender_id,
            1 letter_id,
            to_date('05-NOV-13','dd-MON-yy') mail_date,
            781410 tracking_id,
            110207 location_id,
            null response_date,
            'Mailed' status
       from dual
    union all
    select 4557,1,to_date('08-FEB-12','dd-MON-yy'),190294,110207,to_date('15-FEB-12','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('05-DEC-11','dd-MON-yy'),184647,110207,to_date('13-DEC-11','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('03-FEB-11','dd-MON-yy'),157253,102288,null,'Mailed' from dual union all
    select 4557,1,to_date('01-NOV-10','dd-MON-yy'),149710,102288,to_date('08-NOV-10','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('03-JUN-10','dd-MON-yy'),138268,99564,to_date('17-JUN-10','dd-MON-yy'),'Letter Returned' from dual union all
    select 4557,1,to_date('04-FEB-10','dd-MON-yy'),128798,91503,null,'Mailed' from dual union all
    select 4557,1,to_date('07-AUG-09','dd-MON-yy'),115073,91503,to_date('10-NOV-09','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('05-MAY-09','dd-MON-yy'),108510,91503,to_date('06-MAY-09','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('05-FEB-09','dd-MON-yy'),101463,88052,null,'Mailed' from dual union all
    select 4557,1,to_date('05-DEC-08','dd-MON-yy'),97272,88052,to_date('15-DEC-08','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('10-OCT-07','dd-MON-yy'),68398,76399,to_date('15-NOV-07','dd-MON-yy'),'Letter Returned' from dual union all
    select 4557,1,to_date('09-AUG-07','dd-MON-yy'),63767,76399,to_date('20-AUG-07','dd-MON-yy'),'Letter Returned' from dual union all
    select 4557,1,to_date('14-MAY-07','dd-MON-yy'),59499,76399,to_date('17-MAY-07','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('01-MAR-07','dd-MON-yy'),54783,74693,to_date('06-MAR-07','dd-MON-yy'),'Verified' from dual union all
    select 4557,1,to_date('08-FEB-06','dd-MON-yy'),34100,58761,null,'Mailed' from dual union all
    select 4557,1,to_date('08-NOV-05','dd-MON-yy'),27562,52781,null,'Mailed' from dual union all
    select 4557,1,to_date('03-MAR-05','dd-MON-yy'),11822,39238,null,'Mailed' from dual union all
    select 4557,1,to_date('03-AUG-04','dd-MON-yy'),2257,18958,null,'Mailed' from dual
    select offender_id,
           letter_id,
           to_char(event_date,'dd-MON-yy') mail_date,
           tracking_id,
           location_id,
           case when last_response_verified is null
                then status
           end status,
           to_char(last_response_verified,'dd-MON-yy') response_date,
           case when last_response_verified is not null
                then 'Verified'
           end response_status
      from (select offender_id,
                   letter_id,
                   event_date,
                   tracking_id,
                   location_id,
                   status,
                   to_find,
                   verified_response,
                   last_value(verified_response ignore nulls) over (partition by offender_id,letter_id
                                                                        order by event_date desc
                                                                   ) last_response_verified
              from (select offender_id,
                           letter_id,
                           event_date,
                           tracking_id,
                           location_id,
                           status,
                           case when event_date < lead(event_date) over (partition by offender_id,letter_id,tracking_id
                                                                             order by event_date
                                                                        ) - 45
                                then 'THIS'
                                when status = 'Mailed'
                                 and lead(tracking_id) over (partition by offender_id,letter_id,tracking_id
                                                                 order by event_date
                                                            ) is null
                                 and direction != lag(direction,1,'null') over (partition by offender_id,letter_id
                                                                                    order by event_date
                                then 'this'
                           end to_find,
                           case when status = 'Verified'
                                then event_date
                           end verified_response
                      from (select offender_id,
                                   letter_id,
                                   mail_date event_date,
                                   tracking_id,
                                   location_id,
                                   'Mailed' status,
                                   'sent' direction
                              from sor_tracking
                            union all
                            select offender_id,
                                   letter_id,
                                   response_date,
                                   tracking_id,
                                   location_id,
                                   status,
                                   'rcvd' direction
                              from sor_tracking
                             where response_date is not null
    where to_find is not null
    order by event_date desc
    OFFENDER_ID
    LETTER_ID
    MAIL_DATE
    TRACKING_ID
    LOCATION_ID
    STATUS
    RESPONSE_DATE
    RESPONSE_STATUS
    4557
    1
    05-NOV-13
    781410
    110207
    Mailed
    4557
    1
    03-FEB-11
    157253
    102288
    13-DEC-11
    Verified
    4557
    1
    04-FEB-10
    128798
    91503
    08-NOV-10
    Verified
    4557
    1
    07-AUG-09
    115073
    91503
    10-NOV-09
    Verified
    4557
    1
    05-FEB-09
    101463
    88052
    06-MAY-09
    Verified
    4557
    1
    03-AUG-04
    2257
    18958
    06-MAR-07
    Verified
    Regards
    Etbin

  • How to restrict sales group and sales office in va01?

    in transaction "va01" ,I want to restrict "sales group" and "sales office", but there is no
    relative authorization object. I create a role named "z1000test001" with va01 , there are only "division","sales organization"
    and "distribution channel" which could be restricted.
    the authorization object with va01 is : V_VBAK_VKO.
    and I find another authorization:V_VBKA_VKO ,which contains:"sales group" and "sales office",
    but this one seems have no relationship with va01.
    Is there any method to restrict "sales group" and "sales office" in va01?
    Could anybody help me?

    Hello,
    This has been discussed before and there's a solution available.
    Have a look at this thread: Authorization for Sales Office and Sales Group
    Cheers
    Jurjen

  • How to display last data update date and time in report?

    Hai All,
               I want to report the date and time of the last upload in a report. How can I do this?
    I mean if I load the data today 5th April 2006 at 8.30 pm, then would i be able to show that on my report at the top of it(along with filer objects may be)?
    Thank you.

    Hi Visu,
    You will find detail info from help.sap
    check the links and they are  useful
    BEX Analyzer:
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/4e9d39d44cd45ee10000000a11402f/frameset.htm
    Web Application Designer
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/4e9d39d44cd45ee10000000a11402f/frameset.htm
    -Doodle
    Message was edited by: Doodle

  • How to write a routine in infopack to restrict a date range !!!!

    Hi
    I want to load the data for a speicific date range ,i.e , i want to load the data between created on some date range which is not in between the same range for changed on...so i want to restrict that date range for changed on....Please le tme know the routine logic to restrict a date range....
    regards...

    How to ... Write Infopackage selection Routine
    1.Create an Infopackage 2. Go to selections tab and choose Type: 6 u2013 ABAP Routine.You can see following available options(F4 Help).
    3. Give disruption, and hit enter, now you will move to following screen. 4. Write Code between begin of Routine and End of Routine.
    5. See below sample code to select date range from Previous 6 days to Current date.
    6. L_T_Range table is of Type structure RSSDLRANGE.
    a. RSSDLRANGE contains SIGN, OPTION, LOW, HIGH
    We need to populate these fields to pass range dynamically.
    Sample Code:
    ***$$ begin of routine - insert your code only below this line -
    Data: l_idx like sy-tabix.
    Data: date_low like sy-datum.
    Date_low = sy-datum u2013 6.u201D(To get 6 days back).
    read table l_t_range with key
    fieldname = 'CRDAT'.
    l_idx = sy-tabix.
    Pass Range values to L_T_Range Table.
    Move date_low to L_T_Range -Low.
    Move sy-datum to L_T_Range -High.
    L_T_Range -Sign = u2018Iu2019. *****(Here: I u2013 Include, E u2013 Exclude)
    L_T_Range -Option = u2018BTu2019.****( Here: BT u2013 Between )
    modify l_t_range index l_idx.
    p_subrc = 0.
    **$$ end of routine - insert your code only before this line -
    7. Syntax check and Save.
    Hope it Helps
    Srini

Maybe you are looking for