<?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: simple Module Pool Program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479362#M224531</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajesh ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I think Rich has suggested the best solution for your problem . For more help on that click &amp;lt;a href="http://help.sap.com/saphelp_erp2005/helpdata/en/a1/e45217a2f511d1a5630000e82deaaa/content.htm"&amp;gt;Table maintenance&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Hope this helps .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;Shounak M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Aug 2006 13:43:45 GMT</pubDate>
    <dc:creator>former_member628175</dc:creator>
    <dc:date>2006-08-11T13:43:45Z</dc:date>
    <item>
      <title>simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479359#M224528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;can any one give one simple program for                Insert Update Delete &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have taken 9 fields and in a simple screen.&lt;/P&gt;&lt;P&gt;and have 3 button. through this i want to Insert Update and Delete Data in customize table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thaks.&lt;/P&gt;&lt;P&gt;Rajesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:32:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479359#M224528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T13:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479360#M224529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just use the table maintenance generator in SE11.  This will give you a maintenance program which you can use to maintain the table.  You can then use SM30 to maintain.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to SE11, click utilities, table maintenance gerenator.&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;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:37:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479360#M224529</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-11T13:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479361#M224530</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;&lt;/P&gt;&lt;P&gt;Please refer this link &lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2025846"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:40:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479361#M224530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T13:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479362#M224531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajesh ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I think Rich has suggested the best solution for your problem . For more help on that click &amp;lt;a href="http://help.sap.com/saphelp_erp2005/helpdata/en/a1/e45217a2f511d1a5630000e82deaaa/content.htm"&amp;gt;Table maintenance&amp;lt;/a&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Hope this helps .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;Shounak M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:43:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479362#M224531</guid>
      <dc:creator>former_member628175</dc:creator>
      <dc:date>2006-08-11T13:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479363#M224532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Rich Heilmen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new for module pool program. i want to know how to create MP Program and in that i want to use 4 buttons to do operations of Insert Update and delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rajesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:43:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479363#M224532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T13:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479364#M224533</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;See the below link, open that link. Press next button for step by step&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm" target="test_blank"&gt;http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you will find Example programs in the SAP itself, T.code &amp;lt;b&amp;gt;ABAPDOCU&amp;lt;/b&amp;gt; , or goto SE80, then Utilities --&amp;gt; Examples --&amp;gt; ABAP Examples &lt;/P&gt;&lt;P&gt;here, Press ABAP User Dialogs --&amp;gt; Screens, you will find all the example programs for Module pool&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 13:46:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479364#M224533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T13:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479365#M224534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rajesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in module pool program generally there will be 2 processes&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO and PAI&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO(Process before output)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;this is trigerred before displaying the output screen&lt;/P&gt;&lt;P&gt;generally in PBO&lt;/P&gt;&lt;P&gt;we set the PF status&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PAI(Process after input )&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;this is trigerred when the user gives any input&lt;/P&gt;&lt;P&gt;here write the code for handling sy-ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********&lt;STRONG&gt;simple program as you reqd&lt;/STRONG&gt;***************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:itab1 type standard table of sflight,&lt;/P&gt;&lt;P&gt;ucomm like sy-ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call screen 100.&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;      Module  pbo  OUTPUT&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;      text&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;module pbo output.&lt;/P&gt;&lt;P&gt;set pf-status 'SCN100'.&lt;/P&gt;&lt;P&gt;select * from sflight into table itab1.&lt;/P&gt;&lt;P&gt;endmodule.                 " pbo  OUTPUT&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;      Module  pai  INPUT&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;      text&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;module pai input.&lt;/P&gt;&lt;P&gt;ucomm = sy-ucomm.&lt;/P&gt;&lt;P&gt;case ucomm.&lt;/P&gt;&lt;P&gt;when 'EXIT'.&lt;/P&gt;&lt;P&gt;leave program.&lt;/P&gt;&lt;P&gt;when 'INSERT'.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;write the code for insert&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;when 'UPDATE'.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;write the code for update&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*when 'DELETE'.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;write the code for delete&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;endcase.&lt;/P&gt;&lt;P&gt;endmodule.                 " pai  INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;********&lt;STRONG&gt;end of program&lt;/STRONG&gt;***************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*****doc contd...&lt;/P&gt;&lt;P&gt;after writing the call screen stmt&lt;/P&gt;&lt;P&gt;dblclk on screen no(100)&lt;/P&gt;&lt;P&gt;it will take you to screen painter&lt;/P&gt;&lt;P&gt;define the attributes and click on flow logic tab&lt;/P&gt;&lt;P&gt;replace the first commented stmt with&lt;/P&gt;&lt;P&gt;module pbo.&lt;/P&gt;&lt;P&gt;dblck on pbo.&lt;/P&gt;&lt;P&gt;it will take back you to se38 with that module created&lt;/P&gt;&lt;P&gt;write the code in&lt;/P&gt;&lt;P&gt;similarly replace the next commented code with &lt;/P&gt;&lt;P&gt;module pai.&lt;/P&gt;&lt;P&gt;again dblck on pai.&lt;/P&gt;&lt;P&gt;it will take back you to se38 with that module created&lt;/P&gt;&lt;P&gt;write the code in&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again go back to screen painter screen, click on layout tab,&lt;/P&gt;&lt;P&gt;click on dictionary/program fields window tab&lt;/P&gt;&lt;P&gt;it will take you to another screen &lt;/P&gt;&lt;P&gt;from there select the reqd fields you want to display&lt;/P&gt;&lt;P&gt;and create 3 push buttons &lt;/P&gt;&lt;P&gt;dblcl on them give text and fctcode and activate the screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;similarly in se38 dblck on the name given for the pf status to set the same&lt;/P&gt;&lt;P&gt;it will take you to the maintain status screen&lt;/P&gt;&lt;P&gt;i hope you know how to set the pf status&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;activate all the screens &lt;/P&gt;&lt;P&gt;of PF status, screen painter and se38&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then execute &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;even you can create one more button for DISPLAY &lt;/P&gt;&lt;P&gt;to display the data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this is very much clear to you&lt;/P&gt;&lt;P&gt;Please reward points if you feel it so&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;Sowjanya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 14:41:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479365#M224534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T14:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: simple Module Pool Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479366#M224535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;************************************************************************
