Skip to Content
avatar image
Former Member

How to get the Delivery date in PO line Item in SAPScript

Hi Gurus,

I am working on PO Script (MEDRUCK). I copied the Standard to a Z form. ZMM_MEDRUCK, Now I need to print the the Header text at the end of MAIN window. I put Iem number along with the other line Item informmation like stanadrd PO Script MEDRUCK. I also want to show the delivey date with line Item, so Itried to use EKET-EINDT but it is returning the delivery date of last line item, means while printing the first line and other information it is showing the delivery date of the last line item, I tried with the PEKPO-EINDT it is also not working.

Can any body suggest me how i can get the delivery date for the respective line Item ?

Regards

Sony

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 13, 2009 at 11:32 AM

    actually your are picking up the correct data from Table EKET (EKET-EINDT) but your are printing that in item data loop for EKET might have already executed in your script and the header of that internal table consist the last entry of the table so for that. Fetch the delivery date explicite from the Table EKET when your in item level processing and print that.

    For Example u can use this code.

    To print you have write the this code in Script item level printing window "MAIN" window

    Following perform is called to get the line item delivery date in PO

    {/: PERFORM GET_DEL_DATE IN PROGRAM ZPerform_prog

    /: USING &EKPO-EBELN&

    /: USING &EKPO-EBELP&

    /: CHANGING &DEL_DATE&

    /: ENDPERFORM}

    {* Dellivery date &DEL_DATE& }

    write the below code in the Z program "ZPerform_prog"

    { FORM get_del_date TABLES in_par STRUCTURE itcsy

    out_par STRUCTURE itcsy.

    READ TABLE in_par WITH KEY 'EKPO-EBELN'.

    CHECK sy-subrc = 0.

    $_po_no = in_par-value.

    READ TABLE in_par WITH KEY 'EKPO-EBELP'.

    CHECK sy-subrc = 0.

    $_po_line = in_par-value.

    SELECT *

    FROM eket UP TO 1 ROWS WHERE ebeln EQ $_po_no AND ebelp EQ $_po_line.

    $_del_date = eket-eindt.

    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

    EXPORTING

    date_internal = eket-eindt

    IMPORTING

    date_external = $_del_date

    EXCEPTIONS

    date_internal_is_invalid = 1

    OTHERS = 2.

    READ TABLE out_par WITH KEY 'DEL_DATE'.

    CHECK sy-subrc EQ 0.

    out_par-value = $_del_date.

    MODIFY out_par

    INDEX sy-tabix.

    CLEAR : $_po_no , $_po_line ,$_del_date.

    ENDSELECT.

    ENDFORM. "GET_DEL_DATE }

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2009 at 10:20 AM

    Hi,

    use structure RM06P-LFDAT for Delivery date.

    Regards,

    Raju.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Raju

      Thanks. I tried but it does not work. Is there any other structure which i can use ??????

      Rgds

      Sony

  • avatar image
    Former Member
    Apr 13, 2009 at 11:52 AM

    Hi Sony,

    You can get the Expected Delivery Date from Table VBEP. There you can get the Field WADAT (Goods Issue Date) for any combination of VBELN and POSNR.

    For any item of any Sales Order the Highest Date (Latest Date) is the Expected Delivery Date.

    Hope this helps you,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2009 at 12:07 PM

    Hi,

    Can you check this?

    VBDPL-ABRDT----Delivery Schedule Date

    Regards

    Krishna

    Add comment
    10|10000 characters needed characters exceeded