KEDR deletion flag

Dear experts,
I come to you with a question about the deletion flag which is possible to set in KEDR (characteristics derivation: display rule values):
If I check the SAP help it is said that:
"Deletion indicator"
With this indicator, you can limit the validity period of specific derivations.
If this indicator is set, the rule entry is treated as deleted from the "Valid from" date onward.
If an entry is no longer valid generally, then it should be deleted from the table.
Now, my question for you is: which is the date to be considered as "valid from"?
Is it the Creation date or Posting date?
It is a little bit different as creation date and posting date are usually different.
Thank you for your help.
Luca.

Hi
KEDR - ATTRIBUTES tab - Check box "Maintain Entries using validity Date"
Once you set the check box ON, and go to the Rule Values tab, you will see 2 fields  (Valid From  &  Deleted from this date)
See here... [http://img846.imageshack.us/i/screenshot002t.jpg/]
If the "deleted" indicator" has not been set - It means the Date from which this entry is valid.
If the "deleted" inicator has been set: - It means Date from which this entry is no longer valid.
Br, Ajay M

Similar Messages

  • Problem :ALV:Deletion Flags not showing in output

    hi all !
    I have a alv program which displays customer data.there are three deletion flags columns in the output.
    First deletion flag will be: KNA1-LOEVM
    Second deletion flag will be: KNB1-LOEVM
    Third deletion flag will be: KNVV-LOEVM
    earlier all three were showing.but now no one is showing.i'm pasting my code here if any expert can have a look and find out the BUG.
    CODE STARTS----
    report zqsdcap_cust.
    INCLUDE DECLARATIONS
    include:
      ziabapcapph_macros.                   "Holcim Useful Macros
    TABLE DECLARATIONS
    tables:
      tvko,                                "Org. Unit: Sales Organizations
      t001,                                "Company codes
      kna1,                                "Customer Master
      knvv,                                "Customer master sales
      knvi,                                "Customer tax classificat'n
      knb1,                                "Customer master company code
         <<CR003-DEVK949538 start ins
      adr6.                                "SMTP numbers
         <<CR003-DEVK949538 end ins
    TYPE DECLARATIONS
    type-pools:
      slis.
    STRUCTURE DECLARATIONS
    Define structure for keep data in ALV list
    data: begin of gs_output_list,
            vkorg   like  knvv-vkorg,                "Sales organization
            ktokd   like  kna1-ktokd,                "Customer A/C grp
            kunnr   like  kna1-kunnr,                "Customer number
            vtweg   like  knvv-vtweg,                "Distribution channel
            name1   like  kna1-name1,                           "Name1
            name3   like  kna1-name3,                           "Name3
            name4   like  kna1-name4,                           "Name4
            stras   like  kna1-stras,                "Street
            cityc   like  kna1-cityc,                "City
            bezei1  like  t005h-bezei,               "Sales office
            land1   like  kna1-land1,                "Country
            regio   like  kna1-regio,                "Region
            bezei2  like  t005u-bezei,               "Region decription
            kdgrp   like  knvv-kdgrp,                "Customer group
            ktext   like  t151t-ktext,               "Cust grp name
            bzirk   like  knvv-bzirk,                "Sales district
            bztxt   like  t171t-bztxt,               "Description
            zterm   like  knvv-zterm,                "Payment term
            lzone   like  kna1-lzone,                "Transport zone
            vtext   like  tzont-vtext,               "Description
            erdat   like  kna1-erdat,                "Creation date
          end of gs_output_list.
    Internal table for customer tax data
    data: begin of gs_output_tax,
            vkorg  like  knvv-vkorg,                 "Sales organization
            kunnr  like  kna1-kunnr,                 "Customer number
            vtweg  like  knvv-vtweg,                 "Distribution channel
            name1  like  kna1-name1,                            "Name1
            name3  like  kna1-name3,                            "Name3
            name4  like  kna1-name4,                            "Name4
            ort01  like  kna1-ort01,                 "City
            stcd1  like  kna1-stcd1,                 "STD code
            spart  like  knvv-spart,                 "Division
            taxkd  like  knvi-taxkd,                 "Tax classific'n
            tatyp  like  knvi-tatyp,                 "Tax category
            vtext  like  tskdt-vtext,                "Tax description
          end of gs_output_tax.
    Internal table for HVL customer master
    data: begin of gs_output_hvl,
            kunnr  like  kna1-kunnr,                 "Customer number
            stceg  like  kna1-stceg,                 "VAT registration no
            telfx  like  kna1-telfx,                 "Fax number
            telf1  like  kna1-telf1,                 "First telephone number
            stras  like  kna1-stras,                 "House number and stret
            ort02  like  kna1-ort02,                 "District
            cityc  like  kna1-cityc,                 "City code
            bezei  like  t005h-bezei,                "City description
            regio  like  kna1-regio,                 "Region
            ort01  like  kna1-ort01,                 "City
            name2  like  kna1-name2,                            "Name2
            name1  like  kna1-name1,                            "Name1
            bzirk  like  knvv-bzirk,                 "Sales district
            spart  like  knvv-spart,                 "Division
            vtweg  like  knvv-vtweg,                 "Distribution channel
            vkorg  like  knvv-vkorg,                 "Sales organization
          end of gs_output_hvl.
    Internal table for customer database CRM
    data: begin of gs_output_crm,
            vkorg      like  knvv-vkorg,             "Sales organization
            vtweg      like  knvv-vtweg,             "Distribution channel
            bzirk      like  knvv-bzirk,             "Sales district
            kunnr      like  kna1-kunnr,             "Customer number
            name1      like  kna1-name1,                        "Name1
            name2      like  kna1-name2,                        "Name2
            stras      like  kna1-stras,             "House number street
            ort01      like  kna1-ort01,             "City
            ort02      like  kna1-ort02,             "District
            pstlz      like  kna1-pstlz,             "Postal code
            cityc      like  kna1-cityc,             "City code
            telf1      like  kna1-telf1,             "First telephone number
            telfx      like  kna1-telfx,             "Fax number
            vkbur      like  knvv-vkbur,             "Sales office
            regio      like  kna1-regio,             "Region
            vkgrp      like  knvv-vkgrp,             "Sales group
            kdgrp      like  knvv-kdgrp,             "Customer group
            kvgr3      like  knvv-kvgr3,             "Customer group 3
            altkn      like  knb1-altkn,             "Previous record number
            erdat      like  knvv-erdat,             "Creation date
            found_dat  like  zcrm_bp_ext-found_dat,  "Found date
          <<CR000-DEVK943142 start del
          versg      like  knvv-versg,             "Customer statistic grp
          bukrs      like  knb1-bukrs,             "Company code
          <<CR000-DEVK943142 end del
          end of gs_output_crm.
    Internal table for customer information
    data: begin of gs_output_info,
            kunnr           like  kna1-kunnr,        "Customer number
            vkorg           like  knvv-vkorg,        "Sales organization
            vtweg           like  knvv-vtweg,        "Distribution channel
            stcd2           like  kna1-stcd2,        "Tax code
            name1           like  kna1-name1,        "Name1
            name2           like  kna1-name2,        "Name2
          <<CR002-DEVK944835 start ins
            name3           like  kna1-name3,        "Name3
          <<CR002-DEVK944835 end ins
            stras           like  kna1-stras,        "House number street
            ort01           like  kna1-ort01,        "City
            ort02           like  kna1-ort02,        "District
            pstlz           like  kna1-pstlz,        "Postal code
            regio           like  kna1-regio,        "Region
            land1           like  kna1-land1,        "Country code
            cityc           like  kna1-cityc,        "City code
            telf1           like  kna1-telf1,        "First telephone number
            telfx           like  kna1-telfx,        "Fax number
          <<CR001-DEVK944239 start ins
            bzirk           like  knvv-bzirk,        "Sales District
            vkbur           like  knvv-vkbur,        "Sales Office
            kdgrp           like  knvv-kdgrp,        "Customer group
          <<CR001-DEVK944239 end ins
            vkgrp           like  knvv-vkgrp,        "Sales group
            kvgr3           like  knvv-kvgr3,        "Customer group 3
            versg           like  knvv-versg,        "Customer stat grp
            kdkg2           like  kna1-kdkg2,        "Customer condition gp2
            kdkg1           like  kna1-kdkg1,        "Customer condition gp1
          <<CR001-DEVK944239 start del
          kdgrp           like  knvv-kdgrp,        "Customer group
          <<CR001-DEVK944239 end del
            altkn           like  knb1-altkn,        "Previous record#
            erdat           like  knvv-erdat,        "Creation date
            note_text(200)  type  c,                 "<<CR003-DEVK949538 ins
            smtp_addr       like  adr6-smtp_addr,    "<<CR003-DEVK949538 ins
            loevm1          like  kna1-loevm,        "Deletion flag all
            loevm2          like  knb1-loevm,        "Deletion flag Cd
            loevm3          like  knvv-loevm,        "Deletion flag sal
          end of gs_output_info.
    ALV Grid Declaration
    data:
      gs_fieldcat             type  slis_fieldcat_alv,
      gs_layout               type  slis_layout_alv,
      gs_event                type  slis_t_event,
      gs_variant              like  disvariant,
      gs_sort_info            type  slis_sortinfo_alv,
      gs_exit_caused_by_user  type  slis_exit_by_user,
      gs_tabname              type  slis_tabname,
      gs_header               type  slis_entry.
    INTERNAL TABLE DECLARATIONS
    Define internal table for keep data in ALV list
    data:
      gt_output_list       like  table of gs_output_list,
      gt_output_tax        like  table of gs_output_tax,
      gt_output_hvl        like  table of gs_output_hvl,
      gt_output_crm        like  table of gs_output_crm,
      gt_output_info       like  table of gs_output_info,
    <<CR003-DEVK949538 start ins
      gv_text              like  tline occurs 0 with header line,
    <<CR003-DEVK949538 start ins
    ALV Grid Declaration
      gt_fieldcat           type  slis_t_fieldcat_alv,
      gt_list_top_of_page   type  slis_t_listheader,
      gt_list_top_of_page2  type  slis_t_listheader,
      gt_sort_info          type  slis_t_sortinfo_alv.
    VARIABLE DECLARATIONS
    data:
    ALV Grid Declaration
      gv_save,
      gv_exit_caused_by_caller,
      gv_repid         type  sy-repid,
      gv_user_command  type  slis_formname value 'USER_COMMAND',
      gv_top_of_page   type  slis_formname value 'TOP_OF_PAGE',
      gv_top_of_list   type  slis_formname value 'TOP_OF_LIST',
      gv_end_of_list   type  slis_formname value 'END_OF_LIST',
      lv_store         like  thead-tdname,           "<<CR003-DEVK949538 ins
      lv_id            like  thead-tdid,             "<<CR003-DEVK949538 ins
      lv_lines         type  i.                      "<<CR003-DEVK949538 ins
    SELECTION SCREEN DECLARATIONS
    Define selection-screen of query
    selection-screen: begin of block blk with frame title text-001.
    select-options:   s_vkorg  for   knvv-vkorg           "Sales org
                                     obligatory
                                     memory id vko,
                      s_bzirk  for   knvv-bzirk,          "Sales district
                      s_vtweg  for   knvv-vtweg,          "Dist channel
                      s_spart  for   knvv-spart           "Division
                                     default 'CM',
                      s_taxkd  for   knvi-taxkd,          "Tax classific'n
                      s_kunnr  for   kna1-kunnr,          "Customer number
                      s_regio  for   kna1-regio,          "Region
                      s_kdgrp  for   knvv-kdgrp,          "Customer group
                      s_vkgrp  for   knvv-vkgrp,          "Sales group
                      s_vkbur  for   knvv-vkbur,          "Sales office
                      s_lzone  for   kna1-lzone,          "Zone
                      s_erdat  for   kna1-erdat,          "Creation date
                      s_zuawa  for   knb1-zuawa,          "Key for sorting
                      s_ktokd  for   kna1-ktokd,          "Customer A/C grp
                      s_altkn  for   knb1-altkn,          "Previous rec no
                      s_bukrs  for   knb1-bukrs           "Company code
                                     obligatory
                                     memory id buk,
                     s_loevm1 for   kna1-loevm,          "Deletion flag all
                     s_loevm2 for   knb1-loevm,          "Deletion flag Cd
                     s_loevm3 for   knvv-loevm.          "Deletion flag sal
    selection-screen: end of block blk.
    selection-screen: begin of block b2 with frame title text-002.
    parameters:       pr_cust1  radiobutton group a1
                                default 'X'
                                user-command bkg,
                      pr_cust2  radiobutton group a1,
                      pr_cust3  radiobutton group a1,
                      pr_cust4  radiobutton group a1,
                      pr_cust5  radiobutton group a1.
    selection-screen: end of block b2.
    AT SELECTION-SCREEN ON S_VKORG
    at selection-screen on s_vkorg.
      select  vkorg
        into  tvko-vkorg
        from  tvko
       where  vkorg in s_vkorg.
      authorization check for sales org.
        authority-check object 'V_VBRK_VKO'
                            id 'VKORG' field tvko-vkorg
                            id 'ACTVT' field '03'.
        check sy-subrc ne 0.
        message e002(zgen) with 'No authorization for sales org.'
                                 tvko-vkorg.
      endselect.
    AT SELECTION-SCREEN ON S_BUKRS
    at selection-screen on s_bukrs.
      if pr_cust4 eq 'X' or
         pr_cust5 eq 'X'.
        select  bukrs
          into  t001-bukrs
          from  t001
         where  bukrs in s_bukrs.
        authorization check for plant and company code
          authority-check object 'A_S_WERK'
                              id 'BUKRS' field t001-bukrs
                              id 'WERKS' dummy.
          check sy-subrc ne 0.
          message e002(zgen) with 'No authorization for this company code.'
                                   t001-bukrs.
        endselect.
      endif.
    AT SELECTION-SCREEN OUTPUT
    at selection-screen output.
      loop at screen .
        if pr_cust1 eq 'X'.
          if screen-name = 'S_VTWEG-LOW'   or
             screen-name = 'S_VTWEG-HIGH'  or
             screen-name = 'S_SPART-LOW'   or
             screen-name = 'S_SPART-HIGH'  or
             screen-name = 'S_TAXKD-LOW'   or
             screen-name = 'S_TAXKD-HIGH'  or
             screen-name = 'S_BUKRS-LOW'   or
             screen-name = 'S_BUKRS-HIGH'  or
             screen-name = 'S_ERDAT-LOW'   or
             screen-name = 'S_ERDAT-HIGH'  or
             screen-name = 'S_ALTKN-LOW'   or
             screen-name = 'S_ALTKN-HIGH'  or
             screen-name = 'S_VKBUR-LOW'   or
             screen-name = 'S_VKBUR-HIGH'  or
             screen-name = 'S_LOEVM1-LOW'  or
             screen-name = 'S_LOEVM1-HIGH' or
             screen-name = 'S_LOEVM2-LOW'  or
             screen-name = 'S_LOEVM2-HIGH' or
             screen-name = 'S_LOEVM3-LOW'  or
             screen-name = 'S_LOEVM3-HIGH'.
            screen-input = 0.
          endif.
        elseif pr_cust2 eq 'X'.
          if screen-name = 'S_BZIRK-LOW'    or
             screen-name = 'S_BZIRK-HIGH'   or
             screen-name = 'S_KDGRP-LOW'    or
             screen-name = 'S_KDGRP-HIGH'   or
             screen-name = 'S_LZONE-LOW'    or
             screen-name = 'S_LZONE-HIGH'   or
             screen-name = 'S_KTOKD-LOW'    or
             screen-name = 'S_KTOKD-HIGH'   or
             screen-name = 'S_ERDAT-LOW'    or
             screen-name = 'S_ERDAT-HIGH'   or
             screen-name = 'S_KTOKD-LOW'    or
             screen-name = 'S_KTOKD-HIGH'   or
             screen-name = 'S_ALTKN-LOW'    or
             screen-name = 'S_ALTKN-HIGH'   or
             screen-name = 'S_VKBUR-LOW'    or
             screen-name = 'S_VKBUR-HIGH'   or
             screen-name = 'S_LOEVM1-LOW'   or
             screen-name = 'S_LOEVM1-HIGH'  or
             screen-name = 'S_LOEVM2-LOW'   or
             screen-name = 'S_LOEVM2-HIGH'  or
             screen-name = 'S_LOEVM3-LOW'   or
             screen-name = 'S_LOEVM3-HIGH'  or
             screen-name = 'S_BUKRS-LOW'    or
             screen-name = 'S_BUKRS-HIGH'   or
             screen-name = 'S_VKGRP-LOW'    or
             screen-name = 'S_VKGRP-HIGH'.
            screen-input = 0.
          endif.
        elseif pr_cust3 eq 'X'.
          if screen-name = 'S_BZIRK-LOW'   or
             screen-name = 'S_BZIRK-HIGH'  or
             screen-name = 'S_KDGRP-LOW'   or
             screen-name = 'S_KDGRP-HIGH'  or
             screen-name = 'S_LZONE-LOW'   or
             screen-name = 'S_LZONE-HIGH'  or
             screen-name = 'S_ERDAT-LOW'   or
             screen-name = 'S_ERDAT-HIGH'  or
             screen-name = 'S_KTOKD-LOW'   or
             screen-name = 'S_KTOKD-HIGH'  or
             screen-name = 'S_SPART-LOW'   or
             screen-name = 'S_SPART-HIGH'  or
             screen-name = 'S_TAXKD-LOW'   or
             screen-name = 'S_TAXKD-HIGH'  or
             screen-name = 'S_REGIO-LOW'   or
             screen-name = 'S_REGIO-HIGH'  or
             screen-name = 'S_ALTKN-LOW'   or
             screen-name = 'S_ALTKN-HIGH'  or
             screen-name = 'S_VKBUR-LOW'   or
             screen-name = 'S_VKBUR-HIGH'  or
             screen-name = 'S_LOEVM1-LOW'  or
             screen-name = 'S_LOEVM1-HIGH' or
             screen-name = 'S_LOEVM2-LOW'  or
             screen-name = 'S_LOEVM2-HIGH' or
             screen-name = 'S_LOEVM3-LOW'  or
             screen-name = 'S_LOEVM3-HIGH' or
             screen-name = 'S_BUKRS-LOW'   or
             screen-name = 'S_BUKRS-HIGH'  or
             screen-name = 'S_VKGRP-LOW'   or
             screen-name = 'S_VKGRP-HIGH'  or
             screen-name = 'S_VTWEG-LOW'   or
             screen-name = 'S_VTWEG-HIGH'.
            screen-input = 0.
          endif.
        elseif pr_cust4 eq 'X'.
          if screen-name = 'S_LZONE-LOW'  or
             screen-name = 'S_LZONE-HIGH' or
             screen-name = 'S_TAXKD-LOW'  or
             screen-name = 'S_TAXKD-HIGH' or
             screen-name = 'S_REGIO-LOW'  or
             screen-name = 'S_REGIO-HIGH' or
             screen-name = 'S_ZUAWA-LOW'  or
             screen-name = 'S_ZUAWA-HIGH'.
            screen-input = 0.
          endif.
        else.
          if screen-name = 'S_LZONE-LOW'   or
             screen-name = 'S_LZONE-HIGH'  or
             screen-name = 'S_TAXKD-LOW'   or
             screen-name = 'S_TAXKD-HIGH'.
            screen-input = 0.
          endif.
        endif.
        modify screen.
      endloop.
    INITIALIZATION
    initialization.
      perform deactivate_program using sy-cprog.
    START OF SELECTION
    start-of-selection.
    Customized function to get data from database table
      perform get_data.
    <<CR003-DEVK949538 start ins
      perform get_internal_note_text tables gt_output_info.
    <<CR003-DEVK949538 end ins
    Create sort of ALV list
      perform build_sort.
    Send data to ALV list to display
      if pr_cust1 eq 'X'.
        gs_tabname = text-003.
        gs_header  = text-004.
        perform write_alv_report tables gt_output_list
                                        gt_sort_info.
      elseif pr_cust2 eq 'X'.
        gs_tabname = text-005.
        gs_header  = text-006.
        perform write_alv_report tables gt_output_tax
                                        gt_sort_info.
      elseif pr_cust3 eq 'X'.
        gs_tabname = text-007.
        gs_header  = text-008.
        perform write_alv_report tables gt_output_hvl
                                        gt_sort_info.
      elseif pr_cust4 eq 'X'.
        gs_tabname = text-009.
        gs_header  = text-010.
        perform write_alv_report tables gt_output_crm
                                        gt_sort_info.
      else.
        gs_tabname = text-011.
        gs_header  = text-012.
        perform write_alv_report tables gt_output_info
                                        gt_sort_info .
      endif.
    FORM EVENTTAB_FIELD
    Fill Event tab, for ALV Grid Display
    form eventtab_field using gs_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   = gs_events.
      read table gs_events with key name = slis_ev_top_of_page
                               into ls_event.
      if sy-subrc = 0.
        move gv_top_of_page to ls_event-form.
        append ls_event     to gs_events.
      endif.
    endform.                    " eventtab_field
    FORM TOP_OF_PAGE
    Write at Top of Page of ALV grid
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = gt_list_top_of_page.
    endform.                    "top_of_page
    FORM COMMENT_BUILD
    Write header of ALV grid
    form comment_build using lt_top_of_page type slis_t_listheader
                             gs_header.
      data:
        lv_tdate(10),
        lv_fdate(10),
        ls_line   type  slis_listheader.
      clear: ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = gs_header.
      append ls_line to lt_top_of_page.
    endform.                    "comment_build
    FORM INIT_FIELDCAT
    Fill Field Catalog for ALV Grid
    form init_fieldcat using gs_tabname.
      refresh: gt_fieldcat.
    use this function to get the all fields in the structure.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name     = gv_repid
                i_internal_tabname = gs_tabname
                i_inclname         = gv_repid
           changing
                ct_fieldcat        = gt_fieldcat.
      if sy-subrc eq 0.
      clear mark for key field to set color of key column
        gs_fieldcat-key = ''.
        modify gt_fieldcat from gs_fieldcat transporting key
                          where fieldname ne space.
        read table gt_fieldcat with key fieldname = 'FOUND_DAT'
                                   into gs_fieldcat.
        gs_fieldcat-seltext_l = text-013.
        modify gt_fieldcat from gs_fieldcat
                   transporting seltext_l
                          where fieldname = 'FOUND_DAT'.
      <<CR003-DEVK949538 start ins
        read table gt_fieldcat with key fieldname = 'NOTE_TEXT'
                                   into gs_fieldcat.
        gs_fieldcat-seltext_l = text-014.
        modify gt_fieldcat from gs_fieldcat
                   transporting seltext_l
                          where fieldname = 'NOTE_TEXT'.
      <<CR003-DEVK949538 start ins
      endif.
    endform.                    "init_fieldcat
    FORM INIT_LAYOUT
    Layout initial
    form init_layout using gs_layout type slis_layout_alv.
      gs_layout-info_fieldname    = 'LINECOLOR'.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'X'.
    endform.                    " init_layout
    FORM WRITE_ALV_REPORT
    form write_alv_report tables gt_output
                                 gt_sort_info.
    ALV Grid display
      clear: gv_repid,
             gv_save.
      gv_repid          = sy-repid.
      gs_variant-report = gv_repid.
      gv_save           = 'A'.
    Build fieldcatalog
      perform init_fieldcat using gs_tabname.
    Build list events
      perform eventtab_field using gs_event.
    Show in ALV Grid form
      perform init_layout using gs_layout.
    Build comments
      perform comment_build using gt_list_top_of_page[]
                                  gs_header.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_buffer_active         = ' '
                i_callback_program      = gv_repid
                is_layout               = gs_layout
                i_save                  = gv_save
                is_variant              = gs_variant
                it_events               = gs_event[]
                it_sort                 = gt_sort_info[]
                it_fieldcat             = gt_fieldcat[]
           importing
                e_exit_caused_by_caller = gv_exit_caused_by_caller
                es_exit_caused_by_user  = gs_exit_caused_by_user
           tables
                t_outtab                = gt_output
           exceptions
                program_error           = 1
                others                  = 2.
    endform.                    "write_alv_report
    FORM GET_DATA
    form get_data.
    Get customer list
      if pr_cust1 eq 'X'.
        select  knvv~vkorg
                kna1~ktokd
                kna1~kunnr
                knvv~vtweg
                kna1~name1
                kna1~name3
                kna1~name4
                kna1~stras
                kna1~cityc
                kna1~regio
                kna1~land1
                knvv~kdgrp
                knvv~bzirk
                knvv~zterm
                kna1~lzone
                kna1~erdat
          from  kna1 join  knvv
            on  kna1kunnr = knvvkunnr
          into  corresponding fields of table gt_output_list
         where  kna1~kunnr in s_kunnr
           and  knvv~vkorg in s_vkorg
           and  knvv~bzirk in s_bzirk
           and  kna1~regio in s_regio
           and  knvv~kdgrp in s_kdgrp
           and  kna1~lzone in s_lzone
           and  kna1~erdat in s_erdat
           and  kna1~ktokd in s_ktokd.
        loop at gt_output_list into gs_output_list.
        Get City decsription
          perform get_city_description using gs_output_list-cityc
                                    changing gs_output_list-bezei1.
        Get Region description
          select single  bezei
                   from  t005u
                   into  gs_output_list-bezei2
                  where  bland = gs_output_list-regio
                    and  land1 = gs_output_list-land1"<<CR000-DEVK942345 ins
                    and  spras = sy-langu.
        Get customer group description
          select single  ktext
                   from  t151t
                   into  gs_output_list-ktext
                  where  kdgrp = gs_output_list-kdgrp
                    and  spras = sy-langu.
        Get sales district description
          select single  bztxt
                   from  t171t
                   into  gs_output_list-bztxt
                  where  bzirk = gs_output_list-bzirk
                    and  spras = sy-langu.
        Get zone decription
          select single  vtext
                   from  tzont
                   into  gs_output_list-vtext
                  where  zone1 = gs_output_list-lzone
                    and  spras = sy-langu.
          modify gt_output_list from gs_output_list index sy-tabix
                                             transporting bezei1
                                                          bezei2
                                                          ktext
                                                          bztxt
                                                          vtext.
          clear gs_output_list.
        endloop.
    Get customer tax data
      elseif pr_cust2 eq 'X'.
        select  kna1~kunnr
                kna1~name1
                kna1~name3
                kna1~name4
                kna1~ort01
                kna1~stcd1
                knvv~vkorg
                knvv~spart
                knvv~vtweg
                knvi~taxkd
                knvi~tatyp
          from  kna1 join  knvv
            on  kna1kunnr = knvvkunnr
                join  knvi
            on  kna1kunnr = knvikunnr
          into  corresponding fields of table gt_output_tax
         where  kna1~kunnr in s_kunnr
           and  knvv~vkorg in s_vkorg
           and  knvv~vtweg in s_vtweg
           and  knvv~spart in s_spart
           and  kna1~regio in s_regio
           and  knvi~taxkd in s_taxkd.
      Get customer tax description
        loop at gt_output_tax into gs_output_tax.
          select single  vtext
                   from  tskdt
                   into  gs_output_tax-vtext
                  where  tatyp = gs_output_tax-tatyp
                    and  taxkd = gs_output_tax-taxkd
                    and  spras = sy-langu.
          if sy-subrc eq 0.
            modify gt_output_tax from gs_output_tax index sy-tabix
                                             transporting vtext.
            clear gs_output_tax.
          endif.
        endloop.
    Get customer HVL data
      elseif pr_cust3 eq 'X'.
        select  kna1~kunnr
                kna1~stceg
                kna1~telfx
                kna1~telf1
                kna1~stras
                kna1~ort02
                kna1~cityc
                kna1~regio
                kna1~ort01
                kna1~name2
                kna1~name1
                knvv~bzirk
                knvv~spart
                knvv~vtweg
                knvv~vkorg
          from  kna1 join  knvv
            on  kna1kunnr = knvvkunnr
          into  corresponding fields of table gt_output_hvl
         where  kna1~kunnr in s_kunnr
           and  knvv~vkorg in s_vkorg.
        loop at gt_output_hvl into gs_output_hvl.
        Get city description.
          perform get_city_description using gs_output_hvl-cityc
                                    changing gs_output_hvl-bezei.
          if sy-subrc eq 0.
            modify gt_output_hvl from gs_output_hvl index sy-tabix
                                             transporting bezei.
            clear gs_output_hvl.
          endif.
        endloop.
    Get cust CRM data
      elseif pr_cust4 eq 'X'.
        select  kna1~kunnr
              knvv~versg                           "<<CR000-DEVK943142 del
                knvv~vkorg
                knvv~vtweg
                knvv~bzirk
                knvv~vkgrp
                knvv~kdgrp
                knvv~vkbur
                kna1~name1
                kna1~name2
                kna1~ort01
                kna1~pstlz
                kna1~regio
                kna1~stras
                kna1~telf1
                kna1~telfx
                kna1~ort02
                kna1~cityc
                knvv~kvgr3
                knb1~altkn
              knb1~bukrs                           "<<CR000-DEVK943142 del
                knvv~erdat
                zcrm_bp_ext~found_dat
          from  kna1 join knvv
            on  kna1kunnr = knvvkunnr
          join  knb1
            on  knvvkunnr = knb1kunnr
          join  zcrm_bp_ext
            on  knb1kunnr = zcrm_bp_extkunnr
          into  corresponding fields of table gt_output_crm
         where  kna1~kunnr in s_kunnr
           and  knvv~vkorg in s_vkorg
           and  knvv~vtweg in s_vtweg
           and  knvv~spart in s_spart
           and  knvv~bzirk in s_bzirk
           and  knvv~kdgrp in s_kdgrp
           and  knvv~vkgrp in s_vkgrp
           and  knvv~vkbur in s_vkbur
           and  knvv~erdat in s_erdat
           and  kna1~ktokd in s_ktokd
           and  kna1~loevm in s_loevm1
           and  knb1~loevm in s_loevm2
           and  knvv~loevm in s_loevm3
           and  knb1~bukrs in s_bukrs
           and  knb1~altkn in s_altkn.
      else.
      Get customer information
       <<CR001-DEVK944342 start del
       select  kna1~kunnr
               knvv~vkorg
               knvv~vtweg
               kna1~stcd2
               kna1~name1
               kna1~name2
               kna1~ort01
               kna1~land1
               kna1~pstlz
               kna1~regio
               kna1~stras
               kna1~telf1
               kna1~telfx
               knvv~bzirk                          "<<CR001-DEVK944239 ins
               knvv~vkbur                          "<<CR001-DEVK944239 ins
               kna1~ort02
               kna1~cityc
               knvv~vkgrp
               knvv~kvgr3
               knvv~versg
               kna1~kdkg2
               kna1~kdkg1
               knvv~kdgrp
               knb1~altkn
               knvv~erdat
               kna1~loevm
               knb1~loevm
               knvv~loevm
       <<CR001-DEVK944342 end del
      <<CR001-DEVK944342 start ins
        select  kna1~kunnr
                knvv~vkorg
                knvv~vtweg
                kna1~stcd2
                kna1~name1
                kna1~name2
                kna1~name3                           "<<CR002-DEVK944835 ins
                kna1~stras
                kna1~ort01
                kna1~ort02
                kna1~pstlz
                kna1~regio
                kna1~land1
                kna1~cityc
                kna1~telf1
                kna1~telfx
                knvv~bzirk
                knvv~vkbur
                knvv~kdgrp
                knvv~vkgrp
                knvv~kvgr3
                knvv~versg
                kna1~kdkg2
                kna1~kdkg1
                knb1~altkn
                knvv~erdat
                kna1~loevm
                knb1~loevm
                knvv~loevm
      <<CR001-DEVK944342 end ins
          from  kna1 join knvv
            on  kna1kunnr = knvvkunnr
                join knb1
            on  kna1kunnr = knb1kunnr
        <<CR001-DEVK944252 start del
        into  corresponding fields of table gt_output_info
        <<CR001-DEVK944252 end del
        <<CR003-DEVK949538 start del
          into  table gt_output_info                "<<CR001-DEVK944342 ins
        <<CR003-DEVK949538 end del
        <<CR003-DEVK949538 start ins
          into  corresponding fields of table gt_output_info
        <<CR003-DEVK949538 end ins
         where  kna1~kunnr in s_kunnr
           and  knvv~vkorg in s_vkorg
           and  knvv~vtweg in s_vtweg
           and  knvv~spart in s_spart
           and  knvv~bzirk in s_bzirk
           and  knvv~kdgrp in s_kdgrp
           and  knvv~vkgrp in s_vkgrp
           and  knvv~vkbur in s_vkbur
           and  knvv~erdat in s_erdat
           and  kna1~ktokd in s_ktokd
           and  kna1~regio in s_regio
         <<CR001-DEVK944252 start del
         and  kna1~loevm in s_loevm1
         and  knb1~loevm in s_loevm2
         and  knvv~loevm in s_loevm3
         <<CR001-DEVK944252 end del
         <<CR001-DEVK944252 start ins
           and ( kna1~loevm in s_loevm1
            or   knb1~loevm in s_loevm2
            or   knvv~loevm in s_loevm3 )
         <<CR001-DEVK944252 end ins
           and  knb1~zuawa in s_zuawa
           and  knb1~bukrs in s_bukrs
           and  knb1~altkn in s_altkn.
         <<CR003-DEVK949538 start ins
           loop at gt_output_info into gs_output_info.
          select single  adrnr
                   into  kna1-adrnr
                   from  kna1
                  where  kunnr = gs_output_info-kunnr.
          check sy-subrc eq 0.
          select single  smtp_addr
                   into  adr6-smtp_addr
                   from  adr6
                  where  addrnumber = kna1-adrnr.
          check sy-subrc eq 0.
          gs_output_info-smtp_addr = adr6-smtp_addr.
          modify gt_output_info from gs_output_info.
        endloop.
         <<CR003-DEVK949538 end ins
      endif.
    <<CR003-DEVK949538 start ins
      loop at gt_output_info into gs_output_info.
        lv_store = gs_output_info-loevm1.
      endloop.
    <<CR003-DEVK949538 end ins
    endform.
    FORM BUILD_SORT
    form build_sort.
      if pr_cust1 eq 'X' or
         pr_cust2 eq 'X'.
        clear gs_sort_info.
        gs_sort_info-fieldname = 'VKORG'.
        gs_sort_info-spos      = 1.
        gs_sort_info-up        = 'X'.
        append gs_sort_info to gt_sort_info.
      endif.
      clear gs_sort_info.
      gs_sort_info-fieldname = 'KUNNR'.
      gs_sor

    hi shivaji!
    thx for the reply.
    can u chk whether there is any problem with the queries or not.
    regards
    sachin

  • Report for update of Material with deletion Flag from R/3 to SRM

    Hi All,
               Is any report for Updating material in SRM with deletion indicator for those  deletion flag set in R/3...

    Check material status
      IF mat_mmsta EQ '--'.
        lv_msgv1 = iv_ordered_prod.
        CALL FUNCTION 'BBP_PD_MSG_ADD'
          EXPORTING
            i_msgty       = c_msgty_e
            i_msgid       = 'BBP_PD'
            i_msgno       = 426
            i_msgv1       = lv_msgv1
          EXCEPTIONS
            log_not_found = 1
            OTHERS        = 2.
        IF sy-subrc <> 0.
          PERFORM abort.
        ENDIF.
        IF c_on = c_off.
          MESSAGE e426(bbp_pd) WITH lv_msgv1.
        ENDIF.
      ENDIF.
      if not mat_lvorm is initial.
        lv_msgv1 = iv_ordered_prod.
        call function 'BBP_PD_MSG_ADD'
    program name LBBP_PDIGPF2R
    Check material in backend
      CALL FUNCTION 'META_MATERIAL_READ'
        EXPORTING
          i_mtcom        = ls_mtcom_eci
          logical_system = iv_log_system
        IMPORTING
          e_mmsta        = mat_mmsta
          e_lvorm        = mat_lvorm
        EXCEPTIONS
          mat_not_found  = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
        lv_msgv1 = iv_ordered_prod.
        lv_msgv2 = iv_plant.
        CALL FUNCTION 'BBP_PD_MSG_ADD'
          EXPORTING
            i_msgty       = c_msgty_e
            i_msgid       = 'BBP_PD'
            i_msgno       = 275
            i_msgv1       = lv_msgv1
            i_msgv2       = lv_msgv2
          EXCEPTIONS
            log_not_found = 1
            OTHERS        = 2.
        IF sy-subrc <> 0.
          PERFORM abort.
        ENDIF.
        IF c_on = c_off.
          MESSAGE e275(bbp_pd) WITH lv_msgv1 lv_msgv2.
        ENDIF.
      ENDIF.
          EXPORTING
            i_msgty       = c_msgty_e
            i_msgid       = 'BBP_PD'
            i_msgno       = 345
          EXCEPTIONS
            log_not_found = 1
            others        = 2.
        if sy-subrc <> 0.
          perform abort.
        endif.
        if c_on = c_off.
    IN SRM PROGRAM LBBP_PDIGPF2R BBP_PD 345 throws message "product x is designed for deletion"
    but it is validationg from fm 'META_MATERIAL_READ'
    please close this thread
    br
    muthu

  • Material deletion flag at storage location level is not working

    I have a material that is created in some plants and also in some storage locations within each plant. If I mark the deletion flag at plant level I am not able to create a PO -> Me051 error message appears. Whereas if I mark the deletion flag at storage location level nothing appens. I am able to create a PO and also to create to goods receipt. Is there any customization that I should do in order to get the error message?
    Thanks in advance.

    storage location level deletion flag is not checked at order creation.
    it is assumed that you can change the storage location when you do the receipt.
    MRP run is at plant level, so the requirement is valid even the storage location view is flagged for deletion.

  • Follow up action to set delete flag after UD (QS41, QS51)

    Hi all,
    If user give UD as 'not good' for Equipment (eg Vernier Caliper) then he has to set delete flag for maintenance plan no and Equipment no through IP02 and IE02 respectively
    now he want that, above delete flag should set automatically after giving UD so particular maintenance plan or equipment should not release in future.
    I got one follow up action 'QM_PM' in transaction QS51 due to this after giving UD for Inspection lot, plan get technically complete (TECHO)
    so how to make changes so i'll achieve above functionality
    plz tell me about catalog, follow up action, QS41
    thanks....

    Hi all,
    i got one solution on which i am working
    Steps:
    1.The solution is to use the User Exit namely QEVA0010 and use the logic as mentioned below.
    2. Test and use the above mentioned user exit.
    3. The first condition should be checked for Inspection Type - 14 and for UD code NG.
    4.Logic to be used To set the deletion flag for the Equipment.
       Go to Table QAPP - Pass inspection lot Number and get the Equipment no.
       Go to Table EQUI - Pass Equipment no and get OBJNR  
    Go to Table JEST - Pass the Objnr - The value for deletion flag status is active is I0076 and the value for deletion  flag inactive is I0320.
       In order to set the deletion Flag,use help of FM - STATUS_CHANGE_INTERN to code.
    5.Logic to be used To set the deletion flag for the Maintenance Plan.
    Go to Table QALS - Pass inspection lot no and get the order no.
    Go to Table AFIH - Pass order no - Get maintenance Plan.
    Go to Table MPLA - Pass the maintenance plan and get the Objnr no.
    JEST - Pass the Objnr - The value for deletion flag status is active is I0076 and the value for deletion flag inactive is I0320.
      In order to set the deletion Flag,use help of FM - STATUS_CHANGE_INTERN to code.

  • How to delete or activate the deletion flag for the sales order line item

    Hi All,
    I  have one Cust order & with referance to that cust order one production order is created . The production order user has done the Goods issue with 261 movement type  & GR wi 101 before 4 months back , & he has reverse  the GR  with 102 on todays date . but in materila master the  variable prize is maintain thats why it is showing  a differance in the cost .
    User want to delete the Production order as well as the custemer order From MDO4 , So we have make the Production order TECO & save , it is gone form the MD04 but the Custumer order still there . It is not allow us to cancell or reject . We have tried to maintain the reason for rejection but it showing the message that you can not activate the deletion flag for the order .
    Could you please Help me to find out the way how can i delete the custemer order ?
    Thanks In advance
    Regards
    Piyush

    W ehave Settele that order & then activate the deletion flag for the order & then cancel the sales order.

  • Production order gets automat. deletion flag if a change in sales order hap

    Dear friends,
    I have the problem that there is a change in the sales order ( for example the customer) and then the already existing production order receives a deletion flag wich cannot be done undo.
    For example, we receive a request for a sales and we create a sales order. Afterwards, we will create the sales order with the customer who gave us the request. Then we can directly start with the Engineering, purchasing and so on. After a period of time, it happens that the "real" customer is know. So, each sales order line item will be deliverd to another customer. This can be relevant for the export control if the customers are located in different countries.
    At the time of adding or chanign the new customer and saving the already existing production order will receive the deletion flag.
    For me this situation is strange as I would not expect that the production order would receive a deletion flag only because a change in the sales order occurs.
    Can please anyone help!?
    Thank you very much,
    Bjoern

    Dear Friends,
    thank you very much.
    I found the problem and this is actually a funtionality comming from the export control checks. I forwarded this to our export control specialist as I dont see this as a production theme.
    The problem was, that the customer was changed and it was a different country. In this case the export control was activated and the online check was not sucsessfull. In this case a production is not allowed anymore and the system directly deletes the production order independing in which status the order is.
    Interesting function.
    Thank you all!

  • Production order gets automat. deletion flag if a change in sales order ha

    Dear friends,
    I have the problem that there is a change in the sales order ( for example the customer) and then the already existing production order receives a deletion flag wich cannot be done undo.
    For example, we receive a request for a sales and we create a sales order. Afterwards, we will create the sales order with the customer who gave us the request. Then we can directly start with the Engineering, purchasing and so on. After a period of time, it happens that the "real" customer is know. So, each sales order line item will be deliverd to another customer. This can be relevant for the export control if the customers are located in different countries.
    At the time of adding or chanign the new customer and saving the already existing production order will receive the deletion flag.
    For me this situation is strange as I would not expect that the production order would receive a deletion flag only because a change in the sales order occurs.
    Can please anyone help!?
    Thank you very much,
    Bjoern

    Dear Friends,
    thank you very much.
    I found the problem and this is actually a funtionality comming from the export control checks. I forwarded this to our export control specialist as I dont see this as a production theme.
    The problem was, that the customer was changed and it was a different country. In this case the export control was activated and the online check was not sucsessfull. In this case a production is not allowed anymore and the system directly deletes the production order independing in which status the order is.
    Interesting function.
    Thank you all!

  • How to stop deletion flag / indicator from being set in a PM order

    I want to put a check before a service order (PM Order) is set the deletion flag and the deletion indicator. How can I do it? Is there any user exit available for this? The purpose of this is to prevent it from getting archived before a given condition is met. Please advise.

    Some Enhancements (CMOD/SMOD) suitable
    - (PBO type) IWO10006 "Maint. order: Fcode exclusion through cust. enhancement" EXIT_SAPLCOIH_006) to disable function code "LVMS"
    - (AT SAVE type) IWO10009 "PM Order: Customer Check for 'Save' Event" (EXIT_SAPLCOIH_009) you can raise an error after some checks if caufvd_imp-loekz EQ 'X'.
    You could also use implicit enhancement points in FM CO_ZR_ACTIVATE_DELETE_FLAG or K_ORDER_CHECK.
    Regards,
    Raymond

  • Material type HAWA deletion flag

    HI experts ,
                           my requirement is when the creation of material master i want to update EAN and EAN Category Fields for material type HAWA  before this i will check is there any deletion flag for Material Type HAWA.where can i check weather it is checked for deletion or not?  In which table i wil check for this ?
    Thanks In advance
    Thanks & Regards
    Siva Krishna

    mm06

  • Logical delete flag in fixed assets extract

    I have to create a flat file of Fixed Assets data. I am asked to put the 'Logical Delete Flag' in it. My data will be based on the t.code AR01(report RABEST_ALV01). It uses the logical database ADA. My question is where can i find the logical delete flag and what does this field exactly mean?
    Plz reply soon

    I m closing this thread as I found the answer to it. An asset is never physically deleted in the system. But it can be marked for deletion(logical deletion).

  • How to close Purchase Order and mark to deletion flag.??

    Hi,
    We need to close all Open POs(For archiving, some old data) through a report.
    Considering .....
                       1. PO-GR-IR
    and              2. STO-Outboundelivery-PGI-IBD-PGR
    Checked few threads, though useful but still more information required.
    -> Preprocessing program for archiving standard object MM_EKKO 'RM06EV47' is  helpful.
    -> Example we have four POs p1,p2,p3 and p4.
    P1,p2 has deletion flag as 'L' so will be filtered out with
      SELECT ebeln    FROM  ekko INTO TABLE lt_sekko           
        WHERE ebeln  IN er_ebeln
          AND ekorg  IN er_ekorg
          AND bstyp  IN er_bstyp
          AND bedat  IN er_bedat
          AND bsart  IN er_bsart
          AND ekgrp  IN er_ekgrp
          AND loekz <> 'L'
          ORDER BY EBELN.
    For P3 has GR .
    P4 has to be marked for deletion flag.
    Regards
    Mohinder Singh

    Hi Thanks for the reply. I checked with that bapi too. I used  some part of standard code and then manipulated. Will shorty paste the code on to SDN as its general one and may be used by others.It still under testing.
    Edited by: Mohinder Singh Chauhan on Feb 20, 2009 4:07 AM

  • F110 - Error Msg "No payment due to delete flag or posting block"

    When I use F110 To auto payment a AP open item, the system show the message "Vendor <Vendor Code> <Company Code>: No payment due to delete flag or posting block" in job log.
    The AP open item information :
    amount 480.
    bline date : 2008/09/29
    payment term : immediate payment
    due date : 2008/09/29
    vendor payment method : E
    D : expense 480
       C : AP - <Vendor Code>  480
    The parameter in F110 :
    run date : 2008/11/10
    indentification : TEST
    Parameter :
    posting date 2008/11/10
    docs entered up to 2008/11/10
    company codes : <Company Code>
    pmt meths : E
    next p/date : 2008/11/11
    vendor codes : <Vendor Code>
    I don't understand the mean of "Vendor <Vendor Code> <Company Code>: No payment due to delete flag or posting block", how should I payment this AP open Item by F110.
    Best regards,

    Hi Eric,
    Seems like your vendor has been blocked at company code level for any further posting. Try and check with transaction code FK05 or XK05.
    If it's blocked then just unblocked it and then try run your payment run.
    Cheers
    Samir

  • Regarding purchase order header deletion flag indicator

    hi all,
    Right now in SAP PO header deletion flag has been set to X.
    so what i need is the PO should be flagged only at item level .
    how can i proceed?where can i find the deletion flag in the transaction screen?

    You can find in item overview (RM06E-LOEKZ)

  • BAPI to change purchase order to put deletion flag

    Hello Guru's,
            We are about to archive data & for that we need that according to date range all open purchase order ,open purchase requsitions & open RFQ should be marked for deletion.
    Is there some BAPI to do so.Please guide.

    *DELETING FLAG *
    REPORT ZMMR_DELETEPO NO STANDARD PAGE HEADING MESSAGE-ID zisb.
    tables : zvtls_sap.
    *C-- Types Declarations
    TYPES : BEGIN OF tp_flatfile_vtls,
            ebeln(10),
            ebelp type ekpo-ebelp,
            END OF tp_flatfile_vtls.
    *=====================================================================
                      INTERNAL TABLES DECLARATION
    *=====================================================================
    DATA:  t_flatfile_vtls TYPE tp_flatfile_vtls OCCURS 0 WITH HEADER LINE.
    data : begin of t_sapdata occurs 0,
           po like zvtls_sap-posap,
           item like zvtls_sap-itemsap,
           end of t_sapdata.
    data : begin of t_flatfile_vtls1 occurs 0,
           po(10),
           item like zvtls_sap-itemsap,
           end of t_flatfile_vtls1.
    data : begin of t_update occurs 0,
           mandt like zvtls_sap-mandt,
           povtls like zvtls_sap-povtls,
           itemvtls like zvtls_sap-itemvtls,
           posap like zvtls_sap-posap,
           itemsap like zvtls_sap-itemsap,
           aedat like zvtls_sap-aedat,
           paedt like zvtls_sap-paedt,
           loekz like zvtls_sap-loekz,
           end of t_update.
    data : begin of t_poheader occurs 0,
           po like zvtls_sap-posap,
           end of t_poheader.
    data : begin of t_poitem occurs 0,
           po like zvtls_sap-posap,
           item like zvtls_sap-itemsap,
           end of t_poitem.
    DATA : BEGIN OF T_MESSAGE OCCURS 0,
           MSGTY,
           MSGID(2),
           MSGNO(3),
           MSGTX(100),
           PO like zvtls_sap-povtls,
           item like zvtls_sap-itemvtls,
           END OF T_MESSAGE.
    DATA : BEGIN OF t_bapi_poheader OCCURS 0.
            INCLUDE STRUCTURE bapimepoheader.
    DATA : END OF t_bapi_poheader.
    DATA : BEGIN OF t_bapi_poheaderx OCCURS 0.
            INCLUDE STRUCTURE bapimepoheaderx.
    DATA : END OF t_bapi_poheaderx.
    DATA : BEGIN OF t_bapi_poitem OCCURS 0.
            INCLUDE STRUCTURE bapimepoitem.
    DATA : END OF t_bapi_poitem.
    DATA : BEGIN OF t_bapi_poitemx OCCURS 0.
            INCLUDE STRUCTURE bapimepoitemx.
    DATA : END OF t_bapi_poitemx.
    DATA : BEGIN OF t_bapireturn OCCURS 0.
            INCLUDE STRUCTURE bapiret2.
    DATA : END OF t_bapireturn.
    *=====================================================================
                      V A R I A B L E S
    *=====================================================================
    DATA: w_success(6)  TYPE n,
          w_bklas like t023-bklas,
          w_curryear(4),
          w_begda like sy-datum,
          w_endda like sy-datum,
          w_begyr(4),
          w_endyr(4),
          w_currmon(2),
          w_assetclass like ankt-anlkl,
          w_price type p,
          w_recordsap type i,
          w_povtls(10),
          w_count type i.
    DATA:  w_filepath TYPE rlgrap-filename,
           w_rc TYPE sy-subrc,
           w_sscrfields_ucomm1   TYPE sscrfields-ucomm,
           w_file1 TYPE string,
           w_file2 TYPE FILENAME-FILEINTERN.
    *=====================================================================
                      C O N S T A N T S
    *=====================================================================
    CONSTANTS: c_x              TYPE  c         VALUE 'X',
               c_hyp            TYPE  c         VALUE '-',
               c_err            TYPE  bdc_mart  VALUE 'E'.
    CONSTANTS:  c_slash(1)            TYPE c VALUE '/',
                c_hash(1)             TYPE c VALUE '#',
                c_pipe                TYPE c VALUE '|',
                c_1                   TYPE i VALUE 1,
                c_zero                TYPE n VALUE '0',
                c_rg1(3)              TYPE c VALUE 'rg1',
                c_gr3(3)              TYPE c VALUE 'GR3',
                c_gr2(3)              TYPE c VALUE 'GR2',
                c_e(1)                TYPE c VALUE 'E',
                c_filepath(8)         TYPE c VALUE '/interf/',
                c_filetype(10)        TYPE c VALUE 'ASC'.
    CONSTANTS : c_bapimepoheaderx   TYPE x030l-tabname
                                   VALUE 'bapimepoheaderx',
               c_bapimepoitem      TYPE  x030l-tabname
                                   VALUE 'bapimepoitem',
               c_bapimepoaccount   TYPE  x030l-tabname
                                   VALUE 'bapimepoaccount',
               c_t_bapi_poheader(15)        TYPE c
                                            VALUE 't_bapi_poheader',
               c_t_bapi_poitem(13)          TYPE c
                                            VALUE 't_bapi_poitem',
               c_t_bapi_poitemx(14)         TYPE c
                                            VALUE 't_bapi_poitemx',
               c_t_bapi_poheaderx(16)       TYPE c
                                            VALUE 't_bapi_poheaderx'.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    CONSTANTS:con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *======================================================================
                           SELECTION SCREEN
    *======================================================================
    SELECTION-SCREEN BEGIN OF BLOCK inputpath WITH FRAME TITLE text-001.
    SELECTION-SCREEN : BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS : p_fore RADIOBUTTON GROUP rg1
                        USER-COMMAND pc,
                 p_back RADIOBUTTON GROUP rg1 DEFAULT 'X'.
    SELECTION-SCREEN : END OF BLOCK blk2.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-003.
    PARAMETERS :  p_file1 LIKE rlgrap-filename OBLIGATORY MODIF ID gr2.
    PARAMETERS :  p_afile1 LIKE rlgrap-filename OBLIGATORY MODIF ID gr3.
    SELECTION-SCREEN : END OF BLOCK blk1.
    SELECTION-SCREEN END OF BLOCK inputpath.
    *C-- Initialization Event
    INITIALIZATION.
      CLEAR w_filepath.
      CONCATENATE c_filepath sy-sysid c_slash sy-mandt c_slash INTO
      w_filepath.
      CONDENSE w_filepath NO-GAPS.
      p_file1 = text-008.
      p_afile1 = text-009.
    *======================================================================
                           SELECTION SCREEN EVENTS
    *======================================================================
    *C-- Selection Screen Output
    AT SELECTION-SCREEN OUTPUT.
      IF p_fore = c_x.
        w_sscrfields_ucomm1 = space.
      ELSE.
        w_sscrfields_ucomm1 = c_rg1.
      ENDIF.
      LOOP AT SCREEN.
    *C--Modify selection screen if presentation
    *C--or application server radio button is chosen
        IF w_sscrfields_ucomm1 = space.
          IF screen-group1 = c_gr3.
            screen-active = c_zero.
          ENDIF.
        ELSE.
          IF screen-group1 = c_gr2.
            screen-active = c_zero.
          ENDIF.
        ENDIF.
        if screen-name = 'P_AFILE1'.
          screen-input = 0.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    *C-- Selection Screen VALUE-REQUEST FOR File path
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      IF p_fore EQ c_x.
        CALL FUNCTION 'F4_FILENAME'
          EXPORTING
            program_name  = syst-cprog
            dynpro_number = syst-dynnr
          IMPORTING
            file_name     = p_file1.
      ENDIF.
    *C-- At Start of the Selection Process
    START-OF-SELECTION.
      IF p_fore EQ c_x.
        w_file1 = p_file1.
      ELSE.
        w_file2 = p_afile1.
      ENDIF.
      IF p_fore EQ c_x. " Presentaion Server
    *C--Validations for the input files
        PERFORM validate_pre_file USING p_file1.
    *C-- Load the contents of the input file into the internal table
        PERFORM upload_file TABLES t_flatfile_vtls
                            USING w_file1
                            CHANGING w_rc.
        IF w_rc <> 0.
          MESSAGE s006 DISPLAY LIKE c_e.
        ENDIF.
      ELSE. " Application Server
    *C--Validations for the input files
        PERFORM validate_app_file USING  w_file2.
    *C-- Load the contents of the input file into the internal table
        PERFORM upload_file_app TABLES t_flatfile_vtls
                                USING w_file2
                                CHANGING w_rc.
      ENDIF.
      loop at t_flatfile_vtls.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = t_flatfile_vtls-ebeln
          IMPORTING
            output = t_flatfile_vtls1-po.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = t_flatfile_vtls-ebelp
          IMPORTING
            output = t_flatfile_vtls1-item.
        append t_flatfile_vtls1.
        clear t_flatfile_vtls1.
      endloop.
      perform get_podata.
      loop at t_poheader.
        perform move_to_bapi.
        perform call_bapi.
      endloop.
      PERFORM STORE_MESSAGES TABLES T_MESSAGE.
    *&      Form  validate_pre_file
        Routine to validate presentation server file path.
         -->fp_name  text
    FORM validate_pre_file USING fp_name TYPE rlgrap-filename.
      DATA : l_result,
             l_filename TYPE string.
      l_filename = fp_name.
      CLEAR l_result.
      CALL METHOD cl_gui_frontend_services=>file_exist
        EXPORTING
          file                 = l_filename
        RECEIVING
          result               = l_result
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
      IF sy-subrc <> 0.
        MESSAGE s007 DISPLAY LIKE c_e.
        LEAVE LIST-PROCESSING.
      ELSEIF l_result IS INITIAL.
        MESSAGE s008 DISPLAY LIKE c_e.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " validate_pre_file_hdr
    *&      Form  validate_app_file
          text - Checks if the path entered and filename is correct
    FORM validate_app_file USING  fp_file  TYPE FILENAME-FILEINTERN.
      data : l_fname(60).
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          LOGICAL_FILENAME = FP_FILE
          OPERATING_SYSTEM = SY-OPSYS
        IMPORTING
          FILE_NAME        = L_FNAME
        EXCEPTIONS
          FILE_NOT_FOUND   = 1
          OTHERS           = 2.
      IF SY-SUBRC = '0'.
        OPEN DATASET  L_FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc NE 0.
          MESSAGE s007 DISPLAY LIKE c_e.
        ELSE.
          CLOSE DATASET l_fname.
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_app_file
    *&      Form  upload_file
          Routine to upload data from file to tables.
         -->P_fp_flatfile
         -->P_fp_file
         <--P_fp_rc
    FORM  upload_file TABLES   fp_flatfile
                      USING    fp_file TYPE string
                      CHANGING fp_rc TYPE sy-subrc.
      IF fp_flatfile[] IS INITIAL.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                = fp_file
            filetype                = c_filetype
            has_field_separator     = c_x
          TABLES
            data_tab                = fp_flatfile
          EXCEPTIONS
            file_open_error         = 1
            file_read_error         = 2
            no_batch                = 3
            gui_refuse_filetransfer = 4
            invalid_type            = 5
            no_authority            = 6
            unknown_error           = 7
            bad_data_format         = 8
            header_not_allowed      = 9
            separator_not_allowed   = 10
            header_too_long         = 11
            unknown_dp_error        = 12
            access_denied           = 13
            dp_out_of_memory        = 14
            disk_full               = 15
            dp_timeout              = 16
            OTHERS                  = 17.
        MOVE sy-subrc TO fp_rc.
      ENDIF.
    ENDFORM.  " upload_file
    *&      Form  upload_file_app
          text
         -->FP_FLATFILEtext
         -->FP_FILE    text
         -->FP_RC      text
    FORM  upload_file_app TABLES   fp_flatfile
                          USING    fp_file TYPE FILENAME-FILEINTERN
    CHANGING fp_rc TYPE sy-subrc.
      DATA: l_string TYPE tedata-data.
      DATA: wa_data_file TYPE tp_flatfile_vtls,
            l_wllength TYPE i,
            FNAME(60).
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          LOGICAL_FILENAME = FP_FILE
          OPERATING_SYSTEM = SY-OPSYS
        IMPORTING
          FILE_NAME        = FNAME
        EXCEPTIONS
          FILE_NOT_FOUND   = 1
          OTHERS           = 2.
      IF SY-SUBRC = 0.
        OPEN DATASET  FNAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc NE 0.
    *C-- commented by Bikash
         MESSAGE s107(yaero_ps) DISPLAY LIKE c_e.
          message e008.
        ELSE.
          DO.
            CLEAR: l_string.
            READ DATASET  FNAME INTO l_string LENGTH l_wllength.
            IF sy-subrc NE 0.
              EXIT.
            ELSE.
              SPLIT l_string AT con_tab INTO   wa_data_file-ebeln
                                               wa_data_file-ebelp.
              APPEND wa_data_file TO fp_flatfile.
            ENDIF.
          ENDDO.
          CLOSE DATASET  FNAME.
        ENDIF.
      ENDIF.
    ENDFORM.  " upload_file_app
    *&      Form  get_podata
          text
    form get_podata.
      select *
      into table t_update
      from zvtls_sap
      for all entries in t_flatfile_vtls1
       where itemvtls = t_flatfile_vtls1-item
      and povtls = t_flatfile_vtls1-po.
      sort t_update by posap itemsap.
      loop at t_update.
        at new posap.
          t_poheader-po = t_update-posap.
          append t_poheader.
          clear t_poheader.
        endat.
        t_poitem-po = t_update-posap.
        t_poitem-item = t_update-itemsap.
        append t_poitem.
        clear t_poitem.
        t_update-paedt = sy-datum.
        t_update-loekz = 'X'.
        modify t_update.
      endloop.
      modify zvtls_sap from table t_update.
    endform.                    "get_podata
    *&      Form  move_to_bapi
          text
    form move_to_bapi.
      t_bapi_poheader-po_number = t_poheader-po.
      CLEAR t_bapi_poheaderx.
      PERFORM fill_check_structure USING c_bapimepoheaderx
                                         c_t_bapi_poheader
                                         c_t_bapi_poheaderx
                                         c_x.
      refresh : t_bapi_poitem,t_bapi_poitemx.
      loop at t_poitem where po = t_poheader-po.
        clear t_bapi_poitem.
        t_bapi_poitem-po_item = t_poitem-item.
        t_bapi_poitem-delete_ind = 'X'.
        CLEAR t_bapi_poitemx.
        PERFORM fill_check_structure USING c_bapimepoitem
                                           c_t_bapi_poitem
                                           c_t_bapi_poitemx
                                           c_x.
        t_bapi_poitemx-po_item = t_poitem-item.
        t_bapi_poitemx-po_itemx = c_x.
        APPEND t_bapi_poitem.
        APPEND t_bapi_poitemx.
        clear t_bapi_poitem.
        clear t_bapi_poitemx.
      endloop.
    endform.                    "move_to_bapi
    *&      Form  call_bapi
          This form Routine is used to commit the data records
    FORM call_bapi .
      DATA : l_msgty      TYPE c,
             l_msgid(2)   TYPE c,
             l_msgno(3)   TYPE c,
             l_msgtx(100) TYPE c,
             l_errflag    TYPE c.
      CLEAR: t_bapireturn.
      REFRESH: t_bapireturn.
      *CALL FUNCTION 'BAPI_PO_CHANGE'*
        EXPORTING
          PURCHASEORDER = T_POHEADER-PO
          POHEADER      = T_BAPI_POHEADER
          POHEADERX     = T_BAPI_POHEADERX
        TABLES
          RETURN        = T_BAPIRETURN
          POITEM        = T_BAPI_POITEM
          POITEMX       = T_BAPI_POITEMX.
      READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.
      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_x.
      ENDIF.
    *C-- Write messages
      WRITE: / 'PO Number', t_poheader-po.
      clear : t_update,w_povtls.
      read table t_update with key posap = t_poheader-po.
      w_povtls = t_update-povtls.
      CLEAR l_errflag.
      LOOP AT t_bapireturn.
        CLEAR: l_msgty, l_msgid, l_msgno, l_msgtx.
        l_msgty = t_bapireturn-type.
        l_msgid = t_bapireturn-id.
        l_msgno = t_bapireturn-number.
        l_msgtx = t_bapireturn-message.
        WRITE: / l_msgty, l_msgid, l_msgno, l_msgtx.
        if l_msgtx cs t_poheader-po.
          w_count = w_count + 1.
          loop at t_update.
            if sy-tabix = w_count.
              t_message-item = t_update-itemvtls.
            endif.
          endloop.
        endif.
        t_message-msgty = l_msgty.
        t_message-msgid = l_msgid.
        t_message-msgno = l_msgno.
        t_message-msgtx = l_msgtx.
        t_message-po = w_povtls.
        append t_message.
        clear t_message.
        IF l_msgty EQ c_err.
          l_errflag = c_x.
        ENDIF.    " l_msgty EQ 'E'
      ENDLOOP.
      ULINE.
      IF l_errflag NE c_x.
        w_success = w_success + 1.
      ENDIF.    " l_errflag NE C_X
    endform.                    "call_bapi
    *&      Form  fill_check_structure
          This form Routine will check whether the specified structure
          exist/active
    FORM fill_check_structure  USING    fp_tabname TYPE any
                                        fp_orgtabname TYPE any
                                        fp_chktabname TYPE any
                                        fp_check TYPE c.
      FIELD-SYMBOLS : <fs_chk>, <fs_org>.
      DATA:    l_char1(61)  TYPE c,
               l_char2(61)  TYPE c.
      DATA:    BEGIN OF tl_nametab OCCURS 60.
              INCLUDE STRUCTURE x031l.
      DATA:    END OF tl_nametab.
      REFRESH tl_nametab.
      CALL FUNCTION 'RFC_GET_NAMETAB'
        EXPORTING
          tabname          = fp_tabname
        TABLES
          nametab          = tl_nametab
        EXCEPTIONS
          table_not_active = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
        CLEAR tl_nametab.
      ENDIF.
      LOOP AT tl_nametab.
        CLEAR: l_char1, l_char2.
        CONCATENATE fp_chktabname c_hyp tl_nametab-fieldname INTO l_char1.
        ASSIGN (l_char1) TO <fs_chk>.
        CONCATENATE fp_orgtabname c_hyp tl_nametab-fieldname INTO l_char2.
        ASSIGN (l_char2) TO <fs_org>.
        IF <fs_org> IS NOT INITIAL.
          <fs_chk> = fp_check.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " fill_check_structure
    *&      Form  STORE_MESSAGES
          text
         -->FP_MESSAGEStext
    FORM STORE_MESSAGES TABLES FP_MESSAGES STRUCTURE T_MESSAGE.
      DATA: wl_output_data LIKE t_MESSAGE.
      DATA: l_catstr TYPE string.
      DATA: l_fieldvalue TYPE string.
      DATA: l_index TYPE i VALUE 1.
      DATA: L_FNAME(60).
      FIELD-SYMBOLS <fs>.
      CLEAR l_catstr.
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          LOGICAL_FILENAME = '/USR/SAP/VTLS/POCHANGE/LOG'
          OPERATING_SYSTEM = SY-OPSYS
        IMPORTING
          FILE_NAME        = L_FNAME
        EXCEPTIONS
          FILE_NOT_FOUND   = 1
          OTHERS           = 2.
      IF SY-SUBRC = '0'.
        IF fp_messages[] IS NOT INITIAL.
          OPEN DATASET L_FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
          IF sy-subrc NE 0.
            LEAVE LIST-PROCESSING.
          ELSE.
            LOOP AT fp_messages INTO wl_output_data.
              DO.
               ASSIGN COMPONENT l_index OF STRUCTURE wl_output_data TO <fs>.
                IF sy-subrc <> 0.
                  EXIT.
                ENDIF.
                MOVE <fs> TO l_fieldvalue.
                IF l_catstr IS NOT INITIAL.
                  CONCATENATE l_catstr l_fieldvalue INTO l_catstr SEPARATED
                  BY con_tab.
                ELSE.
                  MOVE l_fieldvalue TO l_catstr.
                ENDIF.
                l_index = l_index + c_1.
                CLEAR l_fieldvalue.
                CLEAR <fs>.
              ENDDO.
              l_index = c_1.
              TRANSFER l_catstr TO L_FNAME .
              CLEAR wl_output_data.
              CLEAR l_catstr.
            ENDLOOP.
            CLOSE  DATASET L_FNAME.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "STORE_MESSAGES

Maybe you are looking for