Sunday, 11 September 2016

Module pool programming using SE38

Ex :-

  • Display Sales Order Header Data based on Sales Order Number.

Steps :-


  • Go to Transaction Code SE38.
  • Enter the program name which start's with Y or Z < program name > and click on Create.
  • Pop-up will appear.
  • Select Attribute Type as Module Pool.
  • Click on SAVE.
  • Save it either in Package or Local Package.
  • Looks like,



  • Write the code,
  • Double Click on Screen Number.
  • Pop-up will appear.
  • Click on Yes.
  • Pop-up will appear.
  • Click on Yes.
  • Enter the short description.



  • Click on Layout.
  • Click on Goto -> Secondary Window ->  Dictionary/ Program Fields.
  • Enter the Table name and click on  "Get from Dictionary ".

  • Select some of the fields and press ENTER.
  • Place it on Screen Painter.
  • Using Drag and Drop place the Fields.

To add Push-buttons

  • Click on Push-button.
  • Place it on Screen Painter.
  • Double Click on it.
  • Pop-up will appear.
  • Enter the Name , Text and FctCode ( Function Code ).
  • Similarly create one more push-button.

  • Close the pop-ups.
  • Save -> Check -> Activate.
  • Click on Back .
  • Looks like,
  • Click on Flow Logic Tab.
  • Enable the Event's Module.




  • Double click on PAI ( Process After Input ) module.
  • Pop-up will appear.
  • Click on Yes.
  • Pop-up will appear.
  • Select Main program  and click on Continue.
  • Pop-up will appear .
  • Click on Yes.
  • Looks like,
  • Enter the Logic.


CASE SY-UCOMM.

  WHEN 'DISP'.
      
      SELECT SINGLE * FROM VBAK WHERE VBELN = VBAK-VBELN.
        
  WHEN 'CLEA'.

   CLEAR VBAK.
  ENDCASE.



  • Save -> Check -> Activate.
  • Click on Back.
  • Click on Activate.
  • Click on Back.
  • Copy the Module pool programming name.

To create Transaction Code

  • Go to Transaction Code SE93.
  • Enter the Transaction Code name stat's with Y or Z < Transaction Code > and click on Create.
  • Pop-up will appear.
  • Enter the short description.
  • Start Object : - Dialog Programming.
  • Click on Continue.

  • Enter the program name and Screen number.
  • Check GUI Support .
  • Click on Save.
  • Pop-up will appear.
  • Save it in either Local Package or Package.

  • Copy the Transaction Code.



Test :

  • Go to Transaction Code ZSD_HEAD.
  • Screen looks like,

Input - 1.


  • Enter the Sales Doc number and Click on Display.

Output


Input - 2

  • Click on Clear.

Output



Source Code

TABLES : VBAK.

START-OF-SELECTION.

CALL SCREEN 9000.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.

  CASE SY-UCOMM.
    WHEN 'DISP'.

      SELECT SINGLE * FROM VBAK WHERE VBELN = VBAK-VBELN.

    WHEN 'CLEA'.
      CLEAR VBAK.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_9000  INPUT



2 comments:


  1. Excellent Information.To get awesome training in SAP ABAP,the creating experts is the best choice.
    The experts provides 100% real-time, practical and placement focused SAP ABAP Training in Chennai.
    The team of SAP ABAP Trainers are SAP ABAP Certified professionals with more real-time experience in
    live projects.For more information visit : real time sap abap training in chennai


    ReplyDelete
    Replies
    1. VERY WELL EXPLAINED,not a single doubt. you can can add 2-3 tables and then how to print result.

      Delete