* MODULE POOL                                                          *

PROGRAM  YP_BOOKMASTER_MAINTENANCE  MESSAGE-ID ZZ.


************************************************************************
*                       TABLES                                         *
************************************************************************

TABLES ZBKMA.                                         "book master table

************************************************************************
*                      VARIABLES                                       *
************************************************************************


DATA : V_NUMBER(5) TYPE N,            "variable to store random number
       V_LINE TYPE I,                 "variable to get total no of lines
       V_FLAG LIKE SY-TABIX.          "variable for checking


************************************************************************
*                     INTERNAL TABLE                                   *
************************************************************************

* internal table to store book numbers (i.e random numbers)

DATA : BEGIN OF IT_RANDOMNUMBERS OCCURS 0,
       BKNUM LIKE ZBKMA-BKNUM,                   "book number
       END OF IT_RANDOMNUMBERS.

* internal table to store only numeric part of book number
* eg : if book no is HUM00100 ,this table will only store 00100

DATA : BEGIN OF IT_NUMBERS OCCURS 0,
       NUMBER(5) TYPE N,                          " a number
       END OF IT_NUMBERS.

*internal table to store book details

DATA : BEGIN OF IT_BOOKMASTER OCCURS 0,
       BKNUM LIKE ZBKMA-BKNUM,            "BOOK NUMBER
       BKNAM LIKE ZBKMA-BKNAM,            "BOOK NAME
       AUTHR LIKE ZBKMA-AUTHR,            "AUTHOR
       SRCHT LIKE ZBKMA-SRCHT,            "SEARCH TERM
       PUBSH LIKE ZBKMA-PUBSH,            "PUBLISHER
       YRPUB LIKE ZBKMA-YRPUB,            "YEAR OF PUBLISHING
       VERNO LIKE ZBKMA-VERNO,            "VERSION NUMBER
       DATPR LIKE ZBKMA-DATPR,            "DATE OF PURCHASE
       BKCOD LIKE ZBKMA-BKCOD,            "BOOKCODE
       END OF IT_BOOKMASTER .


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Module  STATUS_0090  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*  PBO OF SCREEN 090(screen contains three buttons ADD , DELETE , MODIFY)
*----------------------------------------------------------------------*

MODULE STATUS_0090 OUTPUT.

  SET PF-STATUS 'BOOKMASTER_FIRST'.
  SET TITLEBAR 'BOOKMASTER'.

ENDMODULE.                 " STATUS_0090  OUTPUT



*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0090  INPUT
*&amp;amp;---------------------------------------------------------------------*
*      PAI OF SCREEN 90
*----------------------------------------------------------------------*

MODULE USER_COMMAND_0090 INPUT.

  CASE SY-UCOMM.

    WHEN 'BACK'.
      LEAVE TO SCREEN '0'.            "go back

    WHEN 'EXIT'.
      LEAVE PROGRAM.                  "exit the program

    WHEN 'CANCEL'.
      leave to screen '0'.             "cancel the screen

    WHEN 'ADD'.
      CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
      CALL SCREEN '0100'.

    WHEN 'DELETE'.
      CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
      CALL SCREEN '0200'.

    WHEN 'MODIFY'.
      CLEAR IT_BOOKMASTER.             "clears the contents of the fields.
      CALL SCREEN '0300'.

  ENDCASE.        "end sy-ucomm



