<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Validating Fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145274#M452413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use the form exit provided in include &amp;lt;b&amp;gt;MV45AFZZ&amp;lt;/b&amp;gt;. Implement your code in the form &amp;lt;b&amp;gt;userexit_save_document&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Apr 2007 00:59:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-03T00:59:00Z</dc:date>
    <item>
      <title>Validating Fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145272#M452411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;Please tell how to do the &lt;/P&gt;&lt;P&gt;BADI for validating the fields for creating sales order (BADI_SD_SALES_ITEM and BADI_SD_SALES_BASIC)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 17:56:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145272#M452411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T17:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Validating Fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145273#M452412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The BADI BADI_SD_SALES_ITEM is designed as internal BADI; the implementation can only be done, if the BADI is set to external. The property of a BADI is stored in the table sxs_attr. The flag internal must be cleared to use the BADI as external. The following short program will show you an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  z_xpra_upd_badi_def.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;data: gt_prot          type table of sprot_u,&lt;/P&gt;&lt;P&gt;      gs_prot          type sprot_u,&lt;/P&gt;&lt;P&gt;      gv_simulate      type xflag.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Constant Definitions for Protocoll:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;constants:&lt;/P&gt;&lt;P&gt;      gc_error_fatal   value 'E',      " Error message with stop_upgrade&lt;/P&gt;&lt;P&gt;      gc_error         value 'P',      " Error message: no prod use!&lt;/P&gt;&lt;P&gt;      gc_success       value space,    " Success&lt;/P&gt;&lt;P&gt;      gc_info          value space,    " Info&lt;/P&gt;&lt;P&gt;      gc_warning       value 'W',      " Warning&lt;/P&gt;&lt;P&gt;      gc_lv_error      type n value 2, " Level for type 'E'&lt;/P&gt;&lt;P&gt;      gc_lv_add_error  type n value 2, " Level for additional info&lt;/P&gt;&lt;P&gt;      gc_lv_warning    type n value 2, " This could be either 2 or 3&lt;/P&gt;&lt;P&gt;      gc_lv_success    type n value 3, " Success only at 3&lt;/P&gt;&lt;P&gt;      gc_lv_info       type n value 4, " Info-messages only at 3 or 4&lt;/P&gt;&lt;P&gt;      gc_lv_debug      type n value 4. " Additional info for yourself&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  gv_simulate = space.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  perform bc_action using 'BADI_SD_SALES_ITEM'&lt;/P&gt;&lt;P&gt;                           gv_simulate.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Finally, the transport protocol will be added:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  call function 'TR_APPEND_LOG'&lt;/P&gt;&lt;P&gt;    tables&lt;/P&gt;&lt;P&gt;      xmsg   = gt_prot&lt;/P&gt;&lt;P&gt;    exceptions&lt;/P&gt;&lt;P&gt;      others = 5.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  call function 'TR_FLUSH_LOG'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;END OF PROGRAM&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  bc_action&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Function description/flow&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Used global variables:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Read/Write&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form bc_action using li_badi_def   type sxs_attr-exit_name&lt;/P&gt;&lt;P&gt;                     li_simulate   type xflag.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  data: ls_sxs_attr type sxs_attr.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  select single * into ls_sxs_attr&lt;/P&gt;&lt;P&gt;         from sxs_attr client specified&lt;/P&gt;&lt;P&gt;         where exit_name = li_badi_def.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    if not ls_sxs_attr-internal is initial.&lt;/P&gt;&lt;P&gt;      if gv_simulate is initial.&lt;/P&gt;&lt;P&gt;        clear ls_sxs_attr-internal.&lt;/P&gt;&lt;P&gt;        update sxs_attr client specified&lt;/P&gt;&lt;P&gt;        from ls_sxs_attr.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        perform bc_append_log using gc_lv_success&lt;/P&gt;&lt;P&gt;                                    gc_success&lt;/P&gt;&lt;P&gt;                                   '5@'&lt;/P&gt;&lt;P&gt;                                   '000'&lt;/P&gt;&lt;P&gt;                                    li_badi_def&lt;/P&gt;&lt;P&gt;                                    text-001&lt;/P&gt;&lt;P&gt;                                    sy-dbcnt&lt;/P&gt;&lt;P&gt;                                    space.&lt;/P&gt;&lt;P&gt;      else.&lt;/P&gt;&lt;P&gt;        perform bc_append_log using gc_lv_error&lt;/P&gt;&lt;P&gt;                                    gc_error&lt;/P&gt;&lt;P&gt;                                   '5@'&lt;/P&gt;&lt;P&gt;                                   '000'&lt;/P&gt;&lt;P&gt;                                    li_badi_def&lt;/P&gt;&lt;P&gt;                                    text-002&lt;/P&gt;&lt;P&gt;                                    sy-subrc&lt;/P&gt;&lt;P&gt;                                    space.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      perform bc_append_log using gc_lv_success&lt;/P&gt;&lt;P&gt;                                  gc_success&lt;/P&gt;&lt;P&gt;                                 '5@'&lt;/P&gt;&lt;P&gt;                                 '000'&lt;/P&gt;&lt;P&gt;                                  li_badi_def&lt;/P&gt;&lt;P&gt;                                  text-003&lt;/P&gt;&lt;P&gt;                                  space&lt;/P&gt;&lt;P&gt;                                  space.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    perform bc_append_log using gc_lv_success&lt;/P&gt;&lt;P&gt;                                gc_success&lt;/P&gt;&lt;P&gt;                               '5@'&lt;/P&gt;&lt;P&gt;                               '000'&lt;/P&gt;&lt;P&gt;                                li_badi_def&lt;/P&gt;&lt;P&gt;                                text-004&lt;/P&gt;&lt;P&gt;                                space&lt;/P&gt;&lt;P&gt;                                space.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;endform.                    "ACTION&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  bc_append_log&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Function description/flow&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Used global variables:&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Read/Write&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form bc_append_log using li_level    type sprot_u-level    " Level&lt;/P&gt;&lt;P&gt;                         li_severity type sprot_u-severity " Severity&lt;/P&gt;&lt;P&gt;                         li_ag       type sprot_u-ag       " Message-ID&lt;/P&gt;&lt;P&gt;                         li_msgnr    type sprot_u-msgnr    " Messagenumb&lt;/P&gt;&lt;P&gt;                         li_var1&lt;/P&gt;&lt;P&gt;                         li_var2&lt;/P&gt;&lt;P&gt;                         li_var3&lt;/P&gt;&lt;P&gt;                         li_var4.&lt;/P&gt;&lt;P&gt;  clear gs_prot.&lt;/P&gt;&lt;P&gt;  gs_prot-level    = li_level.&lt;/P&gt;&lt;P&gt;  gs_prot-severity = li_severity.&lt;/P&gt;&lt;P&gt;  gs_prot-langu    = sy-langu.&lt;/P&gt;&lt;P&gt;  gs_prot-ag       = li_ag.&lt;/P&gt;&lt;P&gt;  gs_prot-msgnr    = li_msgnr.&lt;/P&gt;&lt;P&gt;  gs_prot-newobj   = space.&lt;/P&gt;&lt;P&gt;  gs_prot-var1     = li_var1.&lt;/P&gt;&lt;P&gt;  gs_prot-var2     = li_var2.&lt;/P&gt;&lt;P&gt;  gs_prot-var3     = li_var3.&lt;/P&gt;&lt;P&gt;  gs_prot-var4     = li_var4.&lt;/P&gt;&lt;P&gt;  append gs_prot to gt_prot.&lt;/P&gt;&lt;P&gt;endform.                    " bc_bc_append_log&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This report can be used as XPRA run; for this you need to assign this report in a transport with property object type XPRA. After importing the transport the report will be started automatically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please handle this proposal solution carefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found an approach for a solution; I'd like to provide you this solution in the following short summary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definition BADI_SD_SALES_ITEM, Method ITEM_PROCESS&lt;/P&gt;&lt;P&gt;&amp;#149; To set up the serial numbers to be assigned, first, you need a kind of buffer, in which the serial number get be transferred from outside to the function group 2032. I use the export/import memory function (export [parameter] from ti id 'MEMORY_NAME&amp;#146;) to get/set the serial numbers.&lt;/P&gt;&lt;P&gt;&amp;#149; Next, I read the already assigned serial numbers from the tables SER02 and OBJK.&lt;/P&gt;&lt;P&gt;&amp;#149; Then I merge the imported serial numbers with the actual serial numbers in DB to decide for deletions and inserts&lt;/P&gt;&lt;P&gt;&amp;#149; Based on the prior selected serial numbers I call the corresponding function modules to delete or insert the serial numbers (in buffer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Process Serial Numbers (Deletion):&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at lt_serial_no_ins assigning &amp;lt;serial_no&amp;gt;.&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;        call function 'SERNR_DEL_FROM_AU'&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            sernr                 = &amp;lt;serial_no&amp;gt;-serial_no&lt;/P&gt;&lt;P&gt;            material              = fvbap-matnr&lt;/P&gt;&lt;P&gt;            document              = fvbap-vbeln&lt;/P&gt;&lt;P&gt;            item                  = fvbap-posnr&lt;/P&gt;&lt;P&gt;          importing&lt;/P&gt;&lt;P&gt;            anzsn                 = fvbap-anzsn&lt;/P&gt;&lt;P&gt;            serial_commit         = lv_dataloss&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            serialnumber_errors   = 1&lt;/P&gt;&lt;P&gt;            serialnumber_warnings = 2&lt;/P&gt;&lt;P&gt;            others                = 3.&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Process Serial Numbers (Inserts):&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  loop at lt_serial_no_ins assigning &amp;lt;serial_no&amp;gt;.&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;        call function 'SERNR_ADD_TO_AU'&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            sernr                 = &amp;lt;serial_no&amp;gt;-serial_no&lt;/P&gt;&lt;P&gt;            profile               = fvbap-serail&lt;/P&gt;&lt;P&gt;            material              = fvbap-matnr&lt;/P&gt;&lt;P&gt;            quantity              = 1&lt;/P&gt;&lt;P&gt;            cuobj                 = fvbap-cuobj&lt;/P&gt;&lt;P&gt;            document              = fvbap-vbeln&lt;/P&gt;&lt;P&gt;            item                  = fvbap-posnr&lt;/P&gt;&lt;P&gt;            debitor               = ls_vbak-kunnr&lt;/P&gt;&lt;P&gt;            vbtyp                 = ls_vbak-vbtyp&lt;/P&gt;&lt;P&gt;            sd_auart              = ls_vbak-auart&lt;/P&gt;&lt;P&gt;            sd_postyp             = fvbap-pstyv&lt;/P&gt;&lt;P&gt;          importing&lt;/P&gt;&lt;P&gt;            anzsn                 = fvbap-anzsn&lt;/P&gt;&lt;P&gt;            serial_commit         = lv_dataloss&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            konfigurations_error  = 1&lt;/P&gt;&lt;P&gt;            serialnumber_errors   = 2&lt;/P&gt;&lt;P&gt;            serialnumber_warnings = 3&lt;/P&gt;&lt;P&gt;            others                = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;emdloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149; After this all the serial numbers are stored in the buffer of function group IPW1&lt;/P&gt;&lt;P&gt;&amp;#149; Next, the stored serial numbers in IPW1 will be posted by the post process, this will be done also by a BadI (see Next)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definition BADI_SD_SALES, Method SAVE_DOCUMENT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Using Check Handling with Operation SDAP for Update:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          call function 'SERIALPROFILE_CHECK'&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              operation = 'SDAP'&lt;/P&gt;&lt;P&gt;            tables&lt;/P&gt;&lt;P&gt;              tab_cuobj = lt_dbcuobj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use the above mentioned BadIs, you have to consider the following:&lt;/P&gt;&lt;P&gt;&amp;#149; The Badis are provided with package VA_BADI&lt;/P&gt;&lt;P&gt;&amp;#149; This BadIs are all internally&lt;/P&gt;&lt;P&gt;&amp;#149; To use / create a implementation you have to set the internal to external (Table SXS_ATTR, Field INTERNAL)&lt;/P&gt;&lt;P&gt;&amp;#149; The best way is to write a report, in which the flag will be set for definite BadIs, so this report can be link as XPRA in the transport request; for this you have to set the following additional entry in the transport request:&lt;/P&gt;&lt;P&gt;R3TR XPRA Z_GEMINI_XPRA_UPD_BADI_DEF &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helpfull reward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        sunil kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 23:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145273#M452412</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T23:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Validating Fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145274#M452413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use the form exit provided in include &amp;lt;b&amp;gt;MV45AFZZ&amp;lt;/b&amp;gt;. Implement your code in the form &amp;lt;b&amp;gt;userexit_save_document&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2007 00:59:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validating-fields/m-p/2145274#M452413</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-03T00:59:00Z</dc:date>
    </item>
  </channel>
</rss>

