Each PO Line Item price should be as per the scale in contract?

Hi
I have a PO with 2 line items, both line items are for the same material.As I order 2 different quantities, I get 2 different prices, i.e. per line item. (As per the Scales Maintained in the contract)
However once I save the PO, and then display the PO, the price is taken for the total quantity. Is there any way that I can have 2 different prices for both materials in the same PO?
This behaviour has changed in the last 1 month only.
Earlier in our SAP system each line item had different price as the scale for the ordered quantity in that line item.
We though it could be due to Group Condition checked in the Condition Type, but that check has been in our system since long time, hence it cannot be the reason.
Thanks in Advance!

Yes... this is a standard behavior..
You can do one option...
When PO fetch the price from contract, then copy the price and enter it manually again, then PO can remember the price after save..
Check the similar discussion PO Price update issue

Similar Messages

  • Under each line item i should get an underline

    In my smartforms under each line item i should get an underline,how to do it.

    Hi,
    i think you just want underlines but not horizontal lines.
    If you want underline check the paragraph which was already used for that item, create another paragraph
    format as your old one and select the underline optine for your new paragraph format in the style and assign the
    same paragraph where you exactly required.
    if you want horizontal lines.
    1). Select the pattern any if suitable to your requirement.
    2). In the text node you can write contiouns '_'.
    3). In the text node output options check the frame check box and in the pattern select upper line or bottom line
         but in table or template you can't select the frame check box.
    Thanks,
    Phani.

  • Output the requested delivery date for each different line item

    Hello Experts
    I have program called ZFSFSF(following), in the output Its showing multiple requested delvery dates per line item.
    But We need to show the requested delivery date for each different line item.
    Any code is highly appreciated. I wud appreacite if you cud bold the added code.
    Thanks
    SP
    TYPE-POOLS: slis.
    TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1, bkpf, bsad, bkpf_bsad,
    knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    DATA: BEGIN OF i_list OCCURS 0,
    vbeln LIKE vbak-vbeln,
    posnr LIKE vbap-posnr,
    matnr LIKE vbap-matnr,
    erdat LIKE vbap-erdat,
    mvgr1 LIKE mvke-mvgr1,
    wadat_ist LIKE likp-wadat_ist,
    days TYPE i,
    werks LIKE vbap-werks,
    lgort LIKE vbap-lgort,
    kwmeng LIKE vbap-kwmeng," CH01+
    lfimg LIKE lips-lfimg," CH01+
    pstyv LIKE vbap-pstyv," CH01+
    obd LIKE lips-vbeln," CH01+
    obd_pos LIKE lips-posnr," CH01+
    soldto LIKE vbaK-kunnr," JR+
    shipto LIKE vbpa-kunnr," JR+
    edatu like vbep-edatu," PR+
    END OF i_list.
    DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    *ALV Output Header
    DATA: gt_list_top_of_page TYPE slis_t_listheader,
    prognm LIKE sy-repid,
    gc_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',
    gt_events TYPE slis_t_event,
    is_layout TYPE slis_layout_alv,
    is_variant LIKE disvariant,
    it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER LINE.
    DATA: g_repid LIKE sy-repid,
    g_count LIKE sy-tabix.
    SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t10.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t11.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(79) text-t12.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK block0.
    */ Selection and Input Parameters
    SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    s_matnr FOR vbap-matnr," obligatory,
    s_mvgr1 FOR mvke-mvgr1,
    s_erdat FOR vbap-erdat OBLIGATORY,
    s_werks FOR vbap-werks,
    s_lgort FOR vbap-lgort,
    s_edatu FOR vbep-edatu.
    PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    SELECTION-SCREEN SKIP 2.
    +EC1
    Addition +EC1
    +EC1
    PARAMETERS: p_vari LIKE disvariant-variant.
    +EC1
    End Addition +EC1
    +EC1
    SELECTION-SCREEN END OF BLOCK blocko.
    +EC1
    Addition +EC1
    +EC1
    DATA: g_save(1) TYPE c,
    g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant LIKE disvariant,
    g_variant LIKE disvariant.
    +EC1
    End Addition +EC1
    +EC1
    Initialization fieldcatalog
    INITIALIZATION.
    PERFORM clear_tables.
    g_repid = sy-repid.
    PERFORM fieldcat_init USING gt_fieldcat[].
    +EC1
    Addition +EC1
    +EC1
    g_save = 'A'.
    PERFORM variant_init.
    Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    AT SELECTION-SCREEN.
    PERFORM auth_check. "+ESC
    PERFORM pai_of_selection_screen.
    +EC1
    End Addition +EC1
    +EC1
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM alv.
    END-OF-SELECTION.
    FORM get_data *
    FORM get_data.
    *CH01 - Added kwmeng(order qty) to selection, excluded rejects
    *JR -added soldto and shipto code
    SELECT avbeln aposnr amatnr aerdat awerks algort
    akwmeng apstyv bkunnr cedatu
    CH01+
    INTO
    (i_list-vbeln, i_list-posnr, i_list-matnr, i_list-erdat, i_list-werks,
    i_list-lgort,
    i_list-kwmeng , i_list-pstyv, i_list-soldto,i_list-edatu)
    CH01+
    FROM vbap AS a INNER JOIN vbak AS b ON avbeln = bvbeln
    INNER JOIN vbep AS c ON avbeln = cvbeln
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    APPEND i_list.
    ENDSELECT.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    WHERE matnr = i_list-matnr.
    MODIFY i_list.
    CLEAR: i_list.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-mvgr1 IN s_mvgr1.
    CONTINUE.
    ELSE.
    DELETE i_list.
    COMMIT WORK AND WAIT.
    ENDIF.
    ENDLOOP.
    CH01 - commented these lines out and redid logic below
    LOOP AT i_list.
    select single vbeln into lips-vbeln from lips
    where vgbel = i_list-vbeln
    and vgpos = i_list-posnr.
    select single wadat_ist into i_list-wadat_ist from likp
    where vbeln = lips-vbeln.
    SELECT b~wadat_ist INTO i_list-wadat_ist
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr.
    MODIFY i_list.
    CLEAR: i_list, lips-vbeln.
    ENDSELECT.
    ENDLOOP.
    CH01 - Changed to select multiple delivery lines & del qty
    summing the total deliveries per OBD# and date
    LOOP AT i_list.
    SELECT avbeln sum( alfimg ) b~wadat_ist
    INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    FROM lips AS a INNER JOIN
    likp AS b ON avbeln = bvbeln WHERE a~vgbel = i_list-vbeln
    AND a~vgpos = i_list-posnr
    AND a~pstyv = i_list-pstyv
    group by avbeln bwadat_ist.
    i_list2 = i_list.
    APPEND i_list2.
    ENDSELECT.
    IF sy-subrc <> 0.
    i_list2 = i_list.
    APPEND i_list2.
    ENDIF.
    ENDLOOP.
    i_list[] = i_list2[].
    *End CH01
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-wadat_ist IS INITIAL.
    CONTINUE.
    ELSE.
    i_list-days = i_list-wadat_ist - i_list-erdat.
    ENDIF.
    MODIFY i_list.
    CLEAR: i_list.
    COMMIT WORK AND WAIT.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    LOOP AT i_list.
    IF i_list-vbeln IS INITIAL.
    DELETE i_list.
    ENDIF.
    ENDLOOP.
    COMMIT WORK AND WAIT.
    *JR
    LOOP AT i_list.
    SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    WHERE vbeln = i_list-vbeln
    AND parvw = 'WE'.
    MODIFY i_list.
    ENDLOOP.
    *END JR
    gt_outtab[] = i_list[].
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM alv *
    FORM alv.
    PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    PERFORM e04_comment_build USING gt_list_top_of_page[]. "+EC1
    prognm = sy-repid. "+EC1
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_user_command = 'USER_COMMAND'
    i_callback_program = g_repid
    it_fieldcat = gt_fieldcat[]
    it_events = gt_events[] "+ESC
    it_sort = it_sort[]
    +EC1
    Addition +EC1
    +EC1
    is_variant = g_variant
    i_save = g_save
    +EC1
    End Addition +EC1
    +EC1
    TABLES
    t_outtab = gt_outtab.
    COMMIT WORK AND WAIT.
    ENDFORM.
    FORM fieldcat_init *
    --> I_FIELDCAT *
    FORM fieldcat_init
    USING i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    DATA: pos TYPE i VALUE 1.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'VBELN'.
    ls_fieldcat-ref_tabname = 'VBAK'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'POSNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MATNR'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'MVGR1'.
    ls_fieldcat-ref_tabname = 'MVKE'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LGORT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'ERDAT'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'WADAT_IST'.
    ls_fieldcat-ref_tabname = 'LIKP'.
    ls_fieldcat-key = 'X'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'DAYS'.
    ls_fieldcat-ref_fieldname = 'DAYS'.
    ls_fieldcat-seltext_s = '# Of Days'.
    ls_fieldcat-seltext_m = '# Of Days'.
    ls_fieldcat-seltext_l = '# Of Days'.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *Begin CH01
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'KWMENG'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'LFIMG'.
    ls_fieldcat-ref_tabname = 'LIPS'.
    ls_fieldcat-outputlen = 7.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD'.
    ls_fieldcat-seltext_s = 'OBD'.
    ls_fieldcat-seltext_m = 'Outbound Del'.
    ls_fieldcat-seltext_l = 'Outbound Delivery'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'OBD_POS'.
    ls_fieldcat-seltext_s = 'OBD Ln'.
    ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    ls_fieldcat-seltext_l = 'Outbound Del Line'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *End CH01
    *JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SOLDTO'.
    ls_fieldcat-ref_tabname = 'VBAP'.
    ls_fieldcat-seltext_m = 'Sold To'.
    ls_fieldcat-seltext_l = 'Sold To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'SHIPTO'.
    ls_fieldcat-ref_tabname = 'VBPA'.
    ls_fieldcat-seltext_m = 'Ship To'.
    ls_fieldcat-seltext_l = 'Ship To'.
    ls_fieldcat-outputlen = 10.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *END JR
    ls_fieldcat-col_pos = pos.
    ls_fieldcat-fieldname = 'EDATU'.
    ls_fieldcat-ref_tabname = 'VBEP'.
    ls_fieldcat-seltext_m = 'Requested Delivery date'.
    ls_fieldcat-seltext_l = 'Requested Delivery date'.
    ls_fieldcat-outputlen = 20.
    APPEND ls_fieldcat TO i_fieldcat.
    CLEAR ls_fieldcat.
    *FOR ALV SORT & SUBTOTAL
    CLEAR it_sort.
    it_sort-spos = '0'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'POSNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '2'.
    it_sort-fieldname = 'MATNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '3'.
    it_sort-fieldname = 'MVGR1'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '4'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '5'.
    it_sort-fieldname = 'WADAT_IST'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-down = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '6'.
    it_sort-fieldname = 'PERNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '7'.
    it_sort-fieldname = 'VORNA'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '8'.
    it_sort-fieldname = 'NACHN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '9'.
    it_sort-fieldname = 'VKGRP'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '10'.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '11'.
    it_sort-fieldname = 'ERDAT'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    CLEAR it_sort.
    it_sort-spos = '12'.
    it_sort-fieldname = 'BEZEI'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    APPEND it_sort.
    clear it_sort.
    it_sort-spos = '1'.
    it_sort-fieldname = 'BELNR'.
    it_sort-tabname = 'GT_OUTTAB'.
    it_sort-up = 'X'.
    append it_sort.
    ENDFORM.
    +EC1
    Addition +EC1
    +EC1
    *& Form VARIANT_INIT
    text
    --> p1 text
    <-- p2 text
    FORM variant_init.
    CLEAR g_variant.
    g_variant-report = g_repid.
    ENDFORM. " VARIANT_INIT
    FORM f4_for_variant *
    FORM f4_for_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save = g_save
    it_default_fieldcat =
    IMPORTING
    e_exit = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    IF g_exit = space.
    p_vari = gx_variant-variant.
    ENDIF.
    ENDIF.
    ENDFORM.
    *& Form PAI_OF_SELECTION_SCREEN
    text
    FORM pai_of_selection_screen.
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM. " PAI_OF_SELECTION_SCREEN
    +EC1
    End Addition +EC1
    +EC1
    FORM e03_eventtab_build *
    --> E03_LT_EVENTS *
    FORM e03_eventtab_build USING e03_lt_events TYPE slis_t_event.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    i_list_type = 0
    IMPORTING
    et_events = e03_lt_events.
    READ TABLE e03_lt_events WITH KEY name = slis_ev_top_of_page
    INTO ls_event.
    IF sy-subrc = 0.
    MOVE gc_formname_top_of_page TO ls_event-form.
    APPEND ls_event TO e03_lt_events.
    ENDIF.
    ENDFORM.
    FORM e04_comment_build *
    --> E04_LT_TOP_OF_PAGE *
    FORM e04_comment_build USING e04_lt_top_of_page TYPE slis_t_listheader.
    DATA: ls_line TYPE slis_listheader.
    *Report Title
    CLEAR ls_line.
    ls_line-typ = 'H'.
    ls_line-info = text-007.
    APPEND ls_line TO e04_lt_top_of_page.
    **Doc Type Desc.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-008.
    ls_line-info = p_matnr.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-009.
    ls_line-info = p_werks.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-010.
    ls_line-info = p_stlan.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-011.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = text-012.
    ls_line-info = p_stlal.
    append ls_line to e04_lt_top_of_page.
    ENDFORM.
    FORM top_of_page *
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = gt_list_top_of_page.
    ENDFORM.
    FORM auth_check *
    FORM auth_check.
    AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    ID 'VKORG' FIELD p_vkorg.
    IF sy-subrc NE 0.
    MESSAGE e054 WITH p_vkorg.
    ENDIF.
    ENDFORM. " auth_check
    *& Form USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN '&IC1'.
    PERFORM display_so_order USING r_ucomm
    rs_selfield.
    ENDCASE.
    ENDFORM.
    *& Form display_sales_order
    text
    -->P_R_UCOMM text
    -->P_RS_SELFIELD text
    FORM display_so_order USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE rs_selfield-sel_tab_field.
    WHEN '1-VBELN'.
    SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    WHEN '1-MATNR'.
    SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    WHEN '1-OBD'.
    SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    WHEN OTHERS.
    MESSAGE i000(z1) WITH 'Please Click on the Valid Selection'.
    EXIT.
    ENDCASE.
    ENDFORM. " display_sales_order
    FORM EDit_table *

    > TYPE-POOLS: slis.
    >
    > TABLES: vbap, vbrk, vbfa, vbak, vbrp, konv, kna1,
    > bkpf, bsad, bkpf_bsad,
    > knvv, pa0002, t005u, mvke, lips, likp, vbpa, vbep.
    >
    > DATA: BEGIN OF i_list OCCURS 0,
    > vbeln LIKE vbak-vbeln,
    > posnr LIKE vbap-posnr,
    <b>  etenr like vbep-etenr,</b>
    > matnr LIKE vbap-matnr,
    > erdat LIKE vbap-erdat,
    > mvgr1 LIKE mvke-mvgr1,
    > wadat_ist LIKE likp-wadat_ist,
    > days TYPE i,
    > werks LIKE vbap-werks,
    > lgort LIKE vbap-lgort,
    > kwmeng LIKE vbap-kwmeng," CH01+
    > lfimg LIKE lips-lfimg," CH01+
    > pstyv LIKE vbap-pstyv," CH01+
    > obd LIKE lips-vbeln," CH01+
    > obd_pos LIKE lips-posnr," CH01+
    > soldto LIKE vbaK-kunnr," JR+
    > shipto LIKE vbpa-kunnr," JR+
    > edatu like vbep-edatu," PR+
    > END OF i_list.
    >
    > DATA: i_list2 LIKE i_list OCCURS 0 WITH HEADER LINE,
    > i_list3 LIKE i_list OCCURS 0 WITH HEADER LINE.
    >
    > DATA: i_list4 LIKE vbap OCCURS 0 WITH HEADER LINE.
    >
    >
    > *ALV Output Header
    > DATA: gt_list_top_of_page TYPE slis_t_listheader,
    > prognm LIKE sy-repid,
    > gc_formname_top_of_page TYPE slis_formname VALUE
    > 'TOP_OF_PAGE',
    > gt_events TYPE slis_t_event,
    > is_layout TYPE slis_layout_alv,
    > is_variant LIKE disvariant,
    > it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    >
    > DATA:gt_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA:gt_outtab LIKE i_list OCCURS 0 WITH HEADER
    > LINE.
    >
    > DATA: g_repid LIKE sy-repid,
    > g_count LIKE sy-tabix.
    >
    > SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME
    > TITLE text-t01.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t10.
    >
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t11.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN: BEGIN OF LINE.
    > SELECTION-SCREEN COMMENT 1(79) text-t12.
    > SELECTION-SCREEN: END OF LINE.
    >
    > SELECTION-SCREEN END OF BLOCK block0.
    >
    > */ Selection and Input Parameters
    > SELECTION-SCREEN BEGIN OF BLOCK blocko WITH FRAME
    > TITLE text-001.
    >
    >
    >
    > SELECT-OPTIONS: s_vbeln FOR vbap-vbeln, "SO
    > s_auart FOR vbak-auart DEFAULT 'KB' OBLIGATORY,
    > s_matnr FOR vbap-matnr," obligatory,
    > s_mvgr1 FOR mvke-mvgr1,
    > s_erdat FOR vbap-erdat OBLIGATORY,
    > s_werks FOR vbap-werks,
    > s_lgort FOR vbap-lgort,
    > s_edatu FOR vbep-edatu.
    >
    > PARAMETERS: p_vkorg LIKE vbak-vkorg DEFAULT '5010'.
    >
    >
    >
    > SELECTION-SCREEN SKIP 2.
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > PARAMETERS: p_vari LIKE disvariant-variant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > SELECTION-SCREEN END OF BLOCK blocko.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > DATA: g_save(1) TYPE c,
    > * g_default(1) TYPE c,
    > g_exit(1) TYPE c,
    > gx_variant LIKE disvariant,
    > g_variant LIKE disvariant.
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    > * Initialization fieldcatalog
    > INITIALIZATION.
    >
    > * PERFORM clear_tables.
    >
    > g_repid = sy-repid.
    > PERFORM fieldcat_init USING gt_fieldcat[].
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > g_save = 'A'.
    > PERFORM variant_init.
    > * Get default variant
    > gx_variant = g_variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 0.
    > p_vari = gx_variant-variant.
    > ENDIF.
    >
    > AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    > PERFORM f4_for_variant.
    >
    > AT SELECTION-SCREEN.
    > PERFORM auth_check. "+ESC
    > PERFORM pai_of_selection_screen.
    >
    >
    >
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > START-OF-SELECTION.
    >
    > PERFORM get_data.
    >
    > PERFORM alv.
    >
    > END-OF-SELECTION.
    >
    > *----
    > -
    > * FORM get_data *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM get_data.
    > *CH01 - Added kwmeng(order qty) to selection,
    > excluded rejects
    > *JR -added soldto and shipto code
    SELECT a~vbeln a~posnr a~matnr a~erdat a~werks a~lgort
    a~kwmeng a~pstyv b~kunnr c~edatu
    CH01+
    INTO corresponding fields of table i_list
    FROM vbap AS a INNER JOIN vbak AS b ON a~vbeln = b~vbeln
    INNER JOIN vbep AS c ON a~vbeln = c~vbeln
    and a~posnr = c~posnr
    WHERE b~vkorg = p_vkorg
    AND a~werks IN s_werks
    AND a~lgort IN s_lgort
    AND b~auart IN s_auart
    AND a~vbeln IN s_vbeln
    AND a~erdat IN s_erdat
    AND a~abgru = ''" CH01+
    AND a~matnr IN s_matnr
    AND c~edatu IN s_edatu.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > SELECT SINGLE mvgr1 INTO i_list-mvgr1 FROM mvke
    > WHERE matnr = i_list-matnr.
    > MODIFY i_list.
    > CLEAR: i_list.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-mvgr1 IN s_mvgr1.
    > CONTINUE.
    > ELSE.
    > DELETE i_list.
    > COMMIT WORK AND WAIT.
    > ENDIF.
    > ENDLOOP.
    > * CH01 - commented these lines out and redid logic
    > below
    > * LOOP AT i_list.
    > ** select single vbeln into lips-vbeln from lips
    > ** where vgbel = i_list-vbeln
    > ** and vgpos = i_list-posnr.
    > **
    > ** select single wadat_ist into i_list-wadat_ist from
    > likp
    > ** where vbeln = lips-vbeln.
    > *
    > * SELECT b~wadat_ist INTO i_list-wadat_ist
    > * FROM lips AS a INNER JOIN
    > * likp AS b ON a~vbeln = b~vbeln WHERE a~vgbel =
    > i_list-vbeln
    > * AND a~vgpos = i_list-posnr.
    > * MODIFY i_list.
    > * CLEAR: i_list, lips-vbeln.
    > * ENDSELECT.
    > * ENDLOOP.
    >
    > * CH01 - Changed to select multiple delivery lines &
    > del qty
    > * summing the total deliveries per OBD# and date
    > LOOP AT i_list.
    > SELECT avbeln sum( alfimg ) b~wadat_ist
    > INTO (i_list-obd , i_list-lfimg , i_list-wadat_ist)
    > FROM lips AS a INNER JOIN
    > likp AS b ON avbeln = bvbeln WHERE a~vgbel =
    > i_list-vbeln
    > AND a~vgpos = i_list-posnr
    > AND a~pstyv = i_list-pstyv
    > group by avbeln bwadat_ist.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDSELECT.
    > IF sy-subrc <> 0.
    > i_list2 = i_list.
    > APPEND i_list2.
    > ENDIF.
    > ENDLOOP.
    > i_list[] = i_list2[].
    > *End CH01
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-wadat_ist IS INITIAL.
    > CONTINUE.
    > ELSE.
    > i_list-days = i_list-wadat_ist - i_list-erdat.
    > ENDIF.
    > MODIFY i_list.
    > CLEAR: i_list.
    > COMMIT WORK AND WAIT.
    > ENDLOOP.
    >
    > COMMIT WORK AND WAIT.
    >
    > LOOP AT i_list.
    > IF i_list-vbeln IS INITIAL.
    > DELETE i_list.
    > ENDIF.
    > ENDLOOP.
    > COMMIT WORK AND WAIT.
    >
    > *JR
    > LOOP AT i_list.
    > SELECT SINGLE KUNNR INTO i_list-shipto FROM vbpa
    > WHERE vbeln = i_list-vbeln
    > AND parvw = 'WE'.
    > MODIFY i_list.
    > ENDLOOP.
    > *END JR
    >
    > gt_outtab[] = i_list[].
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM alv *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM alv.
    >
    > PERFORM e03_eventtab_build USING gt_events[]. "+EC1
    > PERFORM e04_comment_build USING
    > gt_list_top_of_page[]. "+EC1
    > prognm = sy-repid. "+EC1
    >
    >
    > CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    > EXPORTING
    > i_callback_user_command = 'USER_COMMAND'
    > i_callback_program = g_repid
    > it_fieldcat = gt_fieldcat[]
    > it_events = gt_events[] "+ESC
    > it_sort = it_sort[]
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > is_variant = g_variant
    > i_save = g_save
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    > TABLES
    > t_outtab = gt_outtab.
    >
    > COMMIT WORK AND WAIT.
    >
    >
    > ENDFORM.
    >
    >
    > *----
    > -
    > * FORM fieldcat_init *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> I_FIELDCAT *
    > *----
    > -
    > FORM fieldcat_init
    > USING i_fieldcat TYPE slis_t_fieldcat_alv.
    > DATA: ls_fieldcat TYPE slis_fieldcat_alv.
    > DATA: pos TYPE i VALUE 1.
    > CLEAR ls_fieldcat.
    <b>Please note to keep on incrementing pos variable for column position.</b>
    <b> pos = pos + 1.</b>
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'VBELN'.
    > ls_fieldcat-ref_tabname = 'VBAK'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    <b> pos = pos + 1.</b> ===> after every append to field catalog.
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'POSNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    <b>> ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ETERN'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.</b>
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MATNR'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'MVGR1'.
    > ls_fieldcat-ref_tabname = 'MVKE'.
    > ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WERKS'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LGORT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'ERDAT'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'WADAT_IST'.
    > ls_fieldcat-ref_tabname = 'LIKP'.
    > * ls_fieldcat-key = 'X'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'DAYS'.
    > ls_fieldcat-ref_fieldname = 'DAYS'.
    > ls_fieldcat-seltext_s = '# Of Days'.
    > ls_fieldcat-seltext_m = '# Of Days'.
    > ls_fieldcat-seltext_l = '# Of Days'.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > *Begin CH01
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'KWMENG'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'LFIMG'.
    > ls_fieldcat-ref_tabname = 'LIPS'.
    > ls_fieldcat-outputlen = 7.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'OBD'.
    > ls_fieldcat-seltext_s = 'OBD'.
    > ls_fieldcat-seltext_m = 'Outbound Del'.
    > ls_fieldcat-seltext_l = 'Outbound Delivery'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > * ls_fieldcat-col_pos = pos.
    > * ls_fieldcat-fieldname = 'OBD_POS'.
    > * ls_fieldcat-seltext_s = 'OBD Ln'.
    > * ls_fieldcat-seltext_m = 'Outbound Del Ln'.
    > * ls_fieldcat-seltext_l = 'Outbound Del Line'.
    > * ls_fieldcat-outputlen = 10.
    > * APPEND ls_fieldcat TO i_fieldcat.
    > * CLEAR ls_fieldcat.
    > *
    > *End CH01
    >
    > *JR
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SOLDTO'.
    > ls_fieldcat-ref_tabname = 'VBAP'.
    > ls_fieldcat-seltext_m = 'Sold To'.
    > ls_fieldcat-seltext_l = 'Sold To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'SHIPTO'.
    > ls_fieldcat-ref_tabname = 'VBPA'.
    > ls_fieldcat-seltext_m = 'Ship To'.
    > ls_fieldcat-seltext_l = 'Ship To'.
    > ls_fieldcat-outputlen = 10.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    > *END JR
    >
    > ls_fieldcat-col_pos = pos.
    > ls_fieldcat-fieldname = 'EDATU'.
    > ls_fieldcat-ref_tabname = 'VBEP'.
    > ls_fieldcat-seltext_m = 'Requested Delivery date'.
    > ls_fieldcat-seltext_l = 'Requested Delivery date'.
    > ls_fieldcat-outputlen = 20.
    > APPEND ls_fieldcat TO i_fieldcat.
    > CLEAR ls_fieldcat.
    >
    >
    > *FOR ALV SORT & SUBTOTAL
    > CLEAR it_sort.
    > it_sort-spos = '0'.
    > it_sort-fieldname = 'VBELN'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '1'.
    > it_sort-fieldname = 'POSNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > it_sort-subtot = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '2'.
    > it_sort-fieldname = 'MATNR'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > CLEAR it_sort.
    > it_sort-spos = '3'.
    > it_sort-fieldname = 'MVGR1'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    > *
    > CLEAR it_sort.
    > it_sort-spos = '4'.
    > it_sort-fieldname = 'ERDAT'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-up = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    >
    > CLEAR it_sort.
    > it_sort-spos = '5'.
    > it_sort-fieldname = 'WADAT_IST'.
    > it_sort-tabname = 'GT_OUTTAB'.
    > it_sort-down = 'X'.
    > * it_sort-subtot = 'X'.
    > APPEND it_sort.
    >
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '6'.
    > * it_sort-fieldname = 'PERNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '7'.
    > * it_sort-fieldname = 'VORNA'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '8'.
    > * it_sort-fieldname = 'NACHN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '9'.
    > * it_sort-fieldname = 'VKGRP'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '10'.
    > * it_sort-fieldname = 'VBELN'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '11'.
    > * it_sort-fieldname = 'ERDAT'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    > * CLEAR it_sort.
    > * it_sort-spos = '12'.
    > * it_sort-fieldname = 'BEZEI'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > ** it_sort-subtot = 'X'.
    > * APPEND it_sort.
    > *
    >
    > * clear it_sort.
    > * it_sort-spos = '1'.
    > * it_sort-fieldname = 'BELNR'.
    > * it_sort-tabname = 'GT_OUTTAB'.
    > * it_sort-up = 'X'.
    > * append it_sort.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    +EC1
    > * Addition +EC1
    > *----
    > -
    +EC1
    > *&----
    > -
    > *& Form VARIANT_INIT
    > *&----
    > -
    > * text
    > *----
    > -
    > * --> p1 text
    > * <-- p2 text
    > *----
    > -
    > FORM variant_init.
    > *
    > CLEAR g_variant.
    > g_variant-report = g_repid.
    > ENDFORM. " VARIANT_INIT
    >
    >
    >
    > *----
    > -
    > * FORM f4_for_variant *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM f4_for_variant.
    > *
    > CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    > EXPORTING
    > is_variant = g_variant
    > i_save = g_save
    > * it_default_fieldcat =
    > IMPORTING
    > e_exit = g_exit
    > es_variant = gx_variant
    > EXCEPTIONS
    > not_found = 2.
    > IF sy-subrc = 2.
    > MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
    > WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    > ELSE.
    > IF g_exit = space.
    > p_vari = gx_variant-variant.
    > ENDIF.
    > ENDIF.
    > ENDFORM.
    > *&----
    > -
    > *& Form PAI_OF_SELECTION_SCREEN
    > *&----
    > -
    > * text
    > *----
    > -
    > FORM pai_of_selection_screen.
    > *
    > IF NOT p_vari IS INITIAL.
    > MOVE g_variant TO gx_variant.
    > MOVE p_vari TO gx_variant-variant.
    > CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    > EXPORTING
    > i_save = g_save
    > CHANGING
    > cs_variant = gx_variant.
    > g_variant = gx_variant.
    > ELSE.
    > PERFORM variant_init.
    > ENDIF.
    > ENDFORM. " PAI_OF_SELECTION_SCREEN
    > *----
    > -
    +EC1
    > * End Addition +EC1
    > *----
    > -
    +EC1
    >
    >
    > *----
    > -
    > * FORM e03_eventtab_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E03_LT_EVENTS *
    > *----
    > -
    > FORM e03_eventtab_build USING e03_lt_events TYPE
    > slis_t_event.
    > DATA: ls_event TYPE slis_alv_event.
    >
    > CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    > EXPORTING
    > i_list_type = 0
    > IMPORTING
    > et_events = e03_lt_events.
    > READ TABLE e03_lt_events WITH KEY name =
    > slis_ev_top_of_page
    > INTO ls_event.
    > IF sy-subrc = 0.
    > MOVE gc_formname_top_of_page TO ls_event-form.
    > APPEND ls_event TO e03_lt_events.
    > ENDIF.
    > ENDFORM.
    >
    > *----
    > -
    > * FORM e04_comment_build *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > * --> E04_LT_TOP_OF_PAGE *
    > *----
    > -
    > FORM e04_comment_build USING e04_lt_top_of_page TYPE
    > slis_t_listheader.
    > DATA: ls_line TYPE slis_listheader.
    >
    > *Report Title
    > CLEAR ls_line.
    > ls_line-typ = 'H'.
    > ls_line-info = text-007.
    > APPEND ls_line TO e04_lt_top_of_page.
    > *
    > *
    > **Doc Type Desc.
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-008.
    > ** ls_line-info = p_matnr.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-009.
    > ** ls_line-info = p_werks.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-010.
    > ** ls_line-info = p_stlan.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-011.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    > *
    > * clear ls_line.
    > * ls_line-typ = 'S'.
    > * ls_line-key = text-012.
    > ** ls_line-info = p_stlal.
    > * append ls_line to e04_lt_top_of_page.
    >
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM top_of_page *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM top_of_page.
    >
    > CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    > EXPORTING
    > it_list_commentary = gt_list_top_of_page.
    >
    >
    > ENDFORM.
    >
    > *----
    > -
    > * FORM auth_check *
    > *----
    > -
    > * ........ *
    > *----
    > -
    > FORM auth_check.
    >
    > AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
    > ID 'VKORG' FIELD p_vkorg.
    > IF sy-subrc NE 0.
    > MESSAGE e054 WITH p_vkorg.
    > ENDIF.
    >
    >
    > ENDFORM. " auth_check
    >
    >
    > *&----
    > -
    > *& Form USER_COMMAND
    > *&----
    > -
    > FORM user_command USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE r_ucomm.
    > WHEN '&IC1'.
    > PERFORM display_so_order USING r_ucomm
    > rs_selfield.
    >
    > ENDCASE.
    >
    > ENDFORM.
    >
    > *&----
    > -
    > *& Form display_sales_order
    > *&----
    > -
    > * text
    > *----
    > -
    > * -->P_R_UCOMM text
    > * -->P_RS_SELFIELD text
    > *----
    > -
    > FORM display_so_order USING r_ucomm LIKE sy-ucomm
    > rs_selfield TYPE slis_selfield.
    >
    > CASE rs_selfield-sel_tab_field.
    > WHEN '1-VBELN'.
    > SET PARAMETER ID 'AUN' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    > WHEN '1-MATNR'.
    > SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
    > CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
    > WHEN '1-OBD'.
    > SET PARAMETER ID 'VL' FIELD rs_selfield-value.
    > CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    > WHEN OTHERS.
    > MESSAGE i000(z1) WITH 'Please Click on the Valid
    > Selection'.
    > EXIT.
    > ENDCASE.
    >
    >
    > ENDFORM. " display_sales_order
    >
    > *----
    > -
    > * FORM EDit_table *
    > *----
    > -
    > * ........ *
    > *----
    > -
    Message was edited by: Anurag Bankley

  • Cash Discount at header is not reducing line item price

    Hi Experts,
    While putting cash discount at header, it is not reducing price of the my total line item. I am having total line item price = 100 USD (10 USD * 10 Qty). I am entering 10 USD as cash discount at header. It is not reducing total line item price to 90. Also in my accounting document 10 USD (cash discount) is going to my tax account.
    Please advise.
    Regards,
    Kamal

    Hi,
    The cash discount case will only be applicable in connection with terms of payment.  You will have to define your customized discount condition type in M/06 and assign it to your PO pricing schema via M/08 transaction.  Make sure it shall not be set as 'Statistics' condition type.
    Cheers,
    HT

  • Sales Order line item Price after Discount

    Hi all
    How to get the line item price after discount in Sales Order Query?
    Kedalene

    Hi Kedalene,
    Please check below Query.
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardName], T1.[Dscription], T1.[Quantity], T1.[Price] as Price_After_Discount, T1.[PriceBefDi] As Price_Before_Discount,T1.[DiscPrcnt],  T1.[LineTotal] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
    Hope this help
    Regards:::::
    Atul Chakraborty

  • Approval template for line item price variation

    Any recommendation on how to managed price variations at a line item level with using approval templates? The approval templates currently only allow for TOTAL document differences.
    A senario as follows
    1.  Purchase order with line item price created
    2. GRNI created (and unit price changed)
    3. AP invoice created  - AP approval template kicks in advising that there is a price discrepancy at a line item level between the Base and target documents.

    Hi!
    You can achive this via Stored Procedure.
    Approval Procedure will not work for Row Level.

  • BTE 1650 LINE ITEM DISPLAY: Add to data per line - possible solution

    Hello,
    I would like to populate field payment order (Pymt.order) in custom transaction FBL5N
    I have read that it should be doable using BTE 1650 LINE ITEM DISPLAY: Add to data per line but I am not sure if 1650 is correct one and if its proper solution for this purpose.
    Could you please advice?
    Thank you in advance!
    Michal

    i have the same problem , i used BTE and the fields appear but without data . which table or code i will use to in FM to display data in transaction.
    thanks all for help

  • Line item Ship-to Info is not the same in Header Ship-to Party During Sales Order Creation via IDOC

    We have observed that during creation of sales order using idoc, the line item ship-to party is not the same with header ship-to. The ship-to party info in line item is equivalent to the header's sold to party. To give you a quick background, Sold to party info is given in idoc and ship to party is being determined using table EDPAR. In this specific scenario, sold to customer is not the same with ship to customer.
    Initial checking on the code leads us in function module VIEW_KUAGV. This FM populates partner details of sales order header and line item in program LVEDAF1Z
    Below is the code for Sales order Header. Notice that WE_INPUT parameter which contains Ship to party is passed as exporting parameter in FM VIEW_KUAGV. This is the reason why Ship to Party is populated correctly in sales order header but not in sales order item.
    Initially, it first set to Sold-To Party. However, if WE_INPUT is given or provided, partner details is set to Ship-To Party.
    Please advise on how we can make the ship to party info in header and line item be consistent. This is SAP Standard program which why we are hesitant to make change on the program. If there is a configuration to make this happen, kindly advise.
    Regards,
    Rommel

    Hi Jayesh,
    If I understand you correctly, you want that when creating SO from Quoatation
    the Ship to Party also follow/copy Ship to Party from Quotation, right?
    Just to confirm with you, when you creating SO reference from Quotation, you
    use copy/follow-up function, am I right?
    You can do this by setting in configuration of Copy Control (like mentioned by Hui).
    Step as follow :
    1. Go to IMG->CRM->Transactions->Basic Settings->Copying Control for
        Business Transactions
    2. Create your BAdi (Business Add-In for Copying Control), such as get Ship to
        Party value from source document and use it in current document
    3. Use this Rule you have created in BAdi (no. 2), in copy control transaction type
        IMG->CRM->Transactions->Basic Settings->Copying Control for
        Business Transactions-> Define Copying Control for Transaction Types
    4. Here you set Copying Routine for your transaction types (put name of your Badi
        created in step no. 2)
    Or alternatively, you can set it on access sequence in Partner Function
    Ship to Party in configuration. You can define access sequence the Ship
    to Party is taken from Preceeding Document -> Ship To Party
    1. Go to Partner Function access sequence :
        IMG->CRM->Basic Functions->Partner Processing->Define Access Sequence
    2. Create new access sequence with following entry :
        - Source COM_PARTNER_A (PrecedingPartner)
        - Check Mapping for Partner Being search
        - Partner Function in Source  = Ship To Party
    3. Assign this Access Sequence in you Partner Function used in Sales Order Transaction
       Type.
    Tell me if this is what you looking for
    Gun.

  • How do I grey a bubble on a line item that I don't want the user to be able to input, but leave the others active in a form?

    How do I grey a bubble on a line item that I don't want the user to be able to input, but leave the others active in a form?

    I may be missing something here, but can't you just set the item to "Read Only" in the general preferences for that item?

  • PR Line Item Number should be Same for PO Line Item Numebr

    Hi Gurus,
    I have a rare Requiremenet. I will convert Only one PR to PO(So It is one to one) PR Item Number should Be Equal to PO Item Number.. can anybody suggest me is there any way to achive this.
    Explanation:
    Actually we will create third party Sale order and with A BAPI we  create PO in background.
    I will change Sales Order qty(Decrease directly or increse with schedule lines) so new PR items will be generated or Existing may be deleted. now i want my PR Item number should be equal to PO Item Number.
    In BAPI we have a provision to provide PR number still system is taking in sequential intervel of 10,20,30....
    How to overide this...
    EX:
                     PR               PO
    ItemNO      10              10
    ItemNO      30              30
    Thanks
    Pradeep

    Hi Monika,
    Thanks a lot my issue got resolved. annd i have another question regarding BAPI_PO_Change.
    Actually i am passing Price from PR to PO and i am making no_price_from_po while chenging PO and i am passing PRICE from SO to PO. Below scenario will explain My requirement.
    In third party we are creating Automatic PO from SO. we have developed one ZTrasaction for SO Approval in two stages, in second level Approval we are converting PR to PO.
    while creating we are able to pass Price value from SO to PO From Condition in the Pricing procedure.
    while changing we have 3 scenarios
    1.Changing Existing PR Item quantity
    2. Adding one more schedule line to the Existing SO so it will create one more PR Item
    3. we are adding one more Line Item in the SO in this case also one more PR Item will be generated
    we are able to convert each PR Item will be one PO line Item 
    But while changing we will have PO still we don't want to copy the Price from Previous Document.
    we have activated no_price_from_PO in the BAPI but still system is taking from previous Document.
    Pl suggest me if there anyway to over come this issue...
    Thanks
    -Pradeep

  • Modifying line item price in Purchase Order

    Hi guys,
    Need your help regarding pricing modification in purchase order.  I know the below explanation is quite long enough, but still if you can look into it and put some thoughts:
    The price picked for a line item from PIR, needs to be modified depending on total price.
    Say for example, in a PO there are two line items
    Mat1     10PC 10 usd/1pc
    Mat2     10PC 20 usd/1pc
    so total price for PO goes as 300 usd.
    Now, if PO price exceeds 250 usd a different price needs to be picked from a custom table for line items. Say it should now become 8 usd/1PC and 18 usd/1PC for Mat1 and Mat2 respectively.
    So, after entering PO items if the user presses the 'check' button, new price should be picked, as per the above example the new lines should be shown as
    Mat1     10PC 8 USD/1PC
    Mat2     10PC 18 USD/1PC
    so total price for PO goes as 260 USD.
    Hope I've made you clear about the requirement.
    Now, what we are able to do so far is:
    We have used the 'check' method BADI 'me_process_po_cust'. And we are calculating the total price and changing the item conditions.
    But it's not reflecting on the me21n screen even after execution of the 'check' method successfully.
    It still shows the line items as
    Mat1     10PC 10 USD/1PC
    Mat2     10PC 20 USD/1PC
    But, now if we make any changes in the line items (say we add the requisitioner name) and hit ENTER the changed prices are reflected. And the items become
    Mat1     10PC 8 USD/1PC
    Mat2     10PC 18U SD/1PC
    This is a thing we are stuck into.
    Please express if you have any idea how to come out of this issue.
    Thanks in advance.
    Anupam

    Hi Anupam,
    Flow Logic of the screen.
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
      LOOP AT ITAB WITH CONTROL TABC.
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT ITAB.
        MODULE READ_TABLE_CONTROL.
      ENDLOOP.
    Write the read_table_control module like below
    MODULE read_table_control INPUT.
       MODIFY itab INDEX tabc-current_line.
       "The above will update the entered data on table control
    ENDMODULE.
    Kindly check if this table control gets updated in PAI or not.... if not... try to find an exit where  this can be done on PAI.....
    Regards,
    Deeba

  • XML shows multiple po distributions account for each po line item

    Hi, We have custome RDF created for Purchase Order Detail Report. Per the PO summary report, PO nubmer 30367 has two lines and each on has single distributions. Each line has different distributions. Line 1distribution account: 01.000.105.65020.00000.00 and Line 2 distribution account: 01.000.000.15020.00000.00. However when I run the XML for PO summary report, each line items contains the two account distributions. How do you make it sho it only show the account distribution pertain to the each line?
    **Please see xml below.**
    - <LIST_G_COMPANY>
    - <G_COMPANY>
    <C_COMPANY>CTI US Ledger</C_COMPANY>
    <C_ORGANIZATION_ID>83</C_ORGANIZATION_ID>
    <GL_CURRENCY>USD</GL_CURRENCY>
    <STRUCTURE_ACC>101</STRUCTURE_ACC>
    <STRUCTURE_CAT>101</STRUCTURE_CAT>
    <C_YES>Yes</C_YES>
    <C_NO>No</C_NO>
    <C_CATEGORY_SET_ID>1</C_CATEGORY_SET_ID>
    <BUSINESS_GROUP_ID>0</BUSINESS_GROUP_ID>
    - <LIST_G_HEADERS>
    - <G_HEADERS>
    <POH_REMARKS />
    <CREATION_DATE>01-SEP-10</CREATION_DATE>
    <STATUS>Approved</STATUS>
    <REV>0</REV>
    <PRINTED_DATE />
    <TYPE>Standard Purchase Order</TYPE>
    <BUYER>BUNTING, DOUGLAS</BUYER>
    <C_CURRENCY>USD</C_CURRENCY>
    <VENDOR>Softchoice Corporation</VENDOR>
    <ACCEPTANCE_DATE />
    <ON_HOLD />
    <VENDOR_SITE>SOFTCHOICE - PO</VENDOR_SITE>
    <ACCEPTANCE_REQUIRED>No</ACCEPTANCE_REQUIRED>
    <C_AMOUNT_AGR>2500</C_AMOUNT_AGR>
    <PO_HEADER_ID1>2790</PO_HEADER_ID1>
    <REVISED_DATE />
    <PO_NUMBER>30367</PO_NUMBER>
    <C_FND_PRECISION>2</C_FND_PRECISION>
    - <LIST_G_BREAK_LINES>
    - <G_BREAK_LINES>
    <LINE>1</LINE>
    <LINE_TYPE>GOODS</LINE_TYPE>
    <REV1 />
    <ITEM_DESCRIPTION>Test</ITEM_DESCRIPTION>
    <UNIT>EACH</UNIT>
    <PO_HEADER_ID>2790</PO_HEADER_ID>
    <UNIT_PRICE>500</UNIT_PRICE>
    - <LIST_G_SHIPMENTS>
    - <G_SHIPMENTS>
    <CLOSED_CODE />
    <LINE_CLOSED>N</LINE_CLOSED>
    <LINE_CANCEL>N</LINE_CANCEL>
    <NOTE_TO_VENDOR />
    <NEED_BY_DATE />
    <PROMISED_DATE />
    <SHIP_TO_LOCATION>CELL THERAPEUTICS INC</SHIP_TO_LOCATION>
    <QUANTITY_AMOUNT_ORDERED>1</QUANTITY_AMOUNT_ORDERED>
    <QUANTITY_AMOUNT_RECEIVED>0</QUANTITY_AMOUNT_RECEIVED>
    <QUANTITY_AMOUNT_CANCELLED>0</QUANTITY_AMOUNT_CANCELLED>
    <QUANTITY_AMOUNT_DUE>1</QUANTITY_AMOUNT_DUE>
    <QUANTITY_AMOUNT_BILLED>0</QUANTITY_AMOUNT_BILLED>
    <C_FLEX_CAT>COMPUTER SUPPLIES</C_FLEX_CAT>
    <C_FLEX_ITEM />
    </G_SHIPMENTS>
    </LIST_G_SHIPMENTS>
    - <LIST_G_CONCAT_SEGMENTS>
    - <G_CONCAT_SEGMENTS>
    <DELIVER_TO_PERSON_NAME>DOUGLAS BUNTING</DELIVER_TO_PERSON_NAME>
    <PO_HEADER_ID2>2790</PO_HEADER_ID2>
    <CONCAT_SEGMENTS>01.000.000.15020.00000.00</CONCAT_SEGMENTS>
    <PLL_LOCATION_ID>3053</PLL_LOCATION_ID>
    </G_CONCAT_SEGMENTS>
    - <G_CONCAT_SEGMENTS>
    <DELIVER_TO_PERSON_NAME>DOUGLAS BUNTING</DELIVER_TO_PERSON_NAME>
    <PO_HEADER_ID2>2790</PO_HEADER_ID2>
    <CONCAT_SEGMENTS>01.000.105.65020.00000.00</CONCAT_SEGMENTS>
    <PLL_LOCATION_ID>3052</PLL_LOCATION_ID>
    </G_CONCAT_SEGMENTS>
    </LIST_G_CONCAT_SEGMENTS>
    <C_FLEX_CAT_DISP>COMPUTER.SUPPLIES.</C_FLEX_CAT_DISP>
    <C_FLEX_ITEM_DISP />
    </G_BREAK_LINES>
    - <G_BREAK_LINES>
    <LINE>2</LINE>
    <LINE_TYPE>GOODS</LINE_TYPE>
    <REV1 />
    <ITEM_DESCRIPTION>test</ITEM_DESCRIPTION>
    <UNIT>EACH</UNIT>
    <PO_HEADER_ID>2790</PO_HEADER_ID>
    <UNIT_PRICE>1000</UNIT_PRICE>
    - <LIST_G_SHIPMENTS>
    - <G_SHIPMENTS>
    <CLOSED_CODE />
    <LINE_CLOSED>N</LINE_CLOSED>
    <LINE_CANCEL>N</LINE_CANCEL>
    <NOTE_TO_VENDOR />
    <NEED_BY_DATE />
    <PROMISED_DATE />
    <SHIP_TO_LOCATION>CELL THERAPEUTICS INC</SHIP_TO_LOCATION>
    <QUANTITY_AMOUNT_ORDERED>2</QUANTITY_AMOUNT_ORDERED>
    <QUANTITY_AMOUNT_RECEIVED>0</QUANTITY_AMOUNT_RECEIVED>
    <QUANTITY_AMOUNT_CANCELLED>0</QUANTITY_AMOUNT_CANCELLED>
    <QUANTITY_AMOUNT_DUE>2</QUANTITY_AMOUNT_DUE>
    <QUANTITY_AMOUNT_BILLED>0</QUANTITY_AMOUNT_BILLED>
    <C_FLEX_CAT>COMPUTER SUPPLIES</C_FLEX_CAT>
    <C_FLEX_ITEM />
    </G_SHIPMENTS>
    </LIST_G_SHIPMENTS>
    - <LIST_G_CONCAT_SEGMENTS>
    - <G_CONCAT_SEGMENTS>
    <DELIVER_TO_PERSON_NAME>DOUGLAS BUNTING</DELIVER_TO_PERSON_NAME>
    <PO_HEADER_ID2>2790</PO_HEADER_ID2>
    <CONCAT_SEGMENTS>01.000.000.15020.00000.00</CONCAT_SEGMENTS>
    <PLL_LOCATION_ID>3053</PLL_LOCATION_ID>
    </G_CONCAT_SEGMENTS>
    - <G_CONCAT_SEGMENTS>
    <DELIVER_TO_PERSON_NAME>DOUGLAS BUNTING</DELIVER_TO_PERSON_NAME>
    <PO_HEADER_ID2>2790</PO_HEADER_ID2>
    <CONCAT_SEGMENTS>01.000.105.65020.00000.00</CONCAT_SEGMENTS>
    <PLL_LOCATION_ID>3052</PLL_LOCATION_ID>
    </G_CONCAT_SEGMENTS>
    </LIST_G_CONCAT_SEGMENTS>
    <C_FLEX_CAT_DISP>COMPUTER.SUPPLIES.</C_FLEX_CAT_DISP>
    <C_FLEX_ITEM_DISP />
    </G_BREAK_LINES>
    </LIST_G_BREAK_LINES>
    <C_AMOUNT_AGR_ROUND>2500</C_AMOUNT_AGR_ROUND>
    <C_AMOUNT_AGR_DISP>2,500.00</C_AMOUNT_AGR_DISP>
    </G_HEADERS>
    </LIST_G_HEADERS>
    </G_COMPANY>
    </LIST_G_COMPANY>
    <XCOMPANY_NAME>CTI US Ledger</XCOMPANY_NAME>
    <YES>Yes</YES>
    <NO>No</NO>
    <ORG_ID>83</ORG_ID>
    <CAT_ID>1</CAT_ID>
    <COUNT_RECORDS>1</COUNT_RECORDS>
    </XXCTI_POXPOSTD_1>
    **Here is the Query for the RDF file...**
    SELECT pol.line_num Line
    , pol.closed_flag Line_Closed
    , pol.cancel_flag Line_Cancel
    , pol.closed_code
    , plt.line_type Line_Type
    , &P_FLEX_CAT C_FLEX_CAT
    , &P_FLEX_ITEM C_FLEX_ITEM
    , pol.item_revision Rev
    , pol.item_description Item_Description
    , pol.unit_meas_lookup_code Unit
    , pol.note_to_vendor Note_to_Vendor
    /* Bug: 141118 Take unit price from PO_LINES if there is no shipment */
    , to_number(decode(plt.order_type_lookup_code,
    'AMOUNT',null,
    nvl(pll.price_override,pol.unit_price))) Unit_Price
    , hrl.location_code Ship_To_Location
    , pll.promised_date Promised_Date
    , pll.need_by_date Need_By_Date
    , ROUND (DECODE (PLT.order_type_lookup_code, /* <SERVICES FPJ> */
    'RATE', NVL(PLL.amount, POL.amount),
    'FIXED PRICE', NVL(PLL.amount, POL.amount),
    NVL(PLL.quantity, POL.quantity)), :p_qty_precision) Quantity_Amount_Ordered
    , ROUND (DECODE (PLT.order_type_lookup_code, /* <SERVICES FPJ> */
    'RATE', NVL(PLL.amount_received, 0),
    'FIXED PRICE', NVL(PLL.amount_received, 0),
    NVL(PLL.quantity_received, 0)), :p_qty_precision) Quantity_Amount_Received
    , ROUND (DECODE (PLT.order_type_lookup_code, /* <SERVICES FPJ> */
    'RATE', NVL(PLL.amount_cancelled, 0),
    'FIXED PRICE', NVL(PLL.amount_cancelled, 0),
    NVL(PLL.quantity_cancelled, 0)), :p_qty_precision) Quantity_Amount_Cancelled
    , ROUND (DECODE (PLT.order_type_lookup_code, /* <SERVICES FPJ> */
    'RATE', NVL(PLL.amount, POL.amount) - NVL(PLL.amount_cancelled, 0)
    - NVL(PLL.amount_received, 0),
    'FIXED PRICE', NVL(PLL.amount, POL.amount) - NVL(PLL.amount_cancelled, 0)
    - NVL(PLL.amount_received, 0),
    NVL (PLL.quantity, POL.quantity) - NVL(PLL.quantity_cancelled, 0) - NVL(PLL.quantity_received, 0)),
    :p_qty_precision) Quantity_Amount_Due
    , ROUND (DECODE (PLT.order_type_lookup_code, /* <SERVICES FPJ> */
    'RATE', NVL(PLL.amount_billed, 0),
    'FIXED PRICE', NVL(PLL.amount_billed, 0),
    NVL(PLL.quantity_billed, 0)), :p_qty_precision) Quantity_Amount_Billed
    , pol.po_header_id
    FROM po_line_locations pll
    , mtl_system_items msi
    , mtl_categories mca
    , po_lines pol
    , po_line_types plt
    , hr_locations hrl
    WHERE
    ROUND (DECODE (PLT.order_type_lookup_code,'RATE', NVL(PLL.amount, POL.amount) - NVL(PLL.amount_cancelled, 0) - NVL(PLL.amount_received, 0),'FIXED PRICE', NVL(PLL.amount, POL.amount) - NVL(PLL.amount_cancelled, 0) - NVL(PLL.amount_received, 0),NVL (PLL.quantity, POL.quantity) - NVL(PLL.quantity_cancelled, 0) - NVL(PLL.quantity_received, 0)), :p_qty_precision) > 0
    AND (ROUND (DECODE (PLT.order_type_lookup_code,'RATE', NVL(PLL.amount, POL.amount),'FIXED PRICE', NVL(PLL.amount, POL.amount), NVL(PLL.quantity, POL.quantity)),:p_qty_precision)) > (ROUND (DECODE (PLT.order_type_lookup_code,'RATE', NVL(PLL.amount_billed, 0),'FIXED PRICE', NVL(PLL.amount_billed, 0),NVL(PLL.quantity_billed, 0)), :p_qty_precision))
    AND pol.item_id = msi.inventory_item_id(+)
    AND nvl(msi.organization_id,:c_organization_id) = :c_organization_id
    AND pol.line_type_id = plt.line_type_id
    AND pol.category_id = mca.category_id
    /* Bug No 141118
    Added the outer join on po_line_id ,hrl.location_id and nvl on the shipment_type
    Also added nvl on quantity and price so as to select quantity and price if the PO
    has no shipments */
    AND pol.po_line_id = pll.po_line_id(+)
    AND pll.ship_to_location_id = hrl.location_id(+)
    AND pll.shipment_type in ('STANDARD', 'PLANNED')
    AND &P_WHERE_CAT
    AND &P_WHERE_ITEM
    ORDER BY pol.line_num

    > I made a pr with single line item with 3 account assignment on percentage basis.I created a PO against .GR non valuated was automatically ticked so no account assignment was created at the time of GR posting.
    When you are having the multiple account assignment, then the system will force you to have GR-non valuated indicator being flagged which results in the fact there is not any FI document at GR posting stage and this is the standard feature of SAP.
    > Can I make a valuted GR against PO line item with multiple account assignment.
    No, not at all. The disability of GR indicator can be set in OME9 with account assignment category
    > I faced another problem .I displayed the GR and after ticking out put check box in the general data page of the GR doc. the output is being saved but  the update is terminated immediately.and no output page is generated in this item level.This output problem is not there at the time of single account assignment at PO line item.
    In fact, it is possible to maintain multiple account assignment for each and every PO line item by selecting the 'Multiple Account Assignment' button in the 'Account Assignment' View of the Item Detail of PO. However, for such multiple account assignment selection, no accounting document will be generated upon GR maintenance. This can only be done during IR via LIV process.

  • According to PO number and Line item data should come once but its repeatin

    I am calculating IR Quantity and IR value......
    for a PO  if there are four same  line items i wanted them once but they are displaying for each and every line item
    If my po is 2003000151 and line item 0010 if both are same then i wanted ir quantity 500
    but its displaying like this
      PO                 item   IR
    2003000151   0010 500
    2003000151   0010 500
    2003000151   0010 500
    2003000151   0010 500
    I need like this
    2003000151   0010 500
    2003000151   0010
    2003000151   0010
    2003000151   0010
    If po number and line item are same IR quantity should be displayed only once..
    What should be done if it should not repeat in each and every line item if both PO and line item are same

    i am having internal table of it_ekko.
    in that i am having some data of PO no, Line Item,IR value and IR qty......
    i am having data like below.
    PO                        Line Item   IR Value    IR QTY 
    200310051          0010         1500           4500
    200310051          0010        1500           4500
    200310052         0010           0                   0
    200310052          0010       0               0
    now where ever IR value and IR qty is present i wanted that to display only once against that PO and line item
    i wanted like below
    PO                        Line Item   IR Value    IR QTY 
    200310051          0010         1500           4500
    200310051          0010            0              0
    200310052         0010             0                0
    200310052          0010            0               0
    Field names for IR value and IR Qty are Menge2 and dmbtr2.
    How to do that.........
    I cant use
    Delete adjacent duplicates of it_ekko by ebeln = wa_ekko-ebeln and
                                                                          ebelp = wa_ekko-ebelp.
    because i wanted that po and same line items , how many times it is like that only.....
    in it_ekko table i only wanted to delete duplicates of menge2 and dmbtr2.
    Pls suggest the code

  • Line item PO should disply in the report

    Hi,
    As per the business requriement i need to display the line item PO discritpion into the  report.
    Currently we have one existing Z report and we are developing new Z reprot by copying that exisitng report by adding the line field.
    The PO number field is same for both header and line item ( the reason could be since header PO number header data which is copied to all the line items). the field name for both is VBKD-BSTKD
    Sales order:
    we have developed one new Z report as per the above requirement, below is the output of it. it is showing both line items are HEADER PO only. But our requriement it should display the 2nd line item as ITEM PO1 which was manually changed by the user in sales order.
    So what is the field and table i should give to the ABAP er so that it would display the line item PO details of Sales order into the report.
    Please let me know if you need any further details?
    thanks,

    Hi Lakshmipathi Sir,
    Thanks for your reply. Could you please let me know how exactly i need to mention the logic to ABAPer.
    I can see two fields are giving from VBKD table with line item wise it is displaying.
    1. BSTKD
    2. BSTKD_M
    thanks,

  • Line items records should display in 1 line (means header line)

    Hi,
    Suppose i have 5 line items in my report against 1 document number, now i want that  when i execute the report with that document number, it show only 1 line item and sum of all amounts (means of all line items) ...
    please let me know, how can i do it....

    Now i m sending my code for ur ref...
    Code----
    TABLES : bsik,bkpf,bseg,j_1imovend,lfa1,t001,t005u,bsak,ekko,bsis.
    DATA : BEGIN OF itab OCCURS 0,
           hkont LIKE bseg-hkont, "Gl account
           belnr LIKE bsik-belnr, "Document number
           gjahr LIKE bsik-gjahr, "Fiscal Year
           bldat LIKE bsik-bldat, "Document Date
           budat LIKE bsik-budat, "Posting Date
           mwskz LIKE bseg-mwskz, "Tax Code
           dmbtr LIKE bseg-dmbtr, "Amount
           buzei LIKE bseg-buzei, "line item
           lifnr LIKE bsik-lifnr, "Vendor number
           ebeln LIKE bseg-ebeln, "Purchasing Document
           ebelp LIKE bseg-ebelp, "line item nbr
           hwbas LIKE bseg-hwbas, "Base amount
           shkzg LIKE bseg-shkzg, "Debit/Credit code
           xblnr LIKE mkpf-xblnr, "Ven invoice nbr
           name1(25),                                           "name1
           ort01 LIKE lfa1-ort01,   "City
           j_1ilstno LIKE j_1imovend-j_1ilstno,  " Vendor tin nbr
           regio LIKE lfa1-regio, "Region Code
           bezei LIKE t005u-bezei, "Region desc
    END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab1.
    DATA : BEGIN OF itab2 OCCURS 0.
            INCLUDE STRUCTURE itab.
    DATA:END OF itab2.
    ***********************************Purchase order history
    DATA:   BEGIN OF bet OCCURS 50.
            INCLUDE STRUCTURE ekbe.
    DATA:   END OF bet.
    DATA:   BEGIN OF bzt OCCURS 50.
            INCLUDE STRUCTURE ekbz.
    DATA:   END OF bzt.
    DATA:   BEGIN OF betz OCCURS 50.
            INCLUDE STRUCTURE ekbez.
    DATA:   END OF betz.
    DATA:   BEGIN OF bets OCCURS 50.
            INCLUDE STRUCTURE ekbes.
    DATA:   END OF bets.
    DATA:   BEGIN OF xekbnk OCCURS 10.
            INCLUDE STRUCTURE ekbnk.
    DATA:   END OF xekbnk.
    TYPE-POOLS: slis.
    DATA: linecolor TYPE slis_specialcol_alv OCCURS 0 WITH HEADER LINE.
    DATA: alv_layout TYPE slis_layout_alv.
    DATA: fieldcat TYPE slis_t_fieldcat_alv,
          fieldcat_ln LIKE LINE OF fieldcat,
          sortcat TYPE slis_t_sortinfo_alv,
          sortcat_ln LIKE LINE OF sortcat,
          eventcat TYPE slis_t_event,
          eventcat_ln LIKE LINE OF eventcat,
          alv_print TYPE slis_print_alv.
    DATA :col_pos TYPE i.
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME.
    PARAMETERS :  hkont LIKE bseg-hkont OBLIGATORY. "GL Code
    SELECT-OPTIONS : belnr FOR bsik-belnr, "Document number
                   gjahr FOR bsik-gjahr, "Fiscal Year
                   bldat FOR bsik-bldat, "Document date
                   budat FOR bsik-budat. "posting Date
    SELECTION-SCREEN END OF BLOCK a.
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME.
    PARAMETERS: detail RADIOBUTTON GROUP gr1,
                summry RADIOBUTTON GROUP gr1.
    SELECTION-SCREEN END OF BLOCK b.
    SELECT DISTINCT hkont belnr gjahr bldat budat INTO CORRESPONDING FIELDS OF TABLE itab
                      FROM bsis
                      WHERE bukrs = '1000'
                      AND hkont = hkont
                      AND belnr IN belnr
                      AND gjahr IN gjahr
                      AND bldat IN bldat
                      AND budat IN budat.
    SORT itab BY belnr.
    LOOP AT itab.
      SELECT * FROM bseg WHERE belnr = itab-belnr
                                                   AND gjahr = itab-gjahr
                                                   AND bukrs = '1000'
                                                   AND ( ebeln <> ' ' OR hkont = hkont ).
        IF sy-subrc = 0.
          itab-buzei = bseg-buzei.
          itab-mwskz = bseg-mwskz.
          IF bseg-ebeln <> ' '.
            itab-ebeln = bseg-ebeln.
            itab-ebelp = bseg-ebelp.
            MODIFY itab.
          ENDIF.
          IF bseg-hkont = hkont.
            itab-shkzg = bseg-shkzg.
            itab-hwbas = bseg-hwbas.
            itab-dmbtr = bseg-dmbtr.
            IF itab-shkzg = 'H'.
              itab-dmbtr = itab-dmbtr * ( -1 ).
            ENDIF.
            MOVE-CORRESPONDING itab TO itab2.
            APPEND itab2.
          ENDIF.
        ENDIF.
      ENDSELECT.
    ENDLOOP.
    LOOP AT itab2.
      SELECT SINGLE * FROM ekko WHERE ebeln = itab2-ebeln.
      IF sy-subrc = 0.
        itab2-lifnr = ekko-lifnr.
      ENDIF.
      CALL FUNCTION 'ME_READ_HISTORY'
        EXPORTING
          ebeln  = itab2-ebeln
          ebelp  = itab2-ebelp
          webre  = 'X'
        TABLES
          xekbe  = bet
          xekbz  = bzt
          xekbes = bets
          xekbez = betz
          xekbnk = xekbnk.
      itab2-xblnr = bet-xblnr.
      SELECT SINGLE * FROM lfa1 WHERE lifnr = itab2-lifnr.
      itab2-name1 = lfa1-name1.
      itab2-ort01 = lfa1-ort01.
      itab2-regio = lfa1-regio.
      SELECT SINGLE * FROM t005u WHERE bland = itab2-regio
                                  AND spras = 'EN'
                                  AND land1 = 'IN'.
      itab2-bezei = t005u-bezei.
      SELECT SINGLE * FROM  j_1imovend WHERE lifnr = itab2-lifnr.
      IF sy-subrc = 0 .
        itab2-j_1ilstno = j_1imovend-j_1ilstno.  " Vendor tin nbr
      ENDIF.
      MODIFY itab2.
    ENDLOOP.
    PERFORM build_fieldcat1.
    PERFORM build_fieldcat2.
    PERFORM build_fieldcat3.
    PERFORM build_fieldcat4.
    PERFORM build_fieldcat5.
    PERFORM build_fieldcat6.
    PERFORM build_fieldcat7.
    PERFORM build_fieldcat7_1.
    PERFORM build_fieldcat8.
    PERFORM build_fieldcat9.
    PERFORM build_fieldcat10.
    PERFORM build_fieldcat11.
    PERFORM build_fieldcat12.
    PERFORM build_eventcat.
    PERFORM start_list_viewer.
    *&      Form  BUILD_EVENTCAT
          text
    -->  p1        text
    <--  p2        text
    FORM build_eventcat.
      eventcat_ln-name =  slis_ev_top_of_page.
      eventcat_ln-form = 'TOP_OF_PAGE'.
      APPEND eventcat_ln TO eventcat.
      APPEND eventcat_ln TO eventcat.
    ENDFORM.                    " BUILD_EVENTCAT
    *&      Form  START_LIST_VIEWER
          text
    -->  p1        text
    <--  p2        text
    FORM start_list_viewer.
      DATA: pgm LIKE sy-repid.
      pgm = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = pgm
         i_callback_user_command           = 'USER-COMMAND'
         it_fieldcat                       = fieldcat
         i_save                            = 'A'
         it_events                         = eventcat
        TABLES
          t_outtab                          = itab2
    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.                    "start_list_viewer
          FORM build_fieldcat1                                          *
    FORM build_fieldcat1.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'BELNR'.
      fieldcat_ln-seltext_m       = 'Doc No'.
      fieldcat_ln-outputlen = '20'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT1
          FORM build_fieldcat2                                          *
    FORM build_fieldcat2.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'BLDAT'.
      fieldcat_ln-seltext_m       = 'Doc DATE'.
    fieldcat_ln-outputlen = '20'.
      fieldcat_ln-datatype  = 'DATS'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT2
          FORM build_fieldcat3                                          *
    FORM build_fieldcat3.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'BUDAT'.
      fieldcat_ln-seltext_m       = 'POSTING DT'.
    fieldcat_ln-outputlen = '20'.
      fieldcat_ln-datatype  = 'DATS'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT3
          FORM build_fieldcat4                                          *
    FORM build_fieldcat4.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'LIFNR'.
      fieldcat_ln-seltext_m       = 'VENDOR'.
      fieldcat_ln-outputlen = '10'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT4
          FORM build_fieldcat5                                          *
    FORM build_fieldcat5.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'NAME1'.
      fieldcat_ln-seltext_m       = 'Name'.
      fieldcat_ln-outputlen = '25'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT5
          FORM build_fieldcat6                                          *
    FORM build_fieldcat6.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'ORT01'.
      fieldcat_ln-seltext_m       = 'CITY'.
      fieldcat_ln-outputlen = '15'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT6
          FORM build_fieldcat7                                          *
    FORM build_fieldcat7.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'J_1ILSTNO'.
      fieldcat_ln-seltext_m       = 'TIN'.
      fieldcat_ln-outputlen = '25'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT7
          FORM build_fieldcat7_1                                        *
    FORM build_fieldcat7_1.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'BEZEI'.
      fieldcat_ln-seltext_m       = 'Region'.
      fieldcat_ln-outputlen = '15'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT7_1
          FORM build_fieldcat8                                          *
    FORM build_fieldcat8.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'MWSKZ'.
      fieldcat_ln-seltext_m       = 'Tax c'.
      fieldcat_ln-outputlen = '4'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT8
          FORM build_fieldcat9                                          *
    FORM build_fieldcat9.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'EBELN'.
      fieldcat_ln-seltext_m       = 'Purchase Ord'.
      fieldcat_ln-outputlen = '20'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT9
          FORM build_fieldcat10                                         *
    FORM build_fieldcat10.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'HWBAS'.
      fieldcat_ln-seltext_m       = 'Base Amount'.
      fieldcat_ln-outputlen = '15'.
      fieldcat_ln-datatype  = 'CURR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT10
          FORM build_fieldcat11                                         *
    FORM build_fieldcat11.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'DMBTR'.
      fieldcat_ln-seltext_m       = 'Tax amt'.
      fieldcat_ln-outputlen = '15'.
      fieldcat_ln-datatype  = 'CURR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT11
          FORM build_fieldcat12                                         *
    FORM build_fieldcat12.
      ADD 1 TO col_pos.
      fieldcat_ln-ref_tabname = 'ITAB2'.
      fieldcat_ln-fieldname   = 'XBLNR'.
      fieldcat_ln-seltext_m       = 'VEN INV no'.
      fieldcat_ln-outputlen = '20'.
      fieldcat_ln-datatype  = 'CHAR'.
      fieldcat_ln-key         =  space.
      fieldcat_ln-no_zero     = space.
      fieldcat_ln-do_sum      = space.
      fieldcat_ln-col_pos     = col_pos.
      fieldcat_ln-no_out      = space.
      fieldcat_ln-qfieldname  = space.
      fieldcat_ln-hotspot     = space.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    " BUILD_FIELDCAT12
          FORM TOP_OF_PAGE
    FORM top_of_page.
      PERFORM batch-heading.
    ENDFORM.                    "top_of_page
    *&      Form  BATCH-HEADING
          text
    -->  p1        text
    <--  p2        text
    FORM batch-heading.
      DATA: lc_laufd(10)  TYPE c,
            lc_text(100)  TYPE c,
            lc_text2(100) TYPE c,
            lc_text3(100)  TYPE c,
            lc_date(10) TYPE c,
            lc_date1(10) TYPE c,
            lc_date2(10) TYPE c.
      DATA: li_len  TYPE i,
            li_len2 TYPE i,
            li_len3 TYPE i,
            li_pos  TYPE i,
            li_pos2 TYPE i,
            li_pos3 TYPE i.
      WRITE sy-datum TO lc_date.
    write audat-low to lc_date1.
    write audat-high to lc_date2.
      lc_text = 'Purchases from Intrastate'.
    concatenate lc_text spmon_out into lc_text2
      CONCATENATE lc_text 'As On' lc_date INTO lc_text2
    concatenate lc_text 'From' lc_date1 'To' lc_date2 into lc_text2
      SEPARATED BY space .
      PERFORM read_t001 USING '1000'.
      lc_laufd = 'ZFI'.
      FORMAT INTENSIFIED ON.
    calculate output positions
      li_pos2 = sy-linsz - 25.
      li_pos3 = sy-linsz - 10.             " pos. for name, date, time
      li_pos  = sy-linsz / 2  - STRLEN( lc_text2 )  .
    *first line
      WRITE AT 1          t001-butxt.
    write at li_pos(75) lc_text2 .
      WRITE AT 40 lc_text2 .
      WRITE: AT li_pos2    sy-datum, ' /  '.
      WRITE AT li_pos3    sy-uzeit.
      NEW-LINE.
      WRITE  AT li_pos2 'Page'.
      WRITE  AT li_pos3 sy-pagno LEFT-JUSTIFIED.
      NEW-LINE.
      WRITE  AT li_pos2 lc_laufd .
      NEW-LINE.
    third line.
      lc_text3 = text-014.
      REPLACE '&BUKRS' WITH '1000' INTO lc_text3.
      WRITE AT 1 lc_text3.
      SKIP.
    ENDFORM.                    " BATCH-HEADING
          FORM READ_T001
    -->  P_PAR_ZBUK
    FORM read_t001 USING    p_par_zbuk.
      SELECT SINGLE * FROM t001 WHERE  bukrs =
    p_par_zbuk.
      IF sy-subrc NE 0.
        t001-butxt = space.
        t001-ort01 = space.
      ENDIF.
    ENDFORM.                                                    "read_t001
    Plz check that how can i use collect in it...

