<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ABAP Tutorials &#187; function module</title>
	<atom:link href="http://www.abap-tutorials.com/tag/function-module/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abap-tutorials.com</link>
	<description>ABAP Tutorials, Guides, Training, Manuals</description>
	<lastBuildDate>Thu, 17 Nov 2011 07:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Display a Popup and Get Values from User</title>
		<link>http://www.abap-tutorials.com/2011/09/23/display-a-popup-and-get-values-from-user/</link>
		<comments>http://www.abap-tutorials.com/2011/09/23/display-a-popup-and-get-values-from-user/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 12:19:32 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Selection-Screen]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[function module]]></category>
		<category><![CDATA[get value from user]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[POPUP_GET_VALUES]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1948</guid>
		<description><![CDATA[In some cases, we are needed to get some inputs from the user at run-time of an application based on certain dynamic conditions. Function Module POPUP_GET_VALUES can be used to display a popup to get inputs from user. The specialty of this function module is we can add as many number of fields as we [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">In some cases, we are needed to get some inputs from the user at run-time of an application based on certain dynamic conditions.</p>
<p style="text-align: justify;">Function Module <strong>POPUP_GET_VALUES</strong> can be used to display a popup to get inputs from user. The specialty  of this function module is we can add as many number of fields as we  want. The fields can be of any data type.</p>
<div style="width: 100%; float: left;">
<p style="text-align: center;"><a href="http://www.abap-tutorials.com/wp-content/uploads/2011/09/popup.jpg"><img class="aligncenter size-full wp-image-1949" title="popup" src="http://www.abap-tutorials.com/wp-content/uploads/2011/09/popup.jpg" alt="popup" width="470" height="288" /></a></p>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span id="more-1948"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>REPORT  ztestpopup.</p>
<p>DATA: t_fields LIKE sval OCCURS 0 WITH HEADER LINE.</p>
<p>START-OF-SELECTION.</p>
<p>*&#8212; Prepare Parameters for FM &#8212;&#8212;&#8212;&#8212;-*<br />
t_fields-tabname = ’BKPF’.<br />
t_fields-fieldname = ’BUDAT’.<br />
APPEND t_fields.</p>
<p>t_fields-tabname = ’BKPF’.<br />
t_fields-fieldname = ’BLART’.<br />
APPEND t_fields.</p>
<p>*&#8212;- Function Module Call &#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*<br />
CALL FUNCTION ’POPUP_GET_VALUES’<br />
EXPORTING<br />
*  NO_VALUE_CHECK        = ’ ’<br />
popup_title           = ’Test Popup’<br />
*  START_COLUMN          = ’5’<br />
*  START_ROW             = ’5’<br />
*  IMPORTING<br />
*  RETURNCODE            =<br />
TABLES<br />
fields                = t_fields<br />
EXCEPTIONS<br />
error_in_fields       = 1<br />
OTHERS                = 2<br />
.<br />
IF sy-subrc &lt;&gt; 0.<br />
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO<br />
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.<br />
ENDIF.</p>
<p>*&#8212; Display Report &#8212;&#8212;&#8212;&#8212;&#8212;-*<br />
LOOP AT t_fields.<br />
WRITE:/ t_fields-value.<br />
ENDLOOP.</p>
<p style="text-align: center;">&nbsp;</p>
</div>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/07/27/sap-data-in-3-dimension/' rel='bookmark' title='ABAP Program to display SAP Data in 3-Dimension'>ABAP Program to display SAP Data in 3-Dimension</a></li>
<li><a href='http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/' rel='bookmark' title='Date formatting for Display in ABAP Program'>Date formatting for Display in ABAP Program</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/28/display-se78-pictures-on-screen/' rel='bookmark' title='ABAP Program to Display SE78 pictures on Screen'>ABAP Program to Display SE78 pictures on Screen</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2011/09/23/display-a-popup-and-get-values-from-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Function Modules in ABAP-HR</title>
		<link>http://www.abap-tutorials.com/2009/12/09/useful-function-modules-in-abap-hr/</link>
		<comments>http://www.abap-tutorials.com/2009/12/09/useful-function-modules-in-abap-hr/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 09:48:37 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP HR]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[function module]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1150</guid>
		<description><![CDATA[Function modules are always helpful, specially when dealing a complex module like ABAP HR. Thanks to SAP that has provided strong Function Module support. Here is the list of some useful ABAP HR function modules: RS_PROGRAM_CHECK_NAME: To check program names if you are generating them. RS_CORR_INSERT : To insert the correction request in the repository. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Function modules are always helpful, specially when dealing a complex module like ABAP HR. Thanks to SAP that has provided strong Function Module support.</p>
<p style="text-align: justify;">Here is the list of some useful ABAP HR function modules:</p>
<p style="text-align: justify;"><strong>RS_PROGRAM_CHECK_NAME</strong>: To check program names if you are generating them.<br />
<strong> RS_CORR_INSERT</strong> : To insert the correction request in the repository.<br />
<strong> REPS_OBJECT_ACTIVATE</strong>: To activate repository objects, for example &#8211; to activate a newly generated program.<br />
<strong> RS_DELETE_PROGRAM</strong>: To delete the program.<br />
<strong> RS_ACCESS_PERMISSION</strong>: To lock or unlock a program.</p>
<p style="text-align: justify;"><span id="more-1150"></span></p>
<p style="text-align: justify;">Function Modules related to <strong><span style="color: #3366ff;">Date and Time Calculations</span></strong><br />
<strong> CALCULATE_DATE</strong>: Calculates the future date based on the input .<br />
<strong> DATE_TO_DAY</strong>: Returns the Day for the entered date.<br />
<strong> DATE_COMPUTE_DAY</strong>: Returns weekday for a date<br />
<strong> DATE_GET_WEEK</strong>: Returns week for a date<br />
<strong> RP_CALC_DATE_IN_INTERVAL</strong>: Add days / months to a date</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Modules related to (ALV) <strong><span style="color: #3366ff;">ADVANCED LIST VIEWER</span></strong><br />
<strong> REUSE_ALV_LIST_DISPLAY</strong>: ABAP List viewer (LIST DISPLAY)<br />
<strong> REUSE_ALV_GRID_DISPLAY</strong>: ALV GridControl full screen<br />
<strong> REUSE_ALV_FIELDCATALOG_MERGE</strong>: Create field catalog from dictionary structure or internal table</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Module related to <strong><span style="color: #3366ff;">Change Tracking</span></strong><br />
<strong> CHANGEDOCUMENT_READ_HEADERS</strong>: Read and format change documents<br />
<strong> DAY_ATTRIBUTES_GET</strong>: Returns attributes for a range of dates specified<br />
<strong> MONTHS_BETWEEN_TWO_DATES</strong>: To get the number of months between the two dates.<br />
<strong> END_OF_MONTH_DETERMINE_2</strong>: Determines the End of a Month.<br />
<strong> HR_HK_DIFF_BT_2_DATES</strong>: Find the difference between two dates in years, months and days.<br />
<strong> FIMA_DAYS_AND_MONTHS_AND_YEARS</strong>: Find the difference between two dates in years, months and days.<br />
<strong> MONTH_NAMES_GET</strong>: Get the names of the month<br />
<strong> IDWT_READ_MONTH_TEXT</strong>: Get the MONTH Text<br />
<strong>WEEK_GET_FIRST_DAY</strong> : Get the first day of the week<br />
<strong> HRGPBS_HESA_DATE_FORMAT</strong>: Format the date in dd/mm/yyyy format<br />
<strong> SD_CALC_DURATION_FROM_DATETIME</strong>: Find the difference between two date/time and report the difference in hours<br />
<strong> L_MC_TIME_DIFFERENCE</strong>: Find the time difference between two date/time<br />
<strong> HR_99S_INTERVAL_BETWEEN_DATES</strong>: Difference between two dates in days, weeks, months<br />
<strong> LAST_DAY_OF_MONTHS</strong>: Returns the last day of the month<br />
<strong> DATE_CHECK_PLAUSIBILITY</strong>: Check for the invalid date.<br />
<strong> DATE_2D_TO_4D_CONVERSION</strong>: Year entry: 2-character to 4-character.<br />
<strong> DAY_IN_WEEK</strong>: Input date and will give the name of the day 1-monday,2-Tuesday….<br />
<strong> SD_DATETIME_DIFFERENCE</strong>: Give the difference in Days and Time for 2 dates</p>
<p style="text-align: justify;">Function Modules Related To <strong><span style="color: #3366ff;">Formatting</span></strong></p>
<p style="text-align: justify;"><strong>CLOI_PUT_SIGN_IN_FRONT</strong>: Displays the negative sign in front of the numeral.</p>
<p style="text-align: justify;"><strong>RKD_WORD_WRAP</strong>: Wrap text into several lines</p>
<p style="text-align: justify;"><strong>CONVERSION_EXIT_ALPHA_INPUT</strong>: Pad zeros to the number at the left</p>
<p style="text-align: justify;"><strong>CONVERSION_EXIT_ALPHA_OUTPUT</strong>: Eliminate zeros to the number at the left</p>
<p style="text-align: justify;"><strong>READ_EXCHANGE_RATE</strong>: Exchange Conversion</p>
<p style="text-align: justify;"><strong>SPELL_AMOUNT</strong>: Transforms numeric values into text</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Modules Related To <strong><span style="color: #3366ff;">Dialog Prompts</span></strong></p>
<p style="text-align: justify;"><strong>POPUP_TO_CONFIRM</strong>: Displays a popup dialog with a user defined message for confirmation</p>
<p style="text-align: justify;"><strong>POPUP_TO_GET_VALUE</strong>: Displays a popup dialog requesting a value for a particular table-fieldname</p>
<p style="text-align: justify;"><strong>SAPGUI_PROGRESS_INDICATOR</strong>: Displays a progress bar with text to denote the percentage of completion and status</p>
<p style="text-align: justify;"><strong>FILENAME_GET</strong>: Displays a popup dialog to get the presentation server filename</p>
<p style="text-align: justify;"><strong>F4_DATE</strong>: Displays a popup dialog to choose date</p>
<p style="text-align: justify;"><strong>POPUP_TO_SELECT_MONTH</strong>: Display a pop-up to select a month</p>
<p style="text-align: justify;"><strong>GET_PRINT_PARAMETERS</strong>: Printer parameters</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function modules related to <strong><span style="color: #3366ff;">RFC communication</span></strong></p>
<p style="text-align: justify;"><strong>RFC_CONNECTION_CLOSE</strong>: Close a RFC connection</p>
<p style="text-align: justify;"><strong>RFC_GET_SYSTEM_INFO</strong> : Give system’s information of a remote system</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function modules related to <span style="color: #3366ff;"><strong>reading/writing files</strong></span></p>
<p style="text-align: justify;"><strong>FILE_READ_AND_CONVERT_SAP_DATA</strong>: Uploads the file from either presentation or application server into an internal table</p>
<p style="text-align: justify;"><strong>SUBST_GET_FILE_LIST</strong>: To get the list of files from Application Server.</p>
<p style="text-align: justify;"><strong>ALSM_EXCEL_TO_INTERNAL_TABLE</strong>: Legacy Data Transfer w/ Excel</p>
<p style="text-align: justify;"><strong>WS_FILE_DELETE</strong>: Delete files on UNIX server</p>
<p style="text-align: justify;"><strong>PFL_COPY_OS_FILE</strong>: Copy UNIX files</p>
<p style="text-align: justify;"><strong>EPS_GET_DIRECTORY_LISTING</strong>: Returns all files from a Server directory</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Modules related to <strong><span style="color: #3366ff;">sending emails</span></strong></p>
<p style="text-align: justify;"><strong>SO_NEW_DOCUMENT_ATT_SEND_API1</strong> &#8211; Sends emails with texts and attachments<br />
<strong> SO_NEW_DOCUMENT_SEND_API1</strong> &#8211; Sends emails with texts.</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Modules related to <strong><span style="color: #3366ff;">F4 Help</span></strong></p>
<p style="text-align: justify;"><strong>F4IF_INT_TABLE_VALUE_REQUEST</strong> &#8211; F4 help also returning the value to be displayed in internal table</p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Function Modules related to <span style="color: #3366ff;"><strong>data maintenance</strong></span></p>
<p style="text-align: justify;"><strong>VIEW_MAINTENANCE_CALL</strong> &#8211; To maintain data from a table</p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/11/18/abap-vs-abap-hr/' rel='bookmark' title='ABAP Vs. ABAP HR'>ABAP Vs. ABAP HR</a></li>
<li><a href='http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/' rel='bookmark' title='Date formatting for Display in ABAP Program'>Date formatting for Display in ABAP Program</a></li>
<li><a href='http://www.abap-tutorials.com/2011/09/23/display-a-popup-and-get-values-from-user/' rel='bookmark' title='Display a Popup and Get Values from User'>Display a Popup and Get Values from User</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/12/09/useful-function-modules-in-abap-hr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date formatting for Display in ABAP Program</title>
		<link>http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/</link>
		<comments>http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 12:47:51 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[Formatting]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[date format]]></category>
		<category><![CDATA[format date]]></category>
		<category><![CDATA[function module]]></category>
		<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=1009</guid>
		<description><![CDATA[Function module FORMAT_DATE_4_OUTPUT comes in handy in case we need simple formatting on date. Formatting which involves change in position day, month and year, changing the separator we can achieve with this function module. Following sample code shows how we can manipulate date directly to different formats.     Sample code:   Program ZDATEFORMAT. DATA : [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Function module <strong>FORMAT_DATE_4_OUTPUT</strong> comes in handy in case we need simple formatting on date. Formatting which involves change in position day, month and year, changing the separator we can achieve with this function module. Following sample code shows how we can manipulate date directly to different formats.</p>
<p style="text-align: center;">
<div style="float: left; width: 100%; height: 180px;"><img class="aligncenter size-full wp-image-1011" title="Date Formats" src="http://www.abap-tutorials.com/wp-content/uploads/2009/10/date_formats.jpg" alt="Date Formats" width="459" height="150" /></div>
<p style="text-align: justify;"> <span id="more-1009"></span></p>
<p style="text-align: justify;"> </p>
<p style="text-align: justify;">Sample code:</p>
<p style="text-align: justify;"> </p>
<pre lang="ABAP">Program ZDATEFORMAT.
DATA : v_date TYPE syst-datum ,
      lv_foramt TYPE char10  .

START-OF-SELECTION .
PERFORM format_date USING 'DD.MM.YYYY' .
PERFORM format_date USING 'DD/MM/YYYY' .
PERFORM format_date USING 'DD/MM/YY' .
PERFORM format_date USING 'YY-MM-DD' .
PERFORM format_date USING 'MM*DD*YYYY' .
PERFORM format_date USING 'YY,MM,DD' .

*&amp;---------------------------------------------------------------------*
*&amp;      Form format_date
*&amp;---------------------------------------------------------------------*
FORM format_date USING iv_format TYPE rn1datum-format.
  DATA : lv_date TYPE rn1datum-datex .
  CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
  EXPORTING
    datin  = sy-datum
    format = iv_format
  IMPORTING
    datex  = lv_date.
  WRITE : / sy-datum , ' Format : ' , iv_format , lv_date .
ENDFORM.                    "format_date</pre>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/07/27/sap-data-in-3-dimension/' rel='bookmark' title='ABAP Program to display SAP Data in 3-Dimension'>ABAP Program to display SAP Data in 3-Dimension</a></li>
<li><a href='http://www.abap-tutorials.com/2009/08/21/formatting-sapscript-smartforms-in-sap/' rel='bookmark' title='Formatting SAPScript / SMARTFORMS in SAP'>Formatting SAPScript / SMARTFORMS in SAP</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/28/display-se78-pictures-on-screen/' rel='bookmark' title='ABAP Program to Display SE78 pictures on Screen'>ABAP Program to Display SE78 pictures on Screen</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ABAP code for saving Long Text in BDC</title>
		<link>http://www.abap-tutorials.com/2009/09/19/abap-code-for-saving-long-text-in-bdc/</link>
		<comments>http://www.abap-tutorials.com/2009/09/19/abap-code-for-saving-long-text-in-bdc/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 05:59:51 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[BDC / LSMW]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[BDC]]></category>
		<category><![CDATA[function module]]></category>
		<category><![CDATA[long text]]></category>
		<category><![CDATA[textedit]]></category>

		<guid isPermaLink="false">http://www.abap-tutorials.com/?p=986</guid>
		<description><![CDATA[There has been requirements for recording BDC for screens involving Long Text (Free field for text entry). The part that is a bit tricky is, the TextEdit control (Long Text field) does not gets recorded in the BDC. The following function module is used to save the data with respect to the screen (say, Sales Order [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">There has been requirements for recording BDC for screens involving Long Text (Free field for text entry). The part that is a bit tricky is, the TextEdit control (Long Text field) does not gets recorded in the BDC.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">The following function module is used to save the data with respect to the screen (say, Sales Order Number in case recording &#8216;Description&#8217; and &#8216;Created By&#8217; using VA01).</p>
<p style="text-align: center;">
<div style="float: left; width: 100%;"><img class="aligncenter size-full wp-image-987" title="Save Long Text" src="http://www.abap-tutorials.com/wp-content/uploads/2009/09/save_long_text.jpg" alt="Save Long Text" width="614" height="445" /></div>
<p style="text-align: justify;"><span id="more-986"></span></p>
<p style="text-align: justify;">
<p style="text-align: justify;"><strong><span style="color: #339966;">Steps:</span></strong></p>
<p style="text-align: justify;"><span style="color: #333333;">1.  Create an internal table of type TLINE and structure of type THEAD.<br />
DATA: lines  TYPE tline occurs 0 with header line,<br />
header TYPE thead.<br />
</span><span style="color: #333333;"> </span></p>
<p style="text-align: justify;"><span style="color: #333333;">2.  Fill the data in the internal table.<br />
NOTE: TO get tdobject, tdname, tdid, tdspras; double click in TextArea and the select GOTO- &gt; HEADER.</span></p>
<p style="text-align: center;">
<p style="text-align: center;">
<div style="text-align: center;"><span style="color: #333333;"> </span></div>
<p><span style="color: #333333;"> </span></p>
<div style="float: left; width: 100%;"><img class="aligncenter size-full wp-image-990" title="Long Text : Header Data" src="http://www.abap-tutorials.com/wp-content/uploads/2009/09/save_long_text2.jpg" alt="Long Text : Header Data" width="456" height="354" /></div>
<p><span style="color: #333333;"> </span><span style="color: #333333;"> </span></p>
<p><span style="color: #333333;"> </span></p>
<pre lang="ABAP">      header-tdobject   = 'VBBK'.
      header-tdname     = 'XXXXXXXXXX'.
      header-tdid       = 'ZM01'.
      header-tdspras    = 'EN'.
      header-tdlinesize = '072'.

*--- Calling the function and getting the retrieved data
*--- to be dispalyed
      call function 'EDIT_TEXT'
        exporting
*   DISPLAY             = ' '
*    EDITOR_TITLE       = ' '
          header              = header
*   PAGE                = ' '
*   WINDOW              = ' '
          save                = ''
*   LINE_EDITOR         = ' '
*   CONTROL             = ' '
*   PROGRAM             = ' '
*   LOCAL_CAT           = ' '
* IMPORTING
*   FUNCTION            =
*   NEWHEADER           =
*   RESULT              =
        tables
          lines               = lines
* EXCEPTIONS
*   ID                  = 1
*   LANGUAGE            = 2
*   LINESIZE            = 3
*   NAME                = 4
*   OBJECT              = 5
*   TEXTFORMAT          = 6
*   COMMUNICATION       = 7
*   OTHERS              = 8
                .
      if sy-subrc &lt;&gt; 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.</pre>
<p style="text-align: justify;"><span style="color: #000000;">3. Now, at the time of saving, Save the data into Database with reference to Sales Document Number(v_vbeln). Note: this code should be written after the Sales Document is saved.</span></p>
<pre lang="ABAP">if lines[] is NOT INITIAL.
      header-tdobject   = 'VBBK'.
      header-tdname     =  v_vbeln.
      header-tdid       = 'ZM01'.
      header-tdspras    = 'EN'.
      header-tdlinesize = '072'.

      CALL FUNCTION 'SAVE_TEXT'
        EXPORTING
*         CLIENT                = SY-MANDT
          HEADER                = header
          INSERT                = 'V'
          SAVEMODE_DIRECT       = 'X'
*         OWNER_SPECIFIED       = ' '
*         LOCAL_CAT             = ' '
*       IMPORTING
*         FUNCTION              =
*         NEWHEADER             =
        TABLES
          LINES                 = lines
*       EXCEPTIONS
*         ID                    = 1
*         LANGUAGE              = 2
*         NAME                  = 3
*         OBJECT                = 4
*         OTHERS                = 5
                .
      IF SY-SUBRC &lt;&gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

endif.</pre>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/09/16/abap-program-for-table-maintenance-in-sap/' rel='bookmark' title='ABAP Program for Table Maintenance in SAP'>ABAP Program for Table Maintenance in SAP</a></li>
<li><a href='http://www.abap-tutorials.com/2011/09/23/display-a-popup-and-get-values-from-user/' rel='bookmark' title='Display a Popup and Get Values from User'>Display a Popup and Get Values from User</a></li>
<li><a href='http://www.abap-tutorials.com/2009/07/10/got-sap-mail/' rel='bookmark' title='ABAP Program to Send Mail through SAP'>ABAP Program to Send Mail through SAP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/09/19/abap-code-for-saving-long-text-in-bdc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Type of Database Updates in SAP</title>
		<link>http://www.abap-tutorials.com/2009/07/21/type-of-database-updates/</link>
		<comments>http://www.abap-tutorials.com/2009/07/21/type-of-database-updates/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 23:51:11 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[ABAP]]></category>
		<category><![CDATA[Function Modules]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[database update]]></category>
		<category><![CDATA[database updates]]></category>
		<category><![CDATA[function module]]></category>
		<category><![CDATA[SAP]]></category>
		<category><![CDATA[type of]]></category>

		<guid isPermaLink="false">http://naveenvishal.wordpress.com/?p=316</guid>
		<description><![CDATA[There are three types of Updates that can occurs to the database, depending upon the priorty given to the work. V1 &#8211; Synchronous update V2 &#8211; Asynchronous update V3 &#8211; Batch asynchronous update These are different work processes on the application server that takes the update LUW (which may have various DB manipulation SQLs) from [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">There are three types of Updates that can occurs to the database, depending upon the priorty given to the work.</p>
<p style="text-align:justify;">V1 &#8211; Synchronous update<br />
V2 &#8211; Asynchronous update<br />
V3 &#8211; Batch asynchronous update</p>
<p style="text-align:justify;"><span id="more-316"></span><br />
These are different work processes on the application server that takes the update LUW (which may have various DB manipulation SQLs) from the running program and execute it. These are separated to optimize transaction processing capabilities.</p>
<p style="text-align:justify;"><span style="color:#3366ff;"><strong>Synchronous Updating (V1 Update)</strong></span><br />
The statistics update is made synchronously with the document update.<br />
While updating, if problems that result in the termination of the statistics update occur, the original documents are NOT saved. The cause of the termination should be investigated and the problem solved. Subsequently, the documents can be entered again.</p>
<p style="text-align:justify;"><span style="color:#3366ff;"><strong>Asynchronous Updating (V2 Update)<br />
</strong></span>With this update type, the document update is made separately from the statistics update. A termination of the statistics update has NO influence on the document update (see V1 Update).</p>
<p style="text-align:justify;"><span style="color:#3366ff;"><strong>Asynchronous Updating (V3 Update)</strong></span><br />
With this update type, updating is made separately from the document update. The difference between this update type and the V2 Update lies, however, with the time schedule. If the V3 update is active, then the update can be executed at a later time.</p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;"> <span style="color:#3366ff;"><strong>Practical Examples</strong></span></p>
<p style="text-align:justify;">If you create/change a purchase order (me21n/me22n), when you press &#8216;SAVE&#8217; and see a success message (PO&#8230;. changed..), the update to underlying tables EKKO/EKPO has happened (before you saw the message). This update was executed in the V1 work process.</p>
<p style="text-align:justify;">There are some statistics collecting tables in the system which can capture data for reporting. For example, LIS table S012 stores purchasing data (it is the same data as EKKO/EKPO stored redundantly, but in a different structure to optimize reporting). Now, these tables are updated with the txn you just posted, in a V2 process. Depending on system load, this may happen a few seconds later (after you saw the success message). You can see V1/V2/V3 queues in SM12 or SM13.</p>
<p style="text-align:justify;">V3 is specifically for BW extraction. The update LUW for these is sent to V3 but is not executed immediately. You have to schedule a job (eg in LBWE definitions) to process these. This is again to optimize performance.</p>
<p style="text-align:justify;">V2 and V3 are separated from V1 as these are not as realtime critical (updating statistical data). If all these updates were put together in one LUW, system performance (concurrency, locking etc) would be impacted.</p>
<p style="text-align:justify;">Serialized V3 update is called after V2 has happened (this is how the code running these updates is written) so if you have both V2 and V3 updates from a txn, if V2 fails or is waiting, V3 will not happen yet.</p>
<p style="text-align:justify;">BTW, &#8216;serialized&#8217; V3 is discontinued now, in later releases of PI you will have only unserialized V3.</p>
<p style="text-align:justify;">In contrast to V1 and V2 Updates , no single documents are updated. The V3 update is, therefore, also described as a collective update.</p>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;"> <strong><span style="color:#3366ff;">Creating Update Modules</span></strong></p>
<p style="text-align:justify;"><span style="color:#000000;">Update Modules can be created as follows:</span></p>
<p style="text-align:justify;"><span style="color:#000000;">1. ChooseTools &#8211; &gt; ABAP Workbench,Function Builder.</span></p>
<p style="text-align:justify;"><span style="color:#000000;">2. To be able to call a function module in an update work process, you must flag it in the Function Builder. When you create the function module, set the Process Type attribute to one of the following values:</span></p>
<p style="text-align:justify;"><strong>Update with immediate start</strong></p>
<p style="text-align:justify;">Set this option for high priority (&#8220;V1&#8243;) functions that run in a shared (SAP LUW). These functions can be restarted by the update task in case of errors.</p>
<p style="text-align:justify;"><strong>Update w. imm. start, no restart</strong></p>
<p style="text-align:justify;">Set this option for high priority (&#8220;V1&#8243;) functions that run in a shared (SAP LUW). These functions may not be restarted by the update task.</p>
<p style="text-align:justify;"><strong>Update with delayed start</strong></p>
<p style="text-align:justify;">Set this option for low priority (&#8220;V2&#8243;) functions that run in their own update transactions. These functions can be restarted by the update task in case of errors.</p>
<p style="text-align:justify;"><strong>Collective Run</strong></p>
<p style="text-align:justify;">Unlike V1 and V2 updates, V3 updates (or collective runs) are not started directly. The update is performed by a background job (report RSM13005). In this case, the update requests are not updated separately, but rather all modules of the same type are updated in a single database transaction. As the database can operate with far fewer database transactions, system performance is dramatically improved. Background jobs should be started in Customizing of the relevant applications that use the V3 update.</p>
<div class="mceTemp mceIEcenter" style="text-align:justify;">
<div id="attachment_318" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-318" title="Defining Update Type (Function Module)" src="http://naveenvishal.files.wordpress.com/2009/07/update_function1.jpg?w=300" alt="Defining Update Type (Function Module)" width="300" height="232" /><p class="wp-caption-text">Defining Update Type (Function Module)</p></div>
</div>
<p style="text-align:justify;"> </p>
<p style="text-align:justify;"><strong><span style="color:#3366ff;">Summing Up !</span></strong></p>
<p style="text-align:justify;">V1: The update should be performed soon. The update record is protected by R/3 locks. The update is critical for the operational consistency of the system.<br />
V2: The update does not have to be performed soon. The update is not protected by locks. The update modules do not contain &#8220;vital&#8221; data.<br />
V3: As V2, but, you use report RSM13005 to start the updates.</p>
<p style="text-align:justify;">Note that the V3 update offers an advantage with regard to speed when considering its disadvantages. Report RSM13005 also eliminates some of the disadvantages of the V3 update.</p>
<p style="text-align:justify;"> </p>


<p>You might also be interested in these posts:<ol><li><a href='http://www.abap-tutorials.com/2009/11/19/logical-database-in-sap-a-must-for-abap-hr-programmer/' rel='bookmark' title='Logical Database in SAP &#8211; a must for ABAP HR programmer'>Logical Database in SAP &#8211; a must for ABAP HR programmer</a></li>
<li><a href='http://www.abap-tutorials.com/2009/08/19/lock-objects-in-sap/' rel='bookmark' title='Lock Objects in SAP'>Lock Objects in SAP</a></li>
<li><a href='http://www.abap-tutorials.com/2009/10/15/date-formatting-for-display-in-abap-program/' rel='bookmark' title='Date formatting for Display in ABAP Program'>Date formatting for Display in ABAP Program</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.abap-tutorials.com/2009/07/21/type-of-database-updates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

