Basic report programming

i am new to SAP.
please provide information abt report programming like what are the basic things we have to remember while writing a report program.please provide any link which gives basic information abt report programming with some hands-on practice.

hii amar,
Report programming is a simple abap program which deals with presentation of the output to the client.
Report is generally designed when we want to have the output on the screen in a particular manner..
Report has many things attached to it like alv etc.
But basically reports are managed by events. The order of the events are as follows.
Initialization
At selection screen
Start of selection
End of selection
Top of page..
We write the code in these events and this will be executed sequentially. If u want any detailed thing in report. Do revert back.
for eg. in the following code:
*& Report  Z_84083_REP                                                 *
REPORT  z_84083_rep NO STANDARD PAGE HEADING LINE-SIZE 150.
*MESSAGE-ID z_84083_msg.
**********************Database Tables*********************************
TABLES: z84083_train,Z84083_BOOKING.
**************************Selection Screen***************************
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: trnno FOR z84083_train-train_no NO INTERVALS.
PARAMETERS: from_st TYPE z84083_train-from_stn,
            to-st TYPE z84083_train-to_stn.
SELECTION-SCREEN END OF BLOCK b1.
*************************Internal Table*******************************
DATA: BEGIN OF itab OCCURS 10,
      trainno TYPE z84083_train-train_no,
      trainname TYPE z84083_train-train_name,
      fromstn TYPE z84083_train-from_stn,
      tostn TYPE z84083_train-to_stn,
      TOTT TYPE z84083_train-TOTAL_TKTS,
END OF itab.
*************************Headings*******************************
DATA:
    h1(10) TYPE c VALUE 'Train No',
    h2(20) TYPE c VALUE 'Train Name',
    h3(20) TYPE c VALUE 'From Stn',
    h4(20) TYPE c VALUE 'To Stn'.
  DATA : FLD(25) TYPE C,
        VAL TYPE  z89297_train-trainno.
*************************Report Headings****************************
TOP-OF-PAGE.
  WRITE: 'REQUESTER : Rahul Dwivedi',
         114'PAGE   :',sy-pagno.
  WRITE:/ 'PROGRAM : TRAIN REPORT',
          114'DATE :',sy-datum.
  SKIP 1.
  WRITE 60'TRAIN RESERVATION REPORT' COLOR 6 INVERSE ON INTENSIFIED ON.
  SKIP 1.
  ULINE.
END-OF-PAGE.
  ULINE.
*******************Defining the Start Of Selection event*************
START-OF-SELECTION.
  PERFORM fetch.
END-OF-SELECTION.
*******************CALLING THE DISPLAY FUNCTION
  perfORm display.
  AT LINE-SELECTION.
  IF sy-lsind = 1.
  GET CURSOR FIELD fld VALUE val.
   IF fld = 'ITAB-TRAINNO'.
   SET PARAMETER ID 'PID' FIELD ITAB-TRAINNO.
   SET PARAMETER ID 'PID1' FIELD ITAB-TRAINNAME.
         call transaction 'Z84083_TRANS'.
   Endif.
ENDIF.
*&      Form  fetch
      text
FORM fetch.
  SELECT TRAIN_NO TRAIN_NAME FROM_STN TO_STN TOTAL_TKTS FROM
z84083_train
    AS t INTO TABLE itab WHERE
    train_no IN trnno AND
    from_stn = from_st AND
    to_stn = to-st.
   SELECT NO_BD NO_AV FROM Z84083_BOOKING INTO TABLE ITAB1 WHERE
   TRAIN_NO IN TRNNO.
ENDFORM.                    "fetch
*&      Form  DISPLAY
      text
FORM display.
  ULINE.
    FORMAT COLOR 3 INVERSE OFF.
    WRITE:/ h1,'|',h2,'|',h3,'|',h4,'|'.
    ULINE.
    FORMAT COLOR 2 INVERSE OFF.
     LOOP AT ITAB.
      FORMAT HOTSPOT ON.
      WRITE: /(10) ITAB-TRAINNO UNDER h1,'|'.
      HIDE ITAB-TRAINNO.
      FORMAT HOTSPOT OFF.
WRITE: (20) ITAB-trainname UNDER h2,'|',
       (20) ITAB-fromstn UNDER h3,'|',
       (20) ITAB-toSTN UNDER h4,'|'.
    ENDLOOP.
    ULINE.
ENDFORM.
      u go thru the program and understand the hierarchy of the various events.