Maybe you are looking for

  • How to write a  SQL based on a  view can get the best performance ?

    Hi ,     I am thinking about performance of  sql based on VIEW .<b>For the best performance ,How to do when I create  and use a view ?</b>  for example , Should i use key in my where clause as select data from table?  (of cause ,this key refers to th

  • Can't buy iphoto in app store; another apple id on my macbook bought it before

    Hello, i bought a used macbook air. after deleting the pre owners' admin account and deleting the harddisk i install OS X lion again. After that i wanted to buy iphoto in app store to use photostream on my macbook. But in the app store it wasn't poss

  • I'm locked out after using my CORRECT passcode!!

    I turn my passcode settings from off to on on occasion (when snoopy relatives come to visit).  Today I went into Settings and turned the passcode to ON.  As usual, it asked me to enter my passcode to make this change and then to reconfirm my passcode

  • Please help me in removing Scroll Bars

    Hi Please help me in following Scenario I am Implementing Light Portal. I have a Page link in detailed Navigation with 2 column Layout. I am getting an Inner Scroll as the Content in the First cell exceeds. please help me in removing the Inner Scroll

  • Doubt on REFLECTION

    Hi forum, Please help me out with this problem. I am getting the parameter types of a method in a class as Class[] parameterTypes=method.getPrameterTypes(); I need to test if the parameter types are of primitive types i.e int or String or long etc...