Capture last line item

I have a requirement where in i have to display a pop up with all the line items given by user in ME21N . The pop up has to display when user presses CHECK .
I written the code in the exit EXIT_SAPMM06E_017 . its working fine for single line item.
In case of multiple line items the popup appears for every line item instead of showing all the line items in a single pop up since in the user exit there is no provision of capturing the LAST LINE ITEM . The field EKKO-LPONR which captures the last line item , is populated only after the exit is triggered which captures the value of EKPO-EBELP( line-item). I manage to capture the line items in internal table but unable to capture last line item and then display the internal table in pop up .
If the user gives two line items say 10 , 20 .
Line item 10 is populated to field EKPO-EBELP . After the control comes out of the exit the value of EBELP is assigned to LPONR . At next control LPONR = 10 and EBELP = 20.
Thanks .

Hi Priya,
To show popup for the last line item, try with this logic:
You have an internal table with all line items, take an internal table with same structure. Take the number of lines and read the line iten into work area and append this work area into another table. after that read this second internal table with EBELN and EBELP, if it is matching then show the popup for all line items from first internal table.
Put this code:
<b>dsescribe int_first into ws_lines.
if ws_lines gt 0.
read table int_first into wa_first index ws_lines.
if sy-subrc eq 0.
  append wa_first to int_second.
endif.
endif.
if not int_second is initial.
read int_second into wa_first with key EBELN = 'structure ebeln value'
                                                        EBELP = 'structure ebelp value'
  if sy-subrc eq 0.
   " put POPUP code
  endif.
endif.</b>
Hope it will solve ur problem.