ENDMODULE.                 " USER_COMMAND_0090  INPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       PBO OF 100 ( ADD THE BOOKS )
*----------------------------------------------------------------------*

MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'BOOKMASTER'.
  SET TITLEBAR 'UPDATE BOOKMASTER'.

ENDMODULE.                 " STATUS_0100  OUTPUT



*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*         PAI OF 100 ( ADD THE BOOKS )
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.


  CASE SY-UCOMM.            "check the screen 100 actions

    WHEN 'BACK'.
      LEAVE TO SCREEN '0'.      "go back

    WHEN 'EXIT'.
      LEAVE PROGRAM.            "exit the program

    WHEN 'CANCEL'.
      LEAVE to screen '0' .      "cancel the screen 100

    WHEN 'ADD'.

*      add the books to the master records
      PERFORM FORM_ADDBOOK.      " add the

    WHEN 'RESET'.
      CLEAR IT_BOOKMASTER.        "reset the screen
      SET SCREEN '0100'.


  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  FORM_ADDBOOK
*&amp;amp;---------------------------------------------------------------------*
*       ADDING THE BOOKS
*----------------------------------------------------------------------*
FORM FORM_ADDBOOK .

*TO ASSIGN BOOK NUMBER
  PERFORM FORM_ASSIGN_BOOKNO.

* INSERTING THE BOOKS
  ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
  ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
  ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
  ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
  ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
  ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
  ZBKMA-DATPR = IT_BOOKMASTER-DATPR.
  ZBKMA-BKCOD = IT_BOOKMASTER-BKCOD.

 IF NOT IT_BOOKMASTER-BKNAM IS INITIAL.  "if the book number is not initial

  INSERT ZBKMA.

 ENDIF.   "endif check initial

  IF SY-SUBRC = 0.
    MESSAGE S003(ZCHA) WITH IT_BOOKMASTER-BKNUM.
  ENDIF.    "endif success


ENDFORM.                    " FORM_ADDBOOK


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  FORM_DELETEBOOK
*&amp;amp;---------------------------------------------------------------------*
*       delete books from the master data
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM FORM_DELETEBOOK .

* check the it is initial
  IF NOT IT_BOOKMASTER-BKNUM IS INITIAL.

*get the book numbers present already
    SELECT SINGLE BKNUM
           FROM ZBKMA
           INTO ZBKMA-BKNUM
           WHERE BKNUM = IT_BOOKMASTER-BKNUM.

*check if select is successful
    IF SY-SUBRC = 0.

      DELETE FROM ZBKMA WHERE BKNUM = IT_BOOKMASTER-BKNUM.
      MESSAGE S004(ZCHA) WITH IT_BOOKMASTER-BKNUM.      "if book deleted
    ELSE.
      MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM.      "if book not found
    ENDIF.
  ENDIF.

ENDFORM.                    " FORM_DELETEBOOK
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  FORM_MODIFYBOOK
*&amp;amp;---------------------------------------------------------------------*
*       MODIFING THE BOOK
*----------------------------------------------------------------------*

FORM FORM_MODIFYBOOK.

*validiate the book number
  SELECT SINGLE BKNUM
            FROM ZBKMA
            INTO ZBKMA-BKNUM
            WHERE BKNUM = IT_BOOKMASTER-BKNUM.

*check for the success
  IF SY-SUBRC NE 0.

    MESSAGE S005(ZCHA) WITH IT_BOOKMASTER-BKNUM.

  ENDIF.


  ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
  ZBKMA-BKNAM = IT_BOOKMASTER-BKNAM.
  ZBKMA-AUTHR = IT_BOOKMASTER-AUTHR.
  ZBKMA-SRCHT = IT_BOOKMASTER-SRCHT.
  ZBKMA-PUBSH = IT_BOOKMASTER-PUBSH.
  ZBKMA-YRPUB = IT_BOOKMASTER-YRPUB.
  ZBKMA-VERNO = IT_BOOKMASTER-VERNO.
  ZBKMA-DATPR = IT_BOOKMASTER-DATPR.


  UPDATE ZBKMA.      "update the book master table

  IF SY-SUBRC = 0.

    MESSAGE S006(ZCHA) WITH IT_BOOKMASTER-BKNUM.

  ENDIF.


ENDFORM.                    " FORM_MODIFYBOOK
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  FORM_ASSIGN_BOOKNO
*&amp;amp;---------------------------------------------------------------------*
*       TEXT
*----------------------------------------------------------------------*

FORM FORM_ASSIGN_BOOKNO .

