<?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: Flat file validation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218572#M476029</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is your query resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Apr 2007 08:46:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-26T08:46:29Z</dc:date>
    <item>
      <title>Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218565#M476022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;In BDC ,we do validation of data in flat files before uploading data into SAP.&lt;/P&gt;&lt;P&gt;Can any body let me know about this with an example code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:28:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218565#M476022</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218566#M476023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk out the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_gui_frontend_services=&amp;gt;file_exist&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      file                 = p_path&lt;/P&gt;&lt;P&gt;    receiving&lt;/P&gt;&lt;P&gt;      RESULT               = l_bool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_path is the file path and l_bool returns whether file exists or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:29:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218566#M476023</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218567#M476024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope the above piece of code solves your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:31:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218567#M476024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218568#M476025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;we upload the flat file in a internal table in the program.&lt;/P&gt;&lt;P&gt;Then we can validates its various fields with respect to some standard or master or custom table or functional module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seee the validetion of asset class, company code and cost center below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT p_input_table INTO wa_input.

    CLEAR: l_anlkl,
           l_flag.

    g_no_read = g_no_read + 1.

* To pick up the asset class from the asset class file corresponding to the legacy class
    READ TABLE p_asset_table INTO wa_asset
           BINARY SEARCH WITH KEY lclass = wa_input-lclass.

    IF sy-subrc = 0.

      l_anlkl = wa_asset-anlkl.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = l_anlkl
        IMPORTING
          output = l_anlkl.

* To validate asset class
      CALL FUNCTION 'AM_ASSET_CLASS_READ'
        EXPORTING
          i_anlkl                = l_anlkl
        TABLES
          t_ankb                 = i_ankb
          t_ankv                 = i_ankv
        EXCEPTIONS
          klasse_nicht_vorhanden = 1
          i_anlkl_fehlt          = 2
          OTHERS                 = 3.

      IF sy-subrc &amp;lt;&amp;gt; 0.      " asset class not valid
        MOVE-CORRESPONDING wa_input TO wa_error_file.
        wa_error_file-mssg1 = text-028.
        l_flag = 'X'.
      ELSE.

        la_generaldata-assetclass = l_anlkl.
      ENDIF.

    ELSE.

      MOVE-CORRESPONDING wa_input TO wa_error_file.
      wa_error_file-mssg1 = text-071.
      l_flag = 'X'.
    ENDIF.


    CALL FUNCTION 'ZFAA_FORMAT_FIELDS'
      EXPORTING
        zinput  = wa_input-txt50
      IMPORTING
        zoutput = wa_input-txt50.

    CALL FUNCTION 'ZFAA_FORMAT_FIELDS'
      EXPORTING
        zinput  = wa_input-txa50
      IMPORTING
        zoutput = wa_input-txa50.





* To pick up the cost center from cost center file corresponding to legacy dept
    READ TABLE p_cost_table INTO wa_cost
           BINARY SEARCH WITH KEY ldept = wa_input-kostl.


    IF sy-subrc = 0.

* To validate company code
      READ TABLE p_t093c INTO wa_t093c BINARY SEARCH WITH KEY bukrs = wa_cost-bukrs.

      IF sy-subrc &amp;lt;&amp;gt; 0.      "company code not valid

        IF l_flag &amp;lt;&amp;gt; 'X'.
          MOVE-CORRESPONDING wa_input TO wa_error_file.
          l_flag = 'X'.
          wa_error_file-mssg1 = text-029.
        ELSE.
          CONCATENATE wa_error_file-mssg1 text-029
         INTO wa_error_file-mssg1 SEPARATED BY ','.
*        wa_error_file-mssg2 = text-029.
        ENDIF.
      ELSE.

        la_key-companycode  = wa_cost-bukrs.
      ENDIF.

* to validate cost centre
      READ TABLE p_csks INTO wa_csks BINARY SEARCH WITH KEY kostl = wa_cost-kostl.

      IF sy-subrc &amp;lt;&amp;gt; 0.     "cost center not valid

        IF l_flag &amp;lt;&amp;gt; 'X'.
          MOVE-CORRESPONDING wa_input TO wa_error_file.
          l_flag = 'X'.
          wa_error_file-mssg1 = text-030.
        ELSE.
          CONCATENATE wa_error_file-mssg1 text-030
          INTO wa_error_file-mssg1 SEPARATED BY ','.
        ENDIF.

*        wa_error_file-mssg3 = text-030.
      ELSE.

        la_timedependentdata-costcenter  = wa_cost-kostl.
        la_timedependentdata-plant       = wa_cost-werks.
        la_timedependentdata-location    = wa_cost-loc.
        la_timedependentdata-room        = wa_input-room.
        la_timedependentdatax-costcenter = 'X'.
        la_timedependentdatax-plant      = 'X'.
        la_timedependentdatax-location   = 'X'.
        la_timedependentdatax-room       = 'X'.
      ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:33:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218568#M476025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218569#M476026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;U can try like this....&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check whether the EBELN is related to that particular Company code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          IF NOT p_bukrs IS INITIAL.&lt;/P&gt;&lt;P&gt;            SELECT  SINGLE bukrs&lt;/P&gt;&lt;P&gt;                      FROM ekko&lt;/P&gt;&lt;P&gt;                      INTO ekko&lt;/P&gt;&lt;P&gt;                      WHERE bukrs EQ p_bukrs AND&lt;/P&gt;&lt;P&gt;                      ebeln = v_ebeln.&lt;/P&gt;&lt;P&gt;            IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;              wa_bdcindata-message = text-062.&lt;/P&gt;&lt;P&gt;              APPEND wa_bdcindata TO i_errdata_leg.&lt;/P&gt;&lt;P&gt;              CLEAR: wa_bdcindata,&lt;/P&gt;&lt;P&gt;                     wa_bdcindata_init.&lt;/P&gt;&lt;P&gt;              CONTINUE.&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:36:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218569#M476026</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218570#M476027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case the file is from presentation server then my above piece of code of will work else if it is from application server then use the foll code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  open dataset p_path for input in text mode encoding default.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    l_bool = ' '.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_path is the file path&lt;/P&gt;&lt;P&gt;and l_bool returns whether file is present or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it solves your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:40:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218570#M476027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218571#M476028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is your query not yet solved what is the problem you are facing.&lt;/P&gt;&lt;P&gt;from where are you hetting your file (appln server or presentation server)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 05:43:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218571#M476028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T05:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Flat file validation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218572#M476029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is your query resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Navneeth.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Apr 2007 08:46:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-validation/m-p/2218572#M476029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-26T08:46:29Z</dc:date>
    </item>
  </channel>
</rss>