Similar Messages

  • Unable to capture the Line items row in BDC kindly help

    Hi All,
    I am trying to run the Tcode CJ40  here after i enter the project id and press enter a tabular form appears and we need to select the appropriate line item in that table .
    When i try to do teh recoding using SHDB tcode it is not capturing that line item at all :(.
    I tried to do the recordig usig the page down and tehn selecting teh line item in the table but still it doesnt capture in teh recording ,
    Kidnly suggest me what needs to be done.
    Thanks in Advance.
    Sana.

    Why dont you try with BAPI BAPI_BUS2054_CHANGE_MULTI
    Check the Documentation

  • Final total cannot appear when the last line item reached the page end

    Hi All,
    My report included 2 pages. Problem is the final total cannot appear when the last line item reached the page end. (page 2)
    final total will appear on the middle of last page (page 3) when i comment (type    = 'BOTTOM').
    Below is the program.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          device   = 'PRINTER'
          dialog   = 'X'
          form     = 'ZBOTM_VOUCHER'
          language = sy-langu.
      sort itab by vblnr.
      LOOP AT itab INTO wa_itab.
        move wa_itab-vblnr to reguh-vblnr.
        move wa_itab-lifnr to reguh-lifnr.
        move wa_itab-rbetr to reguh-rbetr.
        reguh-rbetr = reguh-rbetr * -1.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window  = 'MAIN'
            element = 'DETAIL'.
        t_rbetr = reguh-rbetr + t_rbetr.
        AT LAST.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              window = 'LINE'.
          CALL FUNCTION 'WRITE_FORM'
            EXPORTING
              element = 'TOTAL'.
              type    = 'BOTTOM'
              WINDOW  = 'MAIN'.
        ENDAT.
    Thanks.

    Hi,
    Where should I include the code for bottom?
    How to open text editor?
    Thanks.
    Edited by: Alice8 on Feb 7, 2011 9:09 AM

  • Only the last line item is shown in main window...

    Hello Experts,
    I created a custom form for the standard checque program RFFOUS_C. Now, in my MAIN window, I
    called a subroutine in a custom program which loops through the line items but the problem is
    only the last line item is being shown. I tried using CONTROL_FORM to create a new line
    but it does not work. Note that I did not customize RFFOUS_C since it is being used by
    multiple companies. Below is my code:
    SAPSCRIPT:
    510-C
    Begin of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    DEFINE &LTYC_XBLNR& = ''
    DEFINE &LTYC_BLDAT& = ''
    DEFINE &LTYC_SGTXT& = ''
    DEFINE &LTYC_DMBTR& = ''
    PERFORM WRITE_LINE_ITEMS IN PROGRAM Z9999RFI_Z2574FFI_RA
    USING &REGUH-LAUFD&
    USING &REGUH-LAUFI&
    USING &REGUH-XVORL&
    USING &REGUH-ZBUKR&
    USING &REGUH-LIFNR&
    USING &REGUH-VBLNR&
    CHANGING &LTYC_XBLNR&
    CHANGING &LTYC_BLDAT&
    CHANGING &LTYC_SGTXT&
    CHANGING &LTYC_DMBTR&
    ENDPERFORM
    PROTECT
         &LTYC_XBLNR&     &LTYC_BLDAT&     &LTYC_SGTXT&     &LTYC_DMBTR&
    ENDPROTECT
    End of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    PROGRAM:
    IF gt_regup[] IS NOT INITIAL.
        CALL FUNCTION 'OPEN_FORM'
           EXPORTING
    *         APPLICATION                       = 'TX'
    *         ARCHIVE_INDEX                     =
    *         ARCHIVE_PARAMS                    =
    *         DEVICE                            = 'PRINTER'
    *         DIALOG                            = 'X'
             form                              = lcc_z2574ffi_ra
    *         LANGUAGE                          = SY-LANGU
    *         OPTIONS                           =
    *         MAIL_SENDER                       =
    *         MAIL_RECIPIENT                    =
    *         MAIL_APPL_OBJECT                  =
    *         RAW_DATA_INTERFACE                = '*'
    *         SPONUMIV                          =
    *       IMPORTING
    *         LANGUAGE                          =
    *         NEW_ARCHIVE_PARAMS                =
    *         RESULT                            =
           EXCEPTIONS
             canceled                          = 1
             device                            = 2
             form                              = 3
             OPTIONS                           = 4
             unclosed                          = 5
             mail_options                      = 6
             archive_error                     = 7
             invalid_fax_number                = 8
             more_params_needed_in_batch       = 9
             spool_error                       = 10
             codepage                          = 11
             OTHERS                            = 12.
        IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        LOOP AT gt_regup INTO lw_regup.
          m_line_items 'LTYC_XBLNR' lw_regup-xblnr.
          m_line_items 'LTYC_BLDAT' lw_regup-bldat.
          m_line_items 'LTYC_SGTXT' lw_regup-sgtxt.
          m_line_items 'LTYC_DMBTR' lw_regup-dmbtr.
          DELETE ex_output WHERE value IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
           EXPORTING
             element                        = '510-C'
             function                       = 'APPEND'
    *         TYPE                           = 'BODY'
             window                         = 'MAIN'
    *       IMPORTING
    *         PENDING_LINES                  =
           EXCEPTIONS
             element                        = 1
             function                       = 2
             type                           = 3
             unopened                       = 4
             unstarted                      = 5
             window                         = 6
             bad_pageformat_for_print       = 7
             spool_error                    = 8
             codepage                       = 9
             OTHERS                         = 10.
          IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 2
              OTHERS    = 3.
          IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDLOOP.
        CALL FUNCTION 'CLOSE_FORM'
    *       IMPORTING
    *         RESULT                         =
    *         RDI_RESULT                     =
    *       TABLES
    *         OTFDATA                        =
           EXCEPTIONS
             unopened                       = 1
             bad_pageformat_for_print       = 2
             send_error                     = 3
             spool_error                    = 4
             codepage                       = 5
             OTHERS                         = 6.
        IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.

    Hi,
    Write the at last event in the program and check if it works
      At last.
           CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 2
              OTHERS    = 3.
          IF sy-subrc  0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Regards,
    Sravanthi

  • Printing in only last line item printing in main window

    Hi All,
    My requiremnet is to print same data in two blocks for F110 payment cheque
    Iam using 2 main windows to print same data if block exceeds it will go to next page
    iam calling the windows as shown below
    CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window   = 'MAIN00'
            element  = hlp_ep_element
            function = 'APPEND'
          EXCEPTIONS
            window   = 1
            element  = 2.
        IF sy-subrc EQ 2.
          err_element-fname = t042e-zforn.
          err_element-fenst = 'MAIN00'.
          err_element-elemt = hlp_ep_element.
          err_element-text  = text_525.
          COLLECT err_element.
        ENDIF.
        CALL FUNCTION 'WRITE_FORM'
          EXPORTING
            window   = 'MAIN01'
            element  = hlp_ep_element
            function = 'APPEND'
          EXCEPTIONS
            window   = 1
            element  = 2.
        IF sy-subrc EQ 2.
          err_element-fname = t042e-zforn.
          err_element-fenst = 'MAIN01'.
          err_element-elemt = hlp_ep_element.
          err_element-text  = text_525.
          COLLECT err_element.
        ENDIF.
    Iam getting only last line item printing in main window
    Please provide the inputs.
    Thanks,
    Kamalakar.
    Please use code tags.
    Edited by: Rob Burbank on Nov 25, 2011 11:51 AM

    Hi,
    My requirement was to print same block twice in cheque printing of F110.
    I have used the function module  'WRITE_FORM_LINES' to print more than one line item in secondary window in the script .
    fill the Lines internal table as shown below.
    Example :
        lines-tdformat = 'TM'.
        CONCATENATE regup-xblnr ',,' w_date ',,'  w_bsak-sgtxt ',,' w_gross ',,' w_dis ',,'
        w_net INTO lines-tdline.
    APPEND lines.
    CALL FUNCTION 'WRITE_FORM_LINES'
          EXPORTING
           function                       = 'APPEND'
           header                         =  header_t
           type                           = 'BODY'
           window                         = 'MAIN01'
        IMPORTING
          FROMPAGE                       =
          PENDING_LINES                  =
          TABLES
            lines                          = lines
         EXCEPTIONS
           function                       = 1
           type                           = 2
           unopened                       = 3
           unstarted                      = 4
           window                         = 5
           bad_pageformat_for_print       = 6
           spool_error                    = 7
           codepage                       = 8
           OTHERS                         = 9
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.

  • Select last line item from VBAP

    Dear SAP experts,
    This might sound very silly question but I am new to SAP world.
    is there a simple select statement to select only higest line item.
    Say for example in VBAP, I have 9 line items.
    then my select statement should find the last line item. ie. 9th item.
    Actually, I have a situation where a custom table has 2 key fields and I want to select the only 1 line with higest number in 2nr column. Thank you.
    Anitha.

    Hi,
    types: BEGIN OF ls_vbap,
             vbeln TYPE vbap-vbeln,
             posnr TYPE vbap-posnr,
           END OF ls_vbap.
    DATA : t_vbap TYPE STANDARD TABLE OF vbap WITH HEADER LINE,
           wa_vbap type ls_vbap.
    data: lv_line type int4.
    SELECT vbeln posnr FROM kna1 INTO TABLE t_vbap.
    *****If you just need the last record then write the code  as shown below:
    DESCRIBE TABLE t_vbap LINES lv_line.
    READ TABLE t_vbap INTO wa_vbap INDEX lv_line.
    if sy-subrc = 0.
    write:/ wa_vbap-vbeln.
    endif.
    If you the need the last record after sorting then use the below code:
    SORT t_vbap by vbeln posnr DESCENDING.
    READ TABLE t_vbap into wa_vbap index 1.
    if sy-subrc = 0.
    write:/ wa_vbap-vbeln.
    endif.

  • Fields only to be displayed for last line item

    I copied WESCHEINVERS3( goods receipt form) script to zxxxx and placed some fields  in Main window using Perform statement. When i am displaying the output these fields are getting displayed under each line item. but i want them to be displayed under last line item.Please suggest how can i do this.
    Thanks
    K Srinivas

    data: v_cnt1 type i, v_cnt2 type i.
    count the number line item using describe lines statement in V_cnt1
    and in the table loop count the number of item into V_cnt2.
    place the field that you want at the end of all line item in the footer of the table and put  a condition in the condition tab v_cnt1 = v_cnt2.

  • Smartforms: no page break between last line item and footer in table?

    Hello All,
    my smartform has FIRST and NEXT pages. I would like to avoid a page break between last item line of a table in MAIN window and the footer of the same table.
    Here is how it looks currently.
    Output of FIRST page, MAIN window, table ITEMS:
    1.line item
    2.line item
    3.line item
    4.line item
    page break
    output of NEXT page, MAIN window, table ITEMS:
    1.footer line
    2.footer line
    I would like that if a footer does not fit on FIRST page, it would be displayed on NEXT page with last item line.
    It should be like this:
    output of FIRST page, MAIN window, table ITEMS
    1.line item
    2.line item
    3.line item
    page break
    output of NEXT page, MAIN window, table ITEMS
    4.line item
    1.footer line
    2.footer line
    Any ideas?
    Thanks and best regards,
    Mindaugas

    Do you mean line item text or your want to print footer text?
    If your trying yo display some footer text, then you either place a footer window or you can create a table inside your main window and place text under the footer of the table, then it will display the text without any page break.
    If it is item tem.
    Then you need to build additional logic. As we cannot guess, the total number of item text upfront.
    Example: if page1 can hold 15 line items, check whether your header and item can fit in page one else call a new page by placing a condition FLAG = "X".
    I hope it will help you to solve your problem.
    Regards,
    SaiRam

  • Last line item gets changed to first line item for cs01

    HI experts,
               I have writen a BDC for Tcode cs01.
    I am facing a problem in that.If sucppose there are 4 line items,
    the first three line itmes are getting uploaded correctly but the kast line item gets changed to first line item.
    below is part of my code.
    DELETE ADJACENT DUPLICATES FROM T_MAT COMPARING MATNR.
    SORT T_MAT BY MATNR. "HEADER DATA
    SORT T_BOM BY MATNR1. "ITEM DATA
    *CLEAR : COUNTER, ITEM_NO.
    LOOP AT T_MAT INTO W_MAT.
      REFRESH GT_BDCDATA.
      CLEAR   GW_BDCDATA.
    perform bdc_dynpro      using 'SAPLCSDI' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29N-STLAN'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29N-MATNR' W_MAT-MATNR.
                                 'lejn44001'.
    perform bdc_field       using 'RC29N-WERKS' W_MAT-PLANT.
                                 '4600'.
    perform bdc_field       using 'RC29N-STLAN' W_MAT-BOM_USAGE.
                                 '1'.
    *perform bdc_field       using 'RC29N-DATUV'
                                 '22.06.2010'.
    perform bdc_dynpro      using 'SAPLCSDI' '0110'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RC29K-BMENG'
                                  '1'.
    perform bdc_field       using 'RC29K-STLST'
                                  '1'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-EXSTL'.
    perform bdc_dynpro      using 'SAPLCSDI' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29K-LABOR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    LOOP AT T_BOM INTO W_BOM WHERE MATNR1 = W_MAT-MATNR.
      cnt = cnt + 1.
      CONCATENATE  '0' CNT INTO VAR.
       ADD 1 TO COUNTER.
       ITEM_NO = 10 * COUNTER.
       OVERLAY ITEM_NO WITH '0000'.
       W_BOM-ITM_NO = ITEM_NO.
    perform bdc_dynpro      using 'SAPLCSDI' '0140'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSTP(03)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    CONCATENATE 'RC29P-IDNRK(' var ')' INTO new_mark.
    PERFORM bdc_field USING new_mark W_BOM-BOM_COMP.
    clear new_mark.
    CONCATENATE 'RC29P-MENGE(' var ')' INTO new_mark.
    PERFORM bdc_field USING new_mark W_BOM-QTY.
    clear new_mark.
    CONCATENATE 'RC29P-POSTP(' VAR ')' INTO NEW_MARK.
    perform bdc_field USING new_mark W_BOM-ITM_CAT.
    clear new_mark.
    clear VAR.
      ENDLOOP.
    loop at T_BOM INTO W_BOM WHERE MATNR1 = W_MAT-MATNR.
    perform bdc_dynpro      using 'SAPLCSDI' '0130'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POSNR'.
    perform bdc_field       using 'RC29P-POSNR' V_CNT.
                                 '0010'.
    perform bdc_field       using 'RC29P-IDNRK' W_BOM-BOM_COMP.
                                 'PURCHASECOST'.
    perform bdc_field       using 'RC29P-MENGE' W_BOM-QTY.
                                 '20'.
    perform bdc_field       using 'RC29P-MEINS'
                                  'M'.
    perform bdc_dynpro      using 'SAPLCSDI' '0131'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RC29P-POTX1'.
    perform bdc_field       using 'RC29P-SANKA'
                                  'X'.
    V_CNT = V_CNT + 10.
    ENDLOOP.
    CLEAR V_CNT.
      perform screen_data. " IS ALL ABOUT CALLING TRANSACTION......
      ENDLOOP.
    following is The input file format m providing.
    Material     Plant     BOM usage     Item No     Item Cat     BOM component     QUANTITY
    WRJN46106     4600     1     10     z     PURCHASECOST     10
    WRJN46106     4600     1     20     z     SOURCINGCOST     15
    WRJN46106     4600     1     30     z     INVRESERVE     12
    WRJN46106     4600     1     40     Z     INVRESERVE1     20
    in this the first 3 line items are coming correctly but the 4th one gets changed to
    first line item.
    e.g INVRESERVE1 changes to purchasecost.
    plz help.
    Thanks n regards,
    Ashmita singh.

    Hi Suneel,
    I hardly can't believe that. There must be an mistake by your own in the smartform itself. Would you please share some screens or better, the smartform-XML itself. You can pass out everything else and just share the table and a dataset to try this.
    I'm pretty sure that there is something wrong with the settings or even the loop itself. I never faced a problem like that or even heared about such things.
    I would love to have a look inside.
    Before you share it, create a new one with just the table inside and try it with the same data. Perhaps it is just of to much folders or something like that, so the generating comes in trouble.
    Regards
    Florian

  • Last Line Item in Report Repeating on Next Page

    The last line of data of every page is also the first line on the next page. I have not encountered this before and I cannot see how it is happening or how to correct it.
    The report has three groups and the 3rd group has 3 details lines. It is the 2nd detail line that repeats. The repeating line has not encountered a group change, nor has the 3rd detail line been triggered. It is a simple report that lists a line of data and prints it onto the report.
    The SQL is grouped by the same grouping of the report. Yes, data does repeat in the SQL, which would be expected for the  grouping. However, the data does not repeat in a group of the data returned by the SQL statement, so there is no reason for this data repetition.
    It is not restricted to any one piece of data in the report. The line that repeats is the last line on a page. Clicking on the next page of the report shows the last line of the previous page is the first line of the new page. This is true whether the report is viewed or printed.
    Does anybody have any suggestions?
    Thank you.

    I was able to resolve this. The detail section did not have the Keep Together checked. Once this was checked, the repeating line issue was resolved.

  • Strike Through between last line Item and footer

    Hi Experts,
    I have a requirement like this,
    I have dynamic table which displays items of invoice and Footer in the Master page.
    There will be dynamic space between Table and Footer when the lines items are not completely filled till the footer area. My requirement is to draw a cross line which begins at the end of the line( left most corner) and ends above the footer(right most corner)
    As if the diagonal line is drawn.
    Please let me know how to achieve the above functionality.
    Regards,
    Narayan

    Do you mean line item text or your want to print footer text?
    If your trying yo display some footer text, then you either place a footer window or you can create a table inside your main window and place text under the footer of the table, then it will display the text without any page break.
    If it is item tem.
    Then you need to build additional logic. As we cannot guess, the total number of item text upfront.
    Example: if page1 can hold 15 line items, check whether your header and item can fit in page one else call a new page by placing a condition FLAG = "X".
    I hope it will help you to solve your problem.
    Regards,
    SaiRam

  • Line item capture in Capex

    We have created a business rule in Capex for calculating the cost of asset based on Asset category and the system creates single line item everytime the business rule is run,
    the line is added thru Business Rule, I want to know if there is any way I can capture the line item number, that is being created by Business Rule,
    to calculate the dependant calculations dynamically.
    please suggest,
    Thanks in Advance.
    Sravan Kumar

    hi
    check out this MV50AFZ1

  • How to Update line items in a structure ?

    Hi i am getting 3 line items retrieved from a Function Module. But while displaying in the script it shows only the last line item. How do i update all the line items??
    The code is given below,
        CALL FUNCTION 'FI_PRINT_ZTERM'
             EXPORTING
                  I_ZTERM         = EKKO-ZTERM
                  I_LANGU         = EKKO-SPRAS
                  I_XT052U        = ' '
                  I_T052          = T052
             TABLES
                  T_ZTEXT         = ZBTXT
             EXCEPTIONS
                  ZTERM_NOT_FOUND = 01.
    Loop at ZBTXT.
        READ TABLE ZBTXT.
        IF SY-SUBRC EQ 0.
          PEKKO-ZBTXT = ZBTXT-LINE.
          DELETE ZBTXT INDEX 1.
    *      UPDATE PEKKO-ZBTXT.
        MOVE ZBTXT-LINE TO PEKKO-ZBTXT.
        ENDIF.
    ENDLOOP.
    And also how do i retrieve it in the script ?

    HI Navaneethan,
    please try following code.
    make  PEKKO should be internal table with appropraite structure..
    Loop at ZBTXT.
          MOVE ZBTXT-LINE TO PEKKO-ZBTXT.
          append  PEKKO.
         clear  PEKKO.
    ENDLOOP.
    loop at pekko.
    write : / PEKKO-zbtxt.
    endloop.
    if above code is helpful, REWARD POINTS.
    Regards,
    Ranjith

  • 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

    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 }

  • How to get First line item in Table control for BDC.

    Hi,
    I have a requirement while creating the return order from the reference Sales order for BOM.
    Once I compare the line items and delete the items not to be returned, I want to read the first line item which in fact is header, to make some changes.
    How to read  this as cursor points to the last line item.
    -B S B

    Hi Bsb,
    What is exactly unclear to you? =POPO will give a popup screen in which you can enter the order position number. This number will then be on the top of the table which means you can refer to it in BDC with "(01)".
    Regards,
    John.

Maybe you are looking for