*select the books already there from bookmaster
  SELECT BKNUM
         FROM ZBKMA
         INTO TABLE IT_RANDOMNUMBERS
         WHERE BKCOD = IT_BOOKMASTER-BKCOD.

*if the book is first book i.e. first entry
  IF IT_RANDOMNUMBERS[] IS INITIAL.
    V_NUMBER = 1.                          "start with 1
    CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
    ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.      "assign booknumber
    EXIT.
  ENDIF.        "check for initial

  CLEAR IT_NUMBERS[].        "clear the temporary table
  CLEAR IT_NUMBERS.

* check for the book numbers if there is no book start from first in other
* cases look for first gap and assign that number

  LOOP AT IT_RANDOMNUMBERS.
    IT_NUMBERS-NUMBER   = IT_RANDOMNUMBERS-BKNUM+3(5). "get the last 5 digits
                                                        "and store it in it_number
    APPEND IT_NUMBERS.
  ENDLOOP.

  SORT IT_NUMBERS BY NUMBER.          "sort
  DESCRIBE TABLE IT_NUMBERS LINES V_LINE.    "get no. of lines in table

*check for book number gap
  LOOP AT IT_NUMBERS.

    V_FLAG = SY-TABIX.

* if the book number is not equal to the index of table i.e. some gap in book number
* or only one record
    IF IT_NUMBERS-NUMBER NE SY-TABIX OR V_LINE = 1.
       V_NUMBER = SY-TABIX.          "fill the gap

        if v_line = 1.                "if only one record
              v_number = v_line + 1.   "increment the book number
        endif.          "only one record check


          CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
          ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.      "assign
          EXIT.
   ENDIF.      "check for gap

*if no gap in book number assign next number
              IF V_FLAG = V_LINE.
                     V_NUMBER = IT_NUMBERS-NUMBER + 1.
                     CONCATENATE IT_BOOKMASTER-BKCOD  V_NUMBER INTO IT_BOOKMASTER-BKNUM.
                    ZBKMA-BKNUM = IT_BOOKMASTER-BKNUM.
                    EXIT.
              ENDIF.      "book number increment

  ENDLOOP.        "check number gap

ENDFORM.                    " FORM_ASSIGN_BOOKNO

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0200  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       PBO OF SCREEN 200 ( DELETE BOOKS)
*----------------------------------------------------------------------*
MODULE STATUS_0200 OUTPUT.
  SET PF-STATUS 'DELETE'.
  SET TITLEBAR 'DELETE'.

ENDMODULE.                 " STATUS_0200  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0200  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       PAI OF SCREEN 200 (DELETE BOOKS)
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0200 INPUT.

  CASE SY-UCOMM.        "check for screen 200 actions

    WHEN 'BACK'.
      LEAVE TO SCREEN '0'.        "go back

    WHEN 'EXIT'.
      LEAVE PROGRAM.              "leave program

    WHEN 'CANCEL'.
      LEAVE to screen '0'.        "cancel screen

    WHEN 'DELETE'.

* delete the book from master data
      PERFORM FORM_DELETEBOOK.

    WHEN 'RESET'.                  "reset the screen
      CLEAR IT_BOOKMASTER.

  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0200  INPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0300  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       PBO OF SCREEN 300 ( FOR MODIFYING )
*----------------------------------------------------------------------*
MODULE STATUS_0300 OUTPUT.
  SET PF-STATUS 'MODIFY'.
  SET TITLEBAR 'MODIFY'.

ENDMODULE.                 " STATUS_0300  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0300  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0300 INPUT.

  CASE SY-UCOMM.

    WHEN 'BACK'.
      LEAVE TO SCREEN '0'.

    WHEN 'EXIT'.
      LEAVE PROGRAM.

    WHEN 'CANCEL'.
      LEAVE TO SCREEN '0'.

    WHEN 'MODIFY'.
      PERFORM FORM_MODIFYBOOK.        "update the record

    WHEN 'RESET'.
      CLEAR IT_BOOKMASTER.            "screen reset

  ENDCASE.


ENDMODULE.                 " USER_COMMAND_0300  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  MODULE_CANCEL  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       ACTIONS AT EXIT COMMAND
*----------------------------------------------------------------------*
MODULE MODULE_CANCEL INPUT.
  CASE SY-UCOMM.

    WHEN 'BACK'.
      LEAVE TO SCREEN '0'.

    WHEN 'EXIT'.
      LEAVE PROGRAM.

    WHEN 'CANCEL'.
      LEAVE PROGRAM.
  ENDCASE.

ENDMODULE.                 " MODULE_CANCEL  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Chandrasekhar Jagarlamudi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Aug 2006 14:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-module-pool-program/m-p/1479366#M224535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-11T14:48:54Z</dc:date>
    </item>
  </channel>
</rss>

