<?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: Inserting data into Ztable in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651782#M879540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gulrez ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are many approaches to the query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) You can use Reports or use module programming&lt;/P&gt;&lt;P&gt;in Se38 you need to create a program which is of type "Executable" for a report  or "module pool" for module pool programming&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you are doing report&lt;/P&gt;&lt;P&gt;you need to create a selection screen for user to enter all values on the screen for which ever fields of the Ztable you need to insert....don't forget to create input for all the key fields of the ztable without fail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : workarea type Ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen:begin of block b1.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX1 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX2 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX3 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;For mandatory fields' add obligatory at the end&lt;/P&gt;&lt;P&gt;parameters : P_XXXX4 type  ZTABLE-FIELDNAME obligatory.&lt;/P&gt;&lt;P&gt;selection-screen:end of block b1.&lt;/P&gt;&lt;P&gt;start-of selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do validation for the fields separately if you need(if they are not mentioned as obligatory on top)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If P_XXXX1 is initial.&lt;/P&gt;&lt;P&gt;Message 'Enter the field' type 'S'.&lt;/P&gt;&lt;P&gt;Exit.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;*update the table&lt;/P&gt;&lt;P&gt;Fist pass all the fields to a work area&lt;/P&gt;&lt;P&gt;workarea-field1 = p_XXXX1.&lt;/P&gt;&lt;P&gt;workarea-field2 = p_XXXX2.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;then update the table from workare &lt;/P&gt;&lt;P&gt;MODIFY Ztable FROM workarea.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;Message 'Database updated successfully' type 'S'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;Message 'Update Failed' type 'S'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This technique is used if you need to insert records 1 by 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To insert multipe records at the same time you can use modulepool programming with a table control or ALV to fetch user input and save data from user to Ztable&lt;/P&gt;&lt;P&gt;Please refer the sample program code in SE38 for a feel of the same program : "demo_dynpro_tabcont_loop_at"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls check and revert if more help is needed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Apr 2008 12:01:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-20T12:01:40Z</dc:date>
    <item>
      <title>Inserting data into Ztable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651780#M879538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All, &lt;/P&gt;&lt;P&gt;              Plz tell me how to insert data into ztable through SE38 program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz tell me the syntax.  It's very urgent. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking forward to your earliest response. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gulrez Alam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Apr 2008 10:29:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651780#M879538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-20T10:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data into Ztable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651781#M879539</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;Define an internal table with the type of ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and use below syntax,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;insert ztable from itab.&lt;/P&gt;&lt;P&gt;clear itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*********&lt;/P&gt;&lt;P&gt;Please reward if it is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhanu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Apr 2008 11:18:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651781#M879539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-20T11:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data into Ztable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651782#M879540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gulrez ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are many approaches to the query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) You can use Reports or use module programming&lt;/P&gt;&lt;P&gt;in Se38 you need to create a program which is of type "Executable" for a report  or "module pool" for module pool programming&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you are doing report&lt;/P&gt;&lt;P&gt;you need to create a selection screen for user to enter all values on the screen for which ever fields of the Ztable you need to insert....don't forget to create input for all the key fields of the ztable without fail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : workarea type Ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen:begin of block b1.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX1 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX2 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;parameters : P_XXXX3 type  ZTABLE-FIELDNAME.&lt;/P&gt;&lt;P&gt;For mandatory fields' add obligatory at the end&lt;/P&gt;&lt;P&gt;parameters : P_XXXX4 type  ZTABLE-FIELDNAME obligatory.&lt;/P&gt;&lt;P&gt;selection-screen:end of block b1.&lt;/P&gt;&lt;P&gt;start-of selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do validation for the fields separately if you need(if they are not mentioned as obligatory on top)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;If P_XXXX1 is initial.&lt;/P&gt;&lt;P&gt;Message 'Enter the field' type 'S'.&lt;/P&gt;&lt;P&gt;Exit.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;*update the table&lt;/P&gt;&lt;P&gt;Fist pass all the fields to a work area&lt;/P&gt;&lt;P&gt;workarea-field1 = p_XXXX1.&lt;/P&gt;&lt;P&gt;workarea-field2 = p_XXXX2.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;then update the table from workare &lt;/P&gt;&lt;P&gt;MODIFY Ztable FROM workarea.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;Message 'Database updated successfully' type 'S'.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;Message 'Update Failed' type 'S'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This technique is used if you need to insert records 1 by 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To insert multipe records at the same time you can use modulepool programming with a table control or ALV to fetch user input and save data from user to Ztable&lt;/P&gt;&lt;P&gt;Please refer the sample program code in SE38 for a feel of the same program : "demo_dynpro_tabcont_loop_at"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls check and revert if more help is needed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Byju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Apr 2008 12:01:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651782#M879540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-20T12:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Inserting data into Ztable</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651783#M879541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gulrez,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where are your data comming from?&lt;/P&gt;&lt;P&gt;If from the presentation server then use&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                         = presentaion file
*   FILETYPE                      = 'ASC'
:
:
* IMPORTING
*   FILELENGTH                  =
*   HEADER                        =
  tables
    data_tab                         = itab == your ztable structure
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
:
*   OTHERS                                 = 17
          .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After that simply call&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;UPDATE ztable FROM TABLE itab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are taking the data from the application server you have to read the records sequentially into your internal table via &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;OPEN DATASET ...... and READ ....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; and then perform the same UPDATE statement as in case of GUI_UPLOAD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Heinz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Apr 2008 06:14:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inserting-data-into-ztable/m-p/3651783#M879541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-21T06:14:39Z</dc:date>
    </item>
  </channel>
</rss>