Similar Messages

  • What is difference between report programming and dialog programming?

    hi,
    what is difference between report programming and dialog programming? plz provide some example code
    bye

    ABAP programming
    Basically reports are used to read database and represent the results in lists.
    Reports are collections of processing blocks that the system calls depending on events.
    We can use reports to evaluate data from database tables.
    Reports are stand alone programs and controlled by events.
    A report itself never creates events
    steps in report:
    Processing the selection screen
    Reading the database
    Evaluating the data and creating lists
    Outputting a list.
    1st u write simple logics, after that u can enhance the code as step by step.
    http://venus.imp.mx/hilario/Libros/TeachYrslfAbap4/index.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/d1/802cfc454211d189710000e8322d00/frameset.htm
    http://www.sapdev.co.uk/reporting/reportinghome.htm
    Dialog Programming
    Structure of a Dialog Program
    A dialog program consists of the following basic components:
    Screens (dynpros)
    Each dialog in an SAP system is controlled by dynpros. A dynpro (DYnamic PROgram) consists of a screen and its flow logic and controls exactly one dialog step. The flow logic determines which processing takes place before displaying the screen (PBO-Process Before Output) and after receiving the entries the user made on the screen (PAI-Process After Input).
    The screen layout fixed in the Screen Painter determines the positions of input/output fields, text fields, and graphical elements such as radio buttons and checkboxes. In addition, the Menu Painter allows to store menus, icons, pushbuttons, and function keys in one or more GUI statuses. Dynpros and GUI statuses refer to the ABAP/4 program that control the sequence of the dynpros and GUI statuses at runtime.
    ABAP/4 module pool
    Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also called a module pool, since it consists of interactive modules. The flow logic of a dynpro contains calls of modules from the corresponding module pool. Interactive modules called at the PBO event are used to prepare the screen template in accordance to the context, for example by setting field contents or by suppressing fields from the display that are not needed. Interactive modules called at the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.
    All dynpros to be called from within one transaction refer to a common module pool. The dynpros of a module pool are numbered. By default, the system stores for each dynpro the dynpro to be displayed next. This dynpro sequence or chain can be linear as well as cyclic. From within a dynpro chain, you can even call another dynpro chain and, after processing it, return to the original chain.
    Check this link for basics.
    http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
    Check this link for Dialog Programming/Table Control
    http://www.planetsap.com/Tips_and_Tricks.htm#dialog
    Check this SAP Help for Dialog Program doc.
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
    Check this SAP Help link for Subscreens.
    http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbabfe35c111d1829f0000e829fbfe/content.htm
    Check this link for subscreen demo program.
    http://abapcode.blogspot.com/2007/05/demo-program-to-create-subscreen-in.html
    Also check this link too.
    http://abapcode.blogspot.com/2007/06/dialog-programming-faq.html
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/frameset.htm
    http://sap.mis.cmich.edu/sap-abap/abap09/sld004.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/52/670ba2439b11d1896f0000e8322d00/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/52/670c17439b11d1896f0000e8322d00/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/52/670c17439b11d1896f0000e8322d00/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9ccf35c111d1829f0000e829fbfe/frameset.htm
    http://abapprogramming.blogspot.com/

  • Getting error in a report program

    Hello,
    I have a report program where I am sending worklists for a user to mysql database using PI interface.
    Now, my report program is getting timed out with error.
    I am basically using one fetch operation
    SELECT bname FROM usr02 INTO TABLE lt_user.
    Now bname table is corrupted and having spaces after number say "112233".
    can u plz tell me why I am getting error. do i need to fetch data in chunks i.e SELECT bname FROM usr02 INTO TABLE lt_user. should be used fetch data in chunks
    or error can come becuase of corrupt data.
    TABLES  ZIT_ERROR_TAB.
    DATA    WA_ZIT_ERROR_TAB TYPE ZIT_ERROR_TAB.
    DATA: lt_user TYPE zuser_tt,
          ls_user TYPE zuser_sty.
    DATA: lt_worklist TYPE uwlitemlist,
          lt_messages TYPE TABLE OF swr_messag,
          lt_mess_struct TYPE TABLE OF swr_mstruc.
    DATA: CREATED_TIME(22) type c,
          wa_lt_worklist like line of lt_worklist,
          go_sys_exception TYPE REF TO cx_ai_system_fault,
          employee_data TYPE REF TO ZPI_CO_SI_EP003_ACTION_ITEM_MA,
          output type ZPI_MT_EP003_ACTION_ITEM,
          employee_rec type ZPI_DT_EP003_ACTION_ITEM_SUMMA,
          employee type ZPI_DT_EP003_ACTION_ITEM_S_TAB,
          n type i.
    n = 1.
    SELECT bname FROM usr02 INTO TABLE lt_user.
    SORT lt_user.
    DELETE ADJACENT DUPLICATES FROM lt_user.
    LOOP AT lt_user INTO ls_user.
      CLEAR lt_worklist.
      CLEAR lt_messages.
      CLEAR lt_mess_struct.
      CALL FUNCTION 'SWN_UWL_GET_WORKLIST'
       EXPORTING
         user                      = ls_user-bname
    IMPORTING
    worklist                  = lt_worklist
    TABLES
    message_lines             = lt_messages
    message_struct            = lt_mess_struct.
      loop at lt_worklist into wa_lt_worklist.
        employee_rec-USER_ID = wa_lt_worklist-USER_ID.
        employee_rec-SUBJECT = wa_lt_worklist-SUBJECT.
        CREATED_TIME = wa_lt_worklist-CREATED_TIME.
        employee_rec-CREATED_TIME = CREATED_TIME+0(14).
        employee_rec-FORWARDED_BY = wa_lt_worklist-FORWARDED_BY.
        employee_rec-IDENTITY_NUMBER = n.
        append employee_rec to employee.
        output-MT_EP003_ACTION_ITEM-SUMMARY_EMAIL_ACTION_ITEM = employee.
        clear employee_rec.
        n = n + 1.
      endloop.
    ENDLOOP.
    TRY.
        CREATE OBJECT employee_data.
        call method employee_data->UPLOAD_ACTION_ITEM
          EXPORTING
            OUTPUT = output.
        commit work.
      CATCH cx_ai_system_fault INTO go_sys_exception.
        WA_ZIT_ERROR_TAB-message = go_sys_exception->errortext.
        WA_ZIT_ERROR_TAB-code = go_sys_exception->code.
        WA_ZIT_ERROR_TAB-errordate = sy-datum.
        insert into ZIT_ERROR_TAB values wa_ZIT_ERROR_TAB.
    ENDTRY.

    What is the error, that you are getting? Is it a time out error?

  • Can we call a report program in smartforms

    hai
       I need my report progrm output should be called in smartforms.
    i.e my report  output is displayed in a table in smartforms
    pls give suggestion

    Hi,
    You cannot call report program in smartform.
    But,you can call the smartform in your report program.
    Refer these links:
    how to write driver programming in smartforms
    what is the basic purpose of driver program
    Regards,
    Sravanthi

  • How to Link Organizational Structure to a report program

    Hi All,
              Can anyone pls help me out with my requirement. How can we link a organizational structure created in transaction PPOMW to a report program. Basically i want to send the report output as an XLS attachment to an external email id. For that i need to link Organizational Structure to the report program.
          There are many ways of doing it but i want it to be done by linking Organization structure to the report program. Pls help me as soon as possible as its a bit urgent for me.

    Hi,
    Please follow the below function modules and the paramters for reading archived data:
    CALL FUNCTION 'ARCHIVE_OPEN_FOR_READ'
      EXPORTING
        OBJECT                   = archiving object name
    IMPORTING
       ARCHIVE_HANDLE           = archive read handle
    Then in the loop(DO-ENDDO), use this FM:
    DO.
      CALL FUNCTION 'ARCHIVE_GET_NEXT_OBJECT'
           EXPORTING
                archive_handle          = archive read handle
    Then records from the data objects using this FM:
      CALL FUNCTION 'ARCHIVE_GET_TABLE'
           EXPORTING
                archive_handle        = archive read handle
                record_structure      = 'TABLENAME'
                all_records_of_object = 'X'
                automatic_conversion  = 'X'
           TABLES
                table                 = internal table for which you want to retrieve records.
    ENDDO.
    Then close the archive file using this FM:
    CALL FUNCTION 'ARCHIVE_CLOSE_FILE'
         EXPORTING
              archive_handle = archive read handle
    This will help u in reading archived data from archive file.
    may give some idea also on how to code the read prgram.
    Thanks,
    Shamim

  • Itz possible to call one report program into another program

    hi guys,
                i had a doubt that can i call a report program into another report program by declaring their name into the second program like as we calling Includes ,function modules and like class and their methods .
    if  anybody done this or know how to do this,  give me the details and explination about this  friends
    if it possible with screenshots and codings
    Thanks & Regards
    Saigijeo

    Please search before posting, do not ask basic questions here.
    Always do your own work before turning to the community with specific problems.
    Thread locked.
    Thomas
    [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers]

  • Report programming

    Hi all,
    i am a beginner in ABAP,plz explain me clearly  about the events in report programming.
    thanks,
    jetti.

    List Events in an ABAP Program
    After a user interaction on a list, the ABAP runtime environment checks whether it should process the function code itself (for example, %EX or %PC), or whether it should trigger the relevant event. Unlike normal screens, in which the PAI event is triggered, the runtime environment triggers three special events when list events occur. You can use the corresponding event blocks in your ABAP program to react to the user action. From within the program, you can use the SY-UCOMM system field to access the function code. There is no OK_CODE field that is filled.
    Event Blocks for Function Codes PF<nn> (Obsolete)
    When the user chooses a function code PF<nn> (<nn> can be between 01 and 24), the system always triggers the AT PF<nn> event. In the standard list status, the function keys F<nn> that are not reserved for predefined system functions all have the function code PF<nn> as long as a corresponding event block is defined in the program.
    AT PF<nn>.
    <statements>.
    These event blocks are executed when the user chooses the corresponding function key. The position of the cursor in the list is irrelevant.
    If you use these event blocks at all, it should only be for temporary test versions. In production programs, you should only use AT USER-COMMAND with a dialog status of your own to assign function codes to function keys. When you use your own interfaces, the system displays a function text explaining what the function does. This does not happen when you use AT PF<nn> event blocks.
    Event Block for Function Code PICK
    When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click. Consequently, if you have a simple program that does not react to any further user actions, you only need to write this event block.
    AT LINE-SELECTION.
      <statements>.
    As described in the section Dialog Status for Lists, the function code PICK is always added to the standard list status when you have an AT LINE-SELECTION event in your program.
    If you assign PICK to other function keys or menu entries, AT LINE-SELECTION is also triggered when the user chooses then. You should avoid this for the sake of the semantics.
    Conversely, if you have a more extensive program that does not react to line selection, you should not use the function code PICK. Instead you should assign a different function code to F2 , to ensure that as many events as possible trigger the AT USER-COMMAND event.
    Event Block for User-Defined Function Codes
    If the user chooses a function code during list processing that is neither processed by the system, or PICK or PF<nn>, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
    AT USER-COMMAND.
    <statements>.
    In this event block, you can use an IF or CASE structure to tell the function codes apart. They are available in the system field SY-UCOMM. There are further system fields that are filled in list events, such as SY-LSIND and SY-PFKEY, that allow you to make further case distinctions.
    Triggering a List Event from the Program
    You can trigger a list event from the program as follows:
    SET USER-COMMAND <fc>.
    This statement takes effect after the current list is completed. Before the list is displayed, the event assigned to function code <fc> is triggered, regardless of the dialog status you are using.
    The effect is the same as when the user chooses the function. In other words, predefined list function codes are trapped and processed by the runtime environment, the function codes PICK and PF<nn> trigger the AT LINE-SELECTION and AT PF<nn> events, and user-defined function codes trigger the AT USER-COMMAND event block.
    Function code PICK triggers an event only if the cursor is located on a list line.
    Using this statement in conjunction with the function codes reserved for system functions, you can call the system functions from the program. For example, you can use SET USER-COMMAND '%SC' to call the Find dialog box directly, or to position the list correctly before it is displayed.
    If you use several SET USER-COMMAND statements while creating a list, the system executes only the last one.
    Examples
    Example for AT LINE-SELECTION.
    REPORT demo_list_at_line_selection.
    START-OF-SELECTION.
      WRITE  'Basic List'.
    AT LINE-SELECTION.
      WRITE: 'Secondary List by Line-Selection',
           / 'SY-UCOMM =', sy-ucomm.
    When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.
    Example for AT PF<nn>.
    REPORT demo_list_at_pf.
    START-OF-SELECTION.
      WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
    AT pf5.
      PERFORM out.
    AT pf6.
      PERFORM out.
    AT pf7.
      PERFORM out.
    AT pf8.
      PERFORM out.
    FORM out.
      WRITE: 'Secondary List by PF-Key Selection',
           / 'SY-LSIND =', sy-lsind,
           / 'SY-UCOMM =', sy-ucomm.
    ENDFORM.
    After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
    Secondary List by PF-Key Selection
    SY-LSIND = 14
    SY-UCOMM = PF06
    Example for AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'SY-LSIND:', sy-lsind,
           / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    Example for SET USER-COMMAND.
    REPORT demo_list_set_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      SET USER-COMMAND 'MYCO'.
      WRITE 'Basic List'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'MYCO'.
          WRITE 'Secondary List from USER-COMMAND,'.
          WRITE: 'SY-LSIND', sy-lsind.
          SET USER-COMMAND 'PF05'.
      ENDCASE.
    AT pf05.
      WRITE 'Secondary List from PF05,'.
      WRITE: 'SY-LSIND', sy-lsind.
      SET CURSOR LINE 1.
      SET USER-COMMAND 'PICK'.
    AT LINE-SELECTION.
      WRITE 'Secondary List from LINE-SELECTION,'.
      WRITE: 'SY-LSIND', sy-lsind.
      SET USER-COMMAND '%SC'.
    This program creates one basic list and three detail lists. When the program starts, the third detail list is displayed immediately, along with a dialog box for searching in the list. The dialog box is displayed by setting the predefined function code %SC. To view the other lists, the user chooses Back.
    Note that in the event AT PF05, the SET CURSOR statement is used to position the cursor on a list line in order to support the function code PICK.

  • Fetch Report Program names for a given Package

    Hi,
       I need to fetch all the report program names for a given pakage. I tired TADIR table but couldnt fetch report details alone..
    thanks,
    sri
    Moderator message: very basic, please do more own research before asking, e.g. look at a few TADIR entries of different object types, also discover the repository information system.
    Edited by: Thomas Zloch on Feb 23, 2011 2:56 PM

    Dan is right to be cautious, i've seen this cause problems.
    It's not very difficult to make the chnages in BCS, and if you have a lot of them/frequent changes, you can always use create an upload method
    and then make all future changes by .txt file

  • Problem with tab strip in report programing

    hi,
    I have coded 4 tab strips in a report program.Each tab has some obligatory fields.
    My requirement is user must fill all obligatory fields.
    suppose if I enter values only one tab and execute , its not asking the obligatory fields in other tabs.may be this is the behaviour of tab strips.
    To check the obligatory fields,I  wrote cheks in at selection screen with error message.In this case, suppose I didnt enter values in 2nd tab, the error message is coming under 1st tab screen and I am not able to select the 2nd tab.
    Can any body tells me how to overcome this issu.
    pavan meda

    Hi,
    Check this example..
    Basically you have to check the sy-ucomm not equal to the tab button function code (marked in bold)....
    Note: The only thing is I have to press the second button twice to get to the second tab..But it works..
    SELECTION-SCREEN BEGIN OF TABBED BLOCK tb1 FOR 10 LINES.
    SELECTION-SCREEN TAB (30) tab1  USER-COMMAND tab1  DEFAULT SCREEN 1001.
    SELECTION-SCREEN TAB (30) tab2  USER-COMMAND tab2  DEFAULT SCREEN 1002.
    SELECTION-SCREEN END OF BLOCK tb1.
    SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.
    PARAMETERS: p_1 TYPE matnr.
    SELECTION-SCREEN END OF SCREEN 1001.
    SELECTION-SCREEN BEGIN OF SCREEN 1002 AS SUBSCREEN.
    PARAMETERS: p_2 TYPE kunnr.
    SELECTION-SCREEN END OF SCREEN 1002.
    INITIALIZATION.
      tab1 = 'Material'.
      tab2 = 'Customer'.
    AT SELECTION-SCREEN.
    <b>  CHECK sy-ucomm <> 'TAB1' AND sy-ucomm <> 'TAB2'.</b>
      IF p_1 IS INITIAL.
        MESSAGE e000 WITH 'Required entry'.
      ENDIF.
      IF p_2 IS INITIAL.
        MESSAGE e000 WITH 'Required entry'.
      ENDIF.
    START-OF-SELECTION.
      WRITE: / p_1.
      WRITE: / p_2.
    Thanks,
    Naren

  • Any standard FM to print select-options criteria on a basic report?

    Hi Experts,
    Am trying to print the user entered selection criteria on a classical/basic report. I wrote the code for select-options entries, but, am looking for any standard function module (if i pass my_select_options table, I need to get printable/readable entires) to print on my basic report, pls. let me know (I tried in SE37, but i got an in-active FM - PRINT_SELECTOPTIONS!!)
    Thank you

    Hello,
    CALL FUNCTION 'PRINT_SELECTIONS'
        EXPORTING
          rname     = program name
          rvariante = sy-slset "It will catch the selected variant
          mode      = 'TABLE'
        TABLES
          infotab   = li_info.
    li_info table will contain all selection screen data, you will can restrict what needs to be shown on spool list!
    Thanks.

  • Trigger report program if Z table field is modified/created

    Hi,
    I have a requirement where i want to run the report program ONLY if a particular field ( Dispatch date ) is modified or updated of a 'Z' Table ( Custom Table ).
    The report program would fetch data from the same 'Z' table only for those records which are modified/updated. This data is then transferred to an application server.
    1. How should i trigger the report program for the above requirement.
    2. If a background program is to be created, then what should be the trigerring criteria & where it should be defined.
    3. Do i need to set any change pointers etc.
    Pointers to the above requirement would be very helpful.
    Thanks in advance,
    Best regards,
    Prashant

    hi prashant,
       i'm working on a similar query as that of ur's.
      see the logic is as we proceed in ur case is DISPATCH DATE say are to be modified in the process of inserting 0r changing the contents of a ZTABLE.
    so here the logic would be
    loop at itab.
    MODIFY ZTABLE FROM TABLE ITAB.
    endloop.
    This is the key reference in our logic .
    now it is known that u have a ZTABLE with dispatch date
    here the data element will be DATUM .
    now in the ZTABLE go to DISPATCH DATE filed i.e its DATA ELEMET double click on data element  DATUM .
    now if u see here there will be a tick called as Checkbox on change document which is enabling the CDHDR and CDPOS.
    *if its not checked get it checked in .
    This is the source to the logic.
    now what u need to do in ur logic part is
    1. collect all the entries of the table.
    (im not sure how many entries are there but try to get all the primary keys + one or two more fields so that the time is saved . this we do to check.
    2. before the modify comes into affect see if u can store all the content of the table i.e step 1.
    3.lets say we have modified the ZTABLE.
    4.now collect all the entries i.e newly modified into new inttab with same logic as the basic primary key configurations + two fields .
    5. let the two internal tables be compared and based on the comparision derive a new internal table as follows .
    REPORT ztemp .
    TYPES: BEGIN OF line,
              brand(10) TYPE c,
              rate(3)   TYPE p DECIMALS 2,
              gender(1) TYPE c,
              sno       TYPE i,
              desc(30)  TYPE c,
            END OF line.
    DATA: it_lines_1 TYPE TABLE OF line
                      WITH KEY brand
                               rate
                               gender,
           wa_lines_1 LIKE LINE OF it_lines_1.
    DATA: it_lines_2 TYPE TABLE OF line
                      WITH KEY brand
                               rate
                               gender,
           wa_lines_2 LIKE LINE OF it_lines_2.
    DATA: gi_counter TYPE i.
    START-OF-SELECTION.
       PERFORM fill_it_line_1. " not included; tested with your 4 records
       SORT it_lines_1.
       CLEAR gi_counter.
       LOOP AT it_lines_1 INTO wa_lines_1.
         wa_lines_2 = wa_lines_1.
         ADD 1 TO gi_counter.
         AT END OF gender.
           IF gi_counter > 1.
             APPEND wa_lines_2 TO it_lines_2.
           ENDIF.
           CLEAR gi_counter.
         ENDAT.
       ENDLOOP.
    This only works if you are able to define the fields of the internal table in this order, so with the key fields first in the right order. Otherwise the AT END OF will not work.
    6. now if u can reach upto here then we need not create a background program .
    7. u are exactly right change pointers will have to come into picture .
    8 .then comes the picture of moving this content to application server using datasets etc.
    hope this helps u in building the logic .
    i would like to hear from other developers too in this regard.
    Thanks and regards,
    vijay.

  • Basic Dialog Programming

    Hello Everybody and  hello World.
    I would like to know how to do a basic dialog programming..
    Can anyone help me?Please....
    give me some advice....Im very eager to learn that dialog programming
    Thanks in advance
    aVaDuDz

    hi
    INTRODUCTION TO DIALOG PROGRAMMING
    OVERVIEW
    There are programs in every domain that require certain amount of user interaction .Such requirements in ABAP are fulfilled with the help of a user dialog and dialog programming which encapsulates the entire logic pertaining to the required user dialog.
    One needs to take care that user interactions with the system are comfortable and user friendly along with being logically coherent.
    <u><i><b>
    What is a user dialog?</b></i></u>
    Any kind of user interaction with the system can be called as a user dialog:
    1)     Entering data on the screen.
    2)     Clicking a button.
    3)     Navigation between screens.
    <u><i><b>Need of dialog programming</b></i></u>
    In a typical dialog, the system displays a screen on which the user can enter or request information. As a reaction on the user input or request, the program executes the appropriate actions: it branches to the next screen, displays an output, or changes the database.
    Example
    A travel agent wants to book a flight. The agent enters the corresponding data on the screen. The system either confirms the desired request, that is, the agent can book the flight and the customer travels on the desired day on the reserved seat to the chosen destination, or the system displays the information that the flight is already booked up.
    To fulfill such requirements, a dialog program must offer:
    • A user-friendly user interface
    • Format and consistency checks for the data entered by the user
    • Easy correction of input errors
    • Access to data by storing it in the database.
    ABAP/4 offers a variety of tools and language elements to meet the requirements stated above in the dialog programs.
    <u><i><b>Why dialog programming is also known as module pool?</b></i></u>
    Dialog Programming consists of screens and corresponding ABAP program. Screens call dialog modules in the associated ABAP program from their flow logic. Type M programs serve principally as containers for these dialog modules, and hence dialog programming is also known as module pools. A module pool program is a program type which is not executable directly. You can not just run by hitting F8 like a report program. You must tie a transaction code to a screen in order to start the program.
    VARIOUS COMPONENTS OF A DIALOG PROGRAM
    Unlike report, interface or any conversion development which generally entails the creation of one autonomous program which can be executed independently of other objects, dialog program development entails development of multiple objects none of which can be executed on its own. Instead all objects are linked hierarchically to the main program and are executed in a sequence dictated by the Dialog Main Program.
    Components of a dialog program
    1)     Transaction
    2)     Screen
    3)     GUI status
    4)     ABAP program
    All these components are explained in detail below.
    1)     TRANSACTION  :
    The transaction starts a screen sequence. You create transaction codes in the Repository   Browser in the ABAP Workbench or using Transaction SE93. A transaction code is linked to an ABAP program and an initial screen. As well as using a transaction code, you can start a screen sequence from any ABAP program using the CALL SCREEN statement.
    2) SCREEN
    As a user of an R/3 system, one is always confronted with screens. From the moment one logs on, one can see a screen and one must perform actions on this screen. All those screens are components of ABAP programs. Generally, we define the screens of an ABAP program with the Screen Painter tool of the ABAP.
    In the R/3 system, screens are program objects that consist of two parts. First, they have a layout that defines the front end appearance of the window that is presented to the user. Second, they have a flow logic that is executed on the backend by the application server. The screen flow logic is a program layer between the front end and the actual ABAP application program at the backend. The language used to program screen flow logic has a similar syntax to ABAP, but is not part of ABAP itself. Unlike ABAP programs, the screen flow logic contains no explicit data declarations. You define the screen fields by placing elements on the screen mask instead. When you define screen fields by referring to data types in the ABAP Dictionary, the runtime environment automatically creates dialogs for field help, input help, and error handling that depends on the semantics of the data type in the dictionary.
    The screen flow logic is similar to an ABAP program in that it contains processing blocks. These processing blocks are event blocks that are triggered by the ABAP runtime environment. The most important event blocks are:
    • PROCESS BEFORE OUTPUT
    The respective event (PBO) is triggered after the PROCESS AFTER INPUT (PAI) processing of the previous screen and before the current screen is displayed.
    • PROCESS AFTER INPUT
    The respective event (PAI) is triggered when the user chooses a function on the current screen.
    • PROCESS ON HELP REQUEST
    This event is triggered when function key F1 is pressed.
    • PROCESS ON VALUE REQUEST
    This event is triggered when function key F4 is pressed.
    The main task of these processing blocks is to call ABAP dialog modules using the MODULE statement. During the PBO event, you can call any dialog module in the ABAP program that is marked with the addition OUTPUT. In the PAI event, you can call any dialog module program that is marked with the addition INPUT. The screens of an ABAP program can share the dialog modules of that program. You use the dialog modules called during PBO to prepare the screen and the dialog modules called during PAI to react to the user input.
    Each screen of an ABAP program has a unique screen number. The screens of an ABAP program can be combined to form screen sequences. Screen sequences are either built statically by setting the following screen in the Screen Painter or dynamically by overriding the static setting in the ABAP program. The last screen of a screen sequence is always the one where the following screen is set to zero.
    HANDLING USER INTERACTIONS
    A user can interact in various ways with screens. We distinguish between actions that trigger PAI and those that don’t. In general, filling input fields with values does not trigger PAI.
    Actions that do trigger PAI include:
    • Choosing a pushbutton on the screen.
    • Choosing a specially prepared check box or radio button on the screen.
    • Choosing a function in the menu, standard toolbar, or application toolbar.
    • Choosing a function key on the keyboard.
    ATTRIBUTES OF SCREEN
    Like all objects in the R/3 Repository, screens have attributes that both describe them and determine how they behave at runtime. Important screen attributes for ABAP programming:
    •     Program
    The name of the ABAP program (type 1, M, or F) to which the screen belongs.
    •     Screen number
    A four-digit number, unique within the ABAP program that identifies the screen within the program. If your program contains selection screens, remember that selection screens and Screen Painter screens use the same namespace. For example, if you have a program with a standard selection screen, you may not contain any further screens with the number 1000. Lists, on the other hand, have their own namespace.
    •     Screen type
    A normal screen occupies a whole GUI window. Modal dialog boxes only cover a part of a GUI window. Their interface elements are also arranged differently. Selection screens are generated automatically from the definition in the ABAP program. You may not define them using the Screen Painter. A subscreen is a screen that you can display in a subscreen area on a different screen in the same ABAP program.
    •     Next screen
    Statically-defined screen number, specifying the next screen in the sequence. If you enter zero or leave the field blank, you define the current screen as the last in the chain. If the next screen is the same as the current screen, the screen will keep on calling itself. You can override the statically-defined next screen in the ABAP program.
    •     Cursor position
    Static definition of the screen element on which the cursor is positioned when the screen is displayed. By default, the cursor appears on the first input field. You can overwrite the static cursor position dynamically in your ABAP program by using SET CURSOR FIELD <f>
    •     Screen group
    Four-character ID, placed in the system field SY-DYNGR while the screen is being processed. This allows you to assign several screens to a common screen group. You can use this, for example, to modify all of the screens in the group in a uniform way. Screen groups are stored in table TFAWT.
    •     Hold data
    If the user calls the screen more than once during a terminal session, he or she can retain changed data as default values by choosing System -> User profile -> Hold data.
    VARIOUS SCREEN ELEMENTS
    A screen can contain a wide variety of elements, either for displaying field contents, or for allowing the user to interact with the program (for example, filling out input fields or choosing pushbutton functions). We use the Screen Painter to arrange elements on the screen.
    We can use the following elements:
    •     Text fields
    Display elements, which cannot be changed either by the user or by the ABAP program.
    •     Input/output fields and templates
    Used to display data from the ABAP program or for entering data on the screen. Linked to screen fields.
    •     Dropdown list boxes
    Special input/output fields that allow users to choose one entry from a fixed list of possible entries.
    •      Checkbox elements
    Special input/output fields that the user can either select (value ‘X’) or deselect (value SPACE). Checkbox elements can be linked with function codes.
    •     Radio button elements
    Special input/output fields that are combined into groups. Within a radio button group, only a single button can be selected at any one time. When the user selects one button, all of the others are automatically deselected. Radio button elements can be linked with function codes.
    •     Pushbuttons
    Elements on the screen that trigger the PAI event of the screen flow logic when chosen by the user. There is a function code attached to each pushbutton, which is passed to the ABAP program when it is chosen.
    •     Frame
    Pure display elements that group together elements on the screen, such as radio button groups.
    •     Subscreens
    Area on the screen in which you can place another screen.
    •     Table controls
    Tabular input/output fields.
    •     Tab strip controls
    Areas on the screen in which you can switch between various pages.
    •     Custom Controls
    Areas on the screen in which you can display controls. Controls are software components of the presentation server.
    •     Status icons
    Display elements, indicating the status of the application program.
    •     OK field
    Every screen has a twenty-character OK_CODE field (also known as the function code field) that is not displayed directly on the screen. User actions that trigger the PAI event also place the corresponding function code into this field, from where it is passed to the ABAP program. You can also use the command field in the standard toolbar to enter the OK field. To be able to use the OK field, you need to assign a name to it.
    All screen elements have a set of attributes, some of which are set automatically, others of which have to be specified in the Screen Painter. They determine things such as the layout of the screen elements on the screen. You can set the attributes of screen elements in the Screen Painter - either for a single element, or using the element list, which lists all of the elements belonging to the current screen. Some of the attributes that you set statically in the Screen Painter can be overwritten dynamically in the ABAP program.
         3) GUI STATUS
    Each screen has a GUI status. This controls the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application. Like screens, GUI statuses are independent components of an ABAP program. You create them in the ABAP Workbench using the Menu Painter.
    4) PROGRAM
    Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also called a module pool, since it consists of interactive modules. Each screen and GUI status in the R/3 System belongs to one ABAP program. The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status. ABAP programs that use screens are also known as dialog programs.
    In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.
    DATA TRANSFER BETWEEN SCREEN AND ABAP PROGRAM
    During PAI, the system automatically transports all screen fields to identically named global ABAP program fields. At the end of the last PBO module, and before the screen is displayed, all of the data is transported from the ABAP program to any identically named fields in the screen. By standard, all screen data is transported immediately before PAI processing starts. But for the dedicated handling of screen fields — for example, to carry out an error dialog — you can control the moment at which data is passed from screen fields to their corresponding ABAP fields by using the FIELD statement in the screen flow logic.
    regards
    navjot
    reward points if helpfull

  • Help needed in report programming

    Hi All
    I am processing some data on first screen of a report transaction and an output is displayed on second screen. My requirement is that when I press back, I have to come to SAP initial screen.
    I have tried all options with 'LEAVE'. Problem is that control doesnt come even once in report, it goes into some standard code so I am unable to make changes..
    Kindly help.
    Thanks
    Dinesh
    <LOCKED BY MODERATOR - USE APPROPRIATE TITLES>
    <LOCKED BY MODERATOR - URGENT, PLEASE HELP OR SIMILAR ARE FORBIDDEN>
    Edited by: Alvaro Tejada Galindo on Aug 18, 2008 5:17 PM

    Hi,
    Since it is a report program. U have to set PF status in ur output page (either ALV or any other output format).
    In GUI status, triger the function code for BACK.
    Then, inside the event AT USER-COMMAND, code LEAVE PROGRAM for the BACK function.
    If it is an ALV output, the PF-status and User-command event should be called in the ALV function module.
    Regards,
    Prem

  • Problem WIth Variant in a report program

    I have a z report program with couple of variants , the problem is the varaints display onlt name of the variant and description when the varaint button is pressed.
    The changed by , date etc details are not getting displayed.
    Thanks
    Arun

    Hi Arun,
    You will not get those data directly from the program execution screen. If you want to get those details, please check table VARID for that variant or program.
    Regards,
    Sourav

  • Can we create purchase order through report programming?

    hi experts.....
    can we create purchase order through report programming?If yes plz give me the thread details?

    Hi,
    Use this code in a program by using a BAPI function module
    Anothe rway is using classical/ALV report using call transaction from a report for changing the PO
    loop at i_header.
        header-ref_1         = i_header-legacy.
        headerx-ref_1        = c_x.
        header-doc_type      = i_header-bsart.
        headerx-doc_type     = c_x.
        header-comp_code     = i_header-bukrs.
        headerx-comp_code    = c_x.
        header-purch_org     = i_header-ekorg.
        headerx-purch_org    = c_x.
        header-pur_group     = i_header-ekgrp.
        headerx-pur_group    = c_x.
        header-vendor        = i_header-lifnr.
        headerx-vendor       = c_x.
        concatenate i_header-bedat+4(4)
                    i_header-bedat+0(2)
                    i_header-bedat+2(2)
                    into header-doc_date.
        headerx-doc_date     = c_x.
        header-created_by    = i_header-ernam.
        headerx-created_by   = c_x.
        header-currency      = i_header-waers.
        headerx-currency     = c_x.
        concatenate i_header-kdatb+4(4)
                    i_header-kdatb+0(2)
                    i_header-kdatb+2(2)
                    into header-vper_start.
        headerx-vper_start   = c_x.
        loop at i_items where legacy = i_header-legacy.
          item-po_item            =  i_items-ebelp.
          itemx-po_item           =  i_items-ebelp.
          itemx-po_itemx          =  c_x.
          if i_header-bsart = 'NB'.
            item-material            =  i_items-ematn.
            itemx-material           =  c_x.
            schedule-quantity        =  i_items-menge * 1000.
            schedulex-quantity       =  c_x.
          else.
            item-short_text          = i_items-ematn.
            itemx-short_text         = c_x.
            item-matl_group          = '1000'.
            itemx-matl_group         = c_x.
            schedule-quantity        =  '1'.
            schedulex-quantity       =  c_x.
          endif.
          item-plant               =  i_items-werks.
          itemx-plant              =  c_x.
          schedule-po_item         = i_items-ebelp.
          schedule-sched_line      = '1'.
          schedulex-po_item        = i_items-ebelp.
          schedulex-sched_line     = '1'.
          schedulex-po_itemx       = c_x.
          schedulex-sched_linex    = c_x.
          concatenate  i_items-eildt+0(2)
                       i_items-eildt+2(2)
                       i_items-eildt+4(4)
                       into schedule-delivery_date.
          schedulex-delivery_date  =  c_x.
          item-price_unit          =  i_items-peinh * 100.
          itemx-price_unit         =  c_x.
          item-tax_code            =  i_items-mwskz.
          itemx-tax_code           =  c_x.
          item-shipping            =  i_items-evers.
          itemx-shipping           =  c_x.
          account-po_item          = i_items-ebelp.
          accountx-po_item         = i_items-ebelp.
          accountx-po_itemx        = c_x.
          if i_header-bsart = 'FO'.
            item-pckg_no  = sy-tabix.
            itemx-pckg_no = 'X'.
            limits-pckg_no        = sy-tabix.
            limits-limit          = i_items-overalllimit.
            limits-exp_value      = i_items-expectedoverall.
            posrvaccessvalues-pckg_no    = sy-tabix.
            posrvaccessvalues-line_no    = '0'.
            posrvaccessvalues-serno_line = '00'.
            posrvaccessvalues-percentage = '100.0'.
            posrvaccessvalues-serial_no  = '01'.
            account-serial_no     = '1'.
            accountx-serial_no    = '1'.
            accountx-serial_nox   = c_x.
            account-quantity  = '1'.
            accountx-quantity = c_x.
            call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                input  = i_items-kostl
              importing
                output = account-costcenter.
            accountx-costcenter   = c_x.
            call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                input  = i_items-sakto
              importing
                output = account-gl_account.
            accountx-gl_account   = c_x.
            item-acctasscat       = i_items-knttp.
            itemx-acctasscat      = c_x.
            item-item_cat         = i_items-epstp.
            itemx-item_cat        = c_x.
          endif.
          append:item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
          clear :item,itemx,schedule,schedulex,account,accountx,limits,posrvaccessvalues.
        endloop.
        call function 'BAPI_PO_CREATE1'
          exporting
            poheader                     = header
            poheaderx                    = headerx
    *   POADDRVENDOR                 =
    *   TESTRUN                      =
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   POEXPIMPHEADER               =
    *   POEXPIMPHEADERX              =
    *   VERSIONS                     =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
    *   NO_PRICE_FROM_PO             =
            importing
            exppurchaseorder             = ponumber
    *   EXPHEADER                    =
    *   EXPPOEXPIMPHEADER            =
            tables
            return                       = return
            poitem                       = item
            poitemx                      = itemx
    *   POADDRDELIVERY               =
            poschedule                   = schedule
            poschedulex                  = schedulex
            poaccount                    = account
    *   POACCOUNTPROFITSEGMENT       =
            poaccountx                   = accountx
    *   POCONDHEADER                 =
    *   POCONDHEADERX                =
    *   POCOND                       =
    *   POCONDX                      =
            polimits                     = limits
    *   POCONTRACTLIMITS             =
    *   POSERVICES                   =
       posrvaccessvalues            = posrvaccessvalues.
    *   POSERVICESTEXT               =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   POEXPIMPITEM                 =
    *   POEXPIMPITEMX                =
    *   POTEXTHEADER                 =
    *   POTEXTITEM                   =
    *   ALLVERSIONS                  =
    *   POPARTNER                    =
        if ponumber eq space.
          loop at return where type = 'E'.
            clear buffer.
            move-corresponding return to e_return.
            concatenate i_header-legacy e_return into buffer.
            transfer buffer to p2_file.
          endloop.
          move-corresponding i_header to i_eheader.
          transfer i_eheader to p3_file.
          loop at i_items where legacy = i_header-legacy.
            move-corresponding i_items to i_eitems.
            transfer i_eitems to p4_file.
          endloop.
        else.
          commit work and wait.
        endif.
        clear:ponumber,header,headerx,item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
        refresh:item,itemx,account,accountx,limits,return,schedule,schedulex,posrvaccessvalues.
      endloop.
      close dataset p2_file.
      close dataset p3_file.
      close dataset p4_file.
    Regards
    Krishna

Maybe you are looking for

  • Save page input to a file

    Hi, I have a task where a user should be able to save the nput on a page to a file. The page contains a form and a tabular form. The user must also have the possibility to upload the saved files and save the corresponding data to the database. This o

  • Moving enemy to a random available tile

    I have an enemy hitting a bunch of tiles, and through a loop, I check all the tiles if the enemy is hitting them. I trace them and some will tell me if it's true or false. Although you can't see tileset, it is an array that is equal to a movieclip th

  • How to insert LOGO in a simple report output

    Hi all, I need to insert a logo in a simple report output. can anybody help me

  • Seting a JSp variable to session scope in JSp page itself

    Hi, I have code like this <HTML>      <HEAD>           <TITLE>Change Password</TITLE>           <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet/vclinical.css" TITLE="Style"> </HEAD> <BODY> <form name="form"> <select name="ss" onChange="this.

  • HT5957 How to improve speed in Iphone 4 using ios 7

    I am using Iphone 4 and updated IOS 7, But speed is very in compare to last version. Please advice me to increase the speed. Opening contact very low. call to any number is very low.