'how to code for table control wizard in module pool program

Hi Gurus,
Please provide me a sample code of table control wizard...
Thanks in advance!!!!
Regards,
Kranthi

Hi Kranti,
check this code... it should be helpful
*& Module pool       Z_TABLE_CONTROL_WIZARD_DEMO                       *
PROGRAM  z_table_control_wizard_demo             .
DATA: BEGIN OF lt_vbak OCCURS 0,
       flag  TYPE c,
       vbeln TYPE vbeln_va,
       netwr TYPE netwr,
       kunnr TYPE kunnr,
      END OF lt_vbak.
DATA: sfkunnr TYPE kunnr.
*&spwizard: declaration of tablecontrol 'TCONTROL' itself
CONTROLS: tcontrol TYPE TABLEVIEW USING SCREEN 9000.
*&spwizard: lines of tablecontrol 'TCONTROL'
DATA:     g_tcontrol_lines  LIKE sy-loopc.
DATA:     ok_code LIKE sy-ucomm.
*&spwizard: output module for tc 'TCONTROL'. do not change this line!
*&spwizard: update lines for equivalent scrollbar
MODULE tcontrol_change_tc_attr OUTPUT.
  DESCRIBE TABLE lt_vbak LINES tcontrol-lines.
ENDMODULE.                    "TCONTROL_change_tc_attr OUTPUT
*&spwizard: output module for tc 'TCONTROL'. do not change this line!
*&spwizard: get lines of tablecontrol
MODULE tcontrol_get_lines OUTPUT.
  g_tcontrol_lines = sy-loopc.
ENDMODULE.                    "TCONTROL_get_lines OUTPUT
*&spwizard: input module for tc 'TCONTROL'. do not change this line!
*&spwizard: modify table
MODULE tcontrol_modify INPUT.
  MODIFY lt_vbak
    INDEX tcontrol-current_line.
ENDMODULE.                    "TCONTROL_modify INPUT
*&spwizard: input modul for tc 'TCONTROL'. do not change this line!
*&spwizard: mark table
MODULE tcontrol_mark INPUT.
  DATA: g_tcontrol_wa2 LIKE LINE OF lt_vbak.
  IF tcontrol-line_sel_mode = 1.
    LOOP AT lt_vbak INTO g_tcontrol_wa2
      WHERE flag = 'X'.
      g_tcontrol_wa2-flag = ''.
      MODIFY lt_vbak
        FROM g_tcontrol_wa2
        TRANSPORTING flag.
    ENDLOOP.
  ENDIF.
  MODIFY lt_vbak
    INDEX tcontrol-current_line
    TRANSPORTING flag.
ENDMODULE.                    "TCONTROL_mark INPUT
*&spwizard: input module for tc 'TCONTROL'. do not change this line!
*&spwizard: process user command
MODULE tcontrol_user_command INPUT.
  ok_code = sy-ucomm.
  PERFORM user_ok_tc USING    'TCONTROL'
                              'LT_VBAK'
                              'FLAG'
                     CHANGING ok_code.
  sy-ucomm = ok_code.
ENDMODULE.                    "TCONTROL_user_command INPUT
*   INCLUDE TABLECONTROL_FORMS                                         *
*&      Form  USER_OK_TC                                               *
FORM user_ok_tc USING    p_tc_name TYPE dynfnam
                         p_table_name
                         p_mark_name
                CHANGING p_ok      LIKE sy-ucomm.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
  DATA: l_ok              TYPE sy-ucomm,
        l_offset          TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
*&SPWIZARD: Table control specific operations                          *
*&SPWIZARD: evaluate TC name and operations                            *
  SEARCH p_ok FOR p_tc_name.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
  l_offset = STRLEN( p_tc_name ) + 1.
  l_ok = p_ok+l_offset.
*&SPWIZARD: execute general and TC specific operations                 *
  CASE l_ok.
    WHEN 'INSR'.                      "insert row
      PERFORM fcode_insert_row USING    p_tc_name
                                        p_table_name.
      CLEAR p_ok.
    WHEN 'DELE'.                      "delete row
      PERFORM fcode_delete_row USING    p_tc_name
                                        p_table_name
                                        p_mark_name.
      CLEAR p_ok.
    WHEN 'P--' OR                     "top of list
         'P-'  OR                     "previous page
         'P+'  OR                     "next page
         'P++'.                       "bottom of list
      PERFORM compute_scrolling_in_tc USING p_tc_name
                                            l_ok.
      CLEAR p_ok.
*     WHEN 'L--'.                       "total left
*       PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME.
*     WHEN 'L-'.                        "column left
*       PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME.
*     WHEN 'R+'.                        "column right
*       PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME.
*     WHEN 'R++'.                       "total right
*       PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME.
    WHEN 'MARK'.                      "mark all filled lines
      PERFORM fcode_tc_mark_lines USING p_tc_name
                                        p_table_name
                                        p_mark_name   .
      CLEAR p_ok.
    WHEN 'DMRK'.                      "demark all filled lines
      PERFORM fcode_tc_demark_lines USING p_tc_name
                                          p_table_name
                                          p_mark_name .
      CLEAR p_ok.
*     WHEN 'SASCEND'   OR
*          'SDESCEND'.                  "sort column
*       PERFORM FCODE_SORT_TC USING P_TC_NAME
*                                   l_ok.
  ENDCASE.
ENDFORM.                              " USER_OK_TC
*&      Form  FCODE_INSERT_ROW                                         *
FORM fcode_insert_row
              USING    p_tc_name           TYPE dynfnam
                       p_table_name             .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
  DATA l_lines_name       LIKE feld-name.
  DATA l_selline          LIKE sy-stepl.
  DATA l_lastline         TYPE i.
  DATA l_line             TYPE i.
  DATA l_table_name       LIKE feld-name.
  FIELD-SYMBOLS <tc>                 TYPE cxtab_control.
  FIELD-SYMBOLS <table>              TYPE STANDARD TABLE.
  FIELD-SYMBOLS <lines>              TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
  ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc                     *
  CONCATENATE p_table_name '[]' INTO l_table_name. "table body
  ASSIGN (l_table_name) TO <table>.                "not headerline
*&SPWIZARD: get looplines of TableControl                              *
  CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
  ASSIGN (l_lines_name) TO <lines>.
*&SPWIZARD: get current line                                           *
  GET CURSOR LINE l_selline.
  IF sy-subrc <> 0.                   " append line to table
    l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line                                               *
    IF l_selline > <lines>.
      <tc>-top_line = l_selline - <lines> + 1 .
    ELSE.
      <tc>-top_line = 1.
    ENDIF.
  ELSE.                               " insert line into table
    l_selline = <tc>-top_line + l_selline - 1.
    l_lastline = <tc>-top_line + <lines> - 1.
  ENDIF.
*&SPWIZARD: set new cursor line                                        *
  l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line                                        *
  INSERT INITIAL LINE INTO <table> INDEX l_selline.
  <tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor                                                 *
  SET CURSOR LINE l_line.
ENDFORM.                              " FCODE_INSERT_ROW
*&      Form  FCODE_DELETE_ROW                                         *
FORM fcode_delete_row
              USING    p_tc_name           TYPE dynfnam
                       p_table_name
                       p_mark_name   .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
  DATA l_table_name       LIKE feld-name.
  FIELD-SYMBOLS <tc>         TYPE cxtab_control.
  FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
  FIELD-SYMBOLS <wa>.
  FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
  ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc                     *
  CONCATENATE p_table_name '[]' INTO l_table_name. "table body
  ASSIGN (l_table_name) TO <table>.                "not headerline
*&SPWIZARD: delete marked lines                                        *
  DESCRIBE TABLE <table> LINES <tc>-lines.
  LOOP AT <table> ASSIGNING <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header         *
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    IF <mark_field> = 'X'.
      DELETE <table> INDEX syst-tabix.
      IF sy-subrc = 0.
        <tc>-lines = <tc>-lines - 1.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                              " FCODE_DELETE_ROW
*&      Form  COMPUTE_SCROLLING_IN_TC
*       text
*      -->P_TC_NAME  name of tablecontrol
*      -->P_OK       ok code
FORM compute_scrolling_in_tc USING    p_tc_name
                                      p_ok.
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
  DATA l_tc_new_top_line     TYPE i.
  DATA l_tc_name             LIKE feld-name.
  DATA l_tc_lines_name       LIKE feld-name.
  DATA l_tc_field_name       LIKE feld-name.
  FIELD-SYMBOLS <tc>         TYPE cxtab_control.
  FIELD-SYMBOLS <lines>      TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
  ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get looplines of TableControl                              *
  CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.
  ASSIGN (l_tc_lines_name) TO <lines>.
*&SPWIZARD: is no line filled?                                         *
  IF <tc>-lines = 0.
*&SPWIZARD: yes, ...                                                   *
    l_tc_new_top_line = 1.
  ELSE.
*&SPWIZARD: no, ...                                                    *
    CALL FUNCTION 'SCROLLING_IN_TABLE'
         EXPORTING
              entry_act             = <tc>-top_line
              entry_from            = 1
              entry_to              = <tc>-lines
              last_page_full        = 'X'
              loops                 = <lines>
              ok_code               = p_ok
              overlapping           = 'X'
         IMPORTING
              entry_new             = l_tc_new_top_line
         EXCEPTIONS
*              NO_ENTRY_OR_PAGE_ACT  = 01
*              NO_ENTRY_TO           = 02
*              NO_OK_CODE_OR_PAGE_GO = 03
              OTHERS                = 0.
  ENDIF.
*&SPWIZARD: get actual tc and column                                   *
  GET CURSOR FIELD l_tc_field_name
             AREA  l_tc_name.
  IF syst-subrc = 0.
    IF l_tc_name = p_tc_name.
*&SPWIZARD: et actual column                                           *
      SET CURSOR FIELD l_tc_field_name LINE 1.
    ENDIF.
  ENDIF.
*&SPWIZARD: set the new top line                                       *
  <tc>-top_line = l_tc_new_top_line.
ENDFORM.                              " COMPUTE_SCROLLING_IN_TC
*&      Form  FCODE_TC_MARK_LINES
*       marks all TableControl lines
*      -->P_TC_NAME  name of tablecontrol
FORM fcode_tc_mark_lines USING p_tc_name
                               p_table_name
                               p_mark_name.
*&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------*
  DATA l_table_name       LIKE feld-name.
  FIELD-SYMBOLS <tc>         TYPE cxtab_control.
  FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
  FIELD-SYMBOLS <wa>.
  FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
  ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc                     *
  CONCATENATE p_table_name '[]' INTO l_table_name. "table body
  ASSIGN (l_table_name) TO <table>.                "not headerline
*&SPWIZARD: mark all filled lines                                      *
  LOOP AT <table> ASSIGNING <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header         *
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    <mark_field> = 'X'.
  ENDLOOP.
ENDFORM.                                          "fcode_tc_mark_lines
*&      Form  FCODE_TC_DEMARK_LINES
*       demarks all TableControl lines
*      -->P_TC_NAME  name of tablecontrol
FORM fcode_tc_demark_lines USING p_tc_name
                                 p_table_name
                                 p_mark_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
  DATA l_table_name       LIKE feld-name.
  FIELD-SYMBOLS <tc>         TYPE cxtab_control.
  FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
  FIELD-SYMBOLS <wa>.
  FIELD-SYMBOLS <mark_field>.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
  ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc                     *
  CONCATENATE p_table_name '[]' INTO l_table_name. "table body
  ASSIGN (l_table_name) TO <table>.                "not headerline
*&SPWIZARD: demark all filled lines                                    *
  LOOP AT <table> ASSIGNING <wa>.
*&SPWIZARD: access to the component 'FLAG' of the table header         *
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    <mark_field> = space.
  ENDLOOP.
ENDFORM.                                          "fcode_tc_mark_lines
*&      Module  STATUS_9000  OUTPUT
*       text
MODULE status_9000 OUTPUT.
  SET PF-STATUS 'S9000'.
  SET TITLEBAR 'T9000'.
ENDMODULE.                 " STATUS_9000  OUTPUT
*&      Module  USER_COMMAND_9000  INPUT
*       text
MODULE user_command_9000 INPUT.
  CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
      LEAVE TO SCREEN 0.
    WHEN 'DISP'.
      SELECT vbeln netwr kunnr INTO CORRESPONDING FIELDS OF TABLE lt_vbak
      FROM vbak
      WHERE kunnr = sfkunnr.
*    LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].
*    By default, the dialog processor returns to the PBO processing of
*    the screen from which the list processor was called. The optional
*    addition AND RETURN TO SCREEN allows you to specify a different
*    screen in the current screen sequence at whose PBO event you want
*    to resume processing.
    when 'LIST'.
    LEAVE TO LIST-PROCESSING.
    WRITE:/ 'Time  :', SY-UZEIT.
    LOOP AT LT_VBAK.
    WRITE:/ LT_VBAK-VBELN,
            LT_VBAK-NETWR,
            LT_VBAK-KUNNR.
    ENDLOOP.
    WHEN 'SUBM'.
*& You can call executable programs from other ABAP programs using the
*& following statement:
*& SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
      SUBMIT z_submit_report VIA SELECTION-SCREEN AND RETURN.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_9000  INPUT
                                                 TABLE CONTROL WIZARD SE51 CODE
PROCESS BEFORE OUTPUT.
*&spwizard: pbo flow logic for tablecontrol 'TCONTROL'
  module TCONTROL_change_tc_attr.
*&spwizard: module TCONTROL_change_col_attr.
  loop at   LT_VBAK
       with control TCONTROL
       cursor TCONTROL-current_line.
    module TCONTROL_get_lines.
*&spwizard:   module TCONTROL_change_field_attr
  endloop.
MODULE STATUS_9000.
PROCESS AFTER INPUT.
*&spwizard: pai flow logic for tablecontrol 'TCONTROL'
  loop at LT_VBAK.
    chain.
      field LT_VBAK-VBELN.
      field LT_VBAK-NETWR.
      field LT_VBAK-KUNNR.
      module TCONTROL_modify on chain-request.
    endchain.
    field LT_VBAK-FLAG
      module TCONTROL_mark on request.
  endloop.
  module TCONTROL_user_command.
*&spwizard: module TCONTROL_change_tc_attr.
*&spwizard: module TCONTROL_change_col_attr.
MODULE USER_COMMAND_9000.
regards
padma

Similar Messages

  • How to hide the table control column in module pool

    Dear Experts,
    Please help me on this
    I have 2 screens 9000 and 9001 . In screen 9000 I have 2 radio buttons if I select the 2nd radiobutton then the screen  9001 should display inthat some column has to be hide inthe table control. I have used this code but still it is not hiding please help me on that
    I used this code in PBO of 9001 screen
    LOOP AT SCREEN.
        IF wopr = 'X'.
          IF screen-group2 = 'ABC'.
            IF screen-name = 'ZMMT_EKKO-MATNR' or screen-name = 'ZMMT_EKKO-BANFN'.
            screen-active = ''.
              screen-invisible = '1'.
              screen-input = ''.
              MODIFY SCREEN.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDLOOP.
    Even I tried this code also in the same screen 9001
    loop at tbl_rfq-cols into cols.
    IF wopr = 'X'.
    IF screen-group2 = 'ABC'.
    IF cols-screen-name = 'ZMMT_EKKO-MATNR' or cols-screen-name = 'ZMMT_EKKO-BANFN'.
    cols-screen-input = '0'.
    cols-invisible = '1'.
    endif.
    MODIFY tbl_rfq-cols FROM cols INDEX sy-tabix.
    endif.
    endif.
    endloop.

    Hi Balaji,
    To hide a column in a table control on screen.
    In the PBO of the screen, inside
    loop with control <tab_ctrl_name>.
    module modify_tab.
    endloop.
    Say for a column, you take group1 as 'ABC'.
    In this module you can use the group for the input/output fields and the display/hide them as per your requirements.
    if <condition>.
    loop at screen.
      if screen-group1 = 'ABC'. "say textbox (column for a table) has group1 as ABC
       screen-invisible = 'X'. "hide a column
       screen-active = ' '.
      endif.
      modify screen.
    elseif <condition>.
    loop at screen.
      if screen-group1 = 'ABC'. "say textbox (column for a table) has group1 as ABC
       screen-invisible = ' '. "display a column
       screen-active = 'X'.
      endif.
      modify screen.
    endif.
    Similarly, you can use this code for other columns also.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • How to save Custom control records through module pool program ?

    Hi guru ,
    1. How to save Custom control records through module pool program ?
    I wrote multiple lines of record in custom control
    Who to save that records ?
    thanking you.
    Regards,
    Subash.

    Hi,
    can refer following code -
    IN PAI , CODE is as follows-
    *&      Form  editor_output
    FORM editor_output .
    NARRATION1 is name of custom controller
      IF v_editor IS INITIAL.
      Create obejct for custom container
        CREATE OBJECT v_custom_container
          EXPORTING
            container_name              = 'NARRATION1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      Create obejct for the TextEditor control
        CREATE OBJECT v_editor
          EXPORTING
            wordwrap_mode              = cl_gui_textedit=>wordwrap_at_fixed_position
            wordwrap_position          = line_length
            wordwrap_to_linebreak_mode = cl_gui_textedit=>true
            parent                     = v_custom_container
          EXCEPTIONS
            error_cntl_create          = 1
            error_cntl_init            = 2
            error_cntl_link            = 3
            error_dp_create            = 4
            gui_type_not_supported     = 5
            OTHERS                     = 6.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " editor_output
    getting textdata in internal table as follows
    *&      Form  create_text
    FORM create_text .
      REFRESH : it_texttable,
                it_text.
      IF v_doc_number IS NOT INITIAL.
        IF v_editor IS NOT INITIAL.
          CALL METHOD v_editor->get_text_as_r3table
            IMPORTING
              table                  = it_texttable
            EXCEPTIONS
              error_dp               = 1
              error_cntl_call_method = 2
              error_dp_create        = 3
              potential_data_loss    = 4
              OTHERS                 = 5.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Now, our final text data is in internal table it_texttable.
    pls, Reward if found helpful.

  • F4 help for the screen fields in module pool program

    Hi All,
      I have a requirement that, i want to provide F4 help for the 2 fields in module pool program. the fields are document number and fiscal year from rbkp table.
    i could provide search help for two fields.
    but how to select matching fiscal year for that document number.
    problem: i am getting fiscal year as first four digits of document number.
    please help me to solve this problem.
    Thanks & Regards,
    Namratha.V

    Hi,
       If your requirement is after selecting the document no from f4 help then the corresponding year should be updated in the document year field then use FM --> DYNP_VALUES_UPDATE
    In  this function module pass the screen no program & field for which u want to update value

  • Table maintenance by using module pool program

    Hi
    Please give me step by step procedure to generate table maintenance by using module pool program

    While creating table maintenance, you can go thro' the module pool program used for that.In that,in PBO part,just try making particular field active = 1 inside loop at screen.
    Girish Kumar Lo...  
    Posts: 1,518
    Questions: 2
    Registered: 4/19/07
    Forum points: 1,982 
       Re: Regarding Table maintanence generator  
    Posted: Jun 26, 2007 9:02 AM    in response to: Younus Khan       Reply      E-mail this post 
    here is the code for that
    REPORT ZTAB_MAINT
           NO STANDARD PAGE HEADING
           MESSAGE-ID ZZ.
                      T Y P E  D E C L A R A T I O N S
    *--Types declaration for selection to be passed as parameter into
    *--VIEW_MAINTENANCE_CALL FM
    TYPES: BEGIN OF TP_RANGETAB.
            INCLUDE STRUCTURE VIMSELLIST.
    TYPES: END OF TP_RANGETAB.
                   D A T A  D E C L A R A T I O N S
    DATA: V_MATNR TYPE MATNR,              " Material Number
          V_WERKS TYPE WERKS_D,              " Plant
          V_KONOB TYPE KONOB,              " Product allocation object
          V_ZCPLT(40) TYPE C.              " Message
           I N T E R N A L  T A B L E  D E C L A R A T I O N S
    Internal table to subroutine code
    *Internal table used as selection for VIEW_MAINTENANCE_CALL FM
    DATA: IT_RANGETAB TYPE STANDARD TABLE OF TP_RANGETAB WITH HEADER LINE.
    *--Internal table used for getting the tablefields
    DATA: BEGIN OF IT_HEADER OCCURS 1.
            INCLUDE STRUCTURE VIMDESC.
    DATA: END   OF IT_HEADER.
    *--Name Tabel
    DATA: BEGIN OF IT_NAMTAB OCCURS 50.
            INCLUDE STRUCTURE VIMNAMTAB.
    DATA: END   OF IT_NAMTAB.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_MATNR OCCURS 0,
            MATNR TYPE MATNR,
          END OF IT_MATNR.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_WERKS OCCURS 0,
            WERKS TYPE WERKS,
          END OF IT_WERKS.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_KONOB OCCURS 0,
            KONOB TYPE KONOB,
          END OF IT_KONOB.
    *--Used for handling 'BT' option
    DATA: BEGIN OF IT_ZCPLT OCCURS 0,
            ZCPLT(40) TYPE C,
          END OF IT_ZCPLT.
                       I N P U T  S C R E E N
    SELECTION-SCREEN BEGIN OF BLOCK SELSCR WITH FRAME TITLE TEXT-001.
    RANGES: R_MATNR FOR V_MATNR.
    RANGES: R_WERKS FOR V_WERKS.
    RANGES: R_KONOB FOR V_KONOB.
    RANGES: R_ZCPLT FOR V_ZCPLT.
    Select Options
    SELECT-OPTIONS: S_MATNR FOR V_MATNR NO-EXTENSION,     " Material
                    S_WERKS FOR V_WERKS NO-EXTENSION,     " Plant
                    S_KONOB FOR V_KONOB NO-EXTENSION,
                                            " Product allocation object
                    S_ZCPLT FOR V_ZCPLT NO-EXTENSION.     " Plant
    SELECTION-SCREEN END OF BLOCK SELSCR.
                 A T  S E L E C T I O N  S C R E E N
    AT SELECTION-SCREEN.
    Validate user inputs
      PERFORM FRM_VALIDATIONS.
                S T A R T  O F  S E L E C T I O N
    START-OF-SELECTION.
    Fetch Data from Data Base
      PERFORM FRM_GET_DATA.
                         S U B  R O U T I N E S
    *&      Form  frm_get_data
          Call the function module VIEW_MAINTENNACE_CALL to get data
          based on selection criteria
    FORM FRM_GET_DATA .
      CALL FUNCTION 'VIEW_GET_DDIC_INFO'
        EXPORTING
          VIEWNAME = 'ZTAB'
        TABLES
          X_HEADER = IT_HEADER
          X_NAMTAB = IT_NAMTAB
          SELLIST  = IT_RANGETAB
        EXCEPTIONS
          NO_TVDIR_ENTRY = 1
          TABLE_NOT_FOUND = 2.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Error in ZTAB table'(005).
      ENDIF.
      CLEAR: IT_RANGETAB,
             IT_RANGETAB[].
      LOOP AT IT_NAMTAB.
        CASE IT_NAMTAB-VIEWFIELD.
          WHEN 'MATNR'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'MATNR'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_MATNR.
              CASE S_MATNR-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_MATNR-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_MATNR,
                         R_MATNR[].
                  R_MATNR-SIGN = 'I'.
                  R_MATNR-OPTION = 'BT'.
                  R_MATNR-LOW = S_MATNR-LOW.
                  R_MATNR-HIGH = S_MATNR-HIGH.
                  APPEND R_MATNR.
                  SELECT MATNR
                         INTO TABLE IT_MATNR
                         FROM ZTAB
                         WHERE MATNR IN R_MATNR.
                  DELETE ADJACENT DUPLICATES FROM IT_MATNR COMPARING MATNR
                  LOOP AT IT_MATNR.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_MATNR-MATNR.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_MATNR-OPTION.
                  IT_RANGETAB-VALUE    = S_MATNR-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'WERKS'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'WERKS'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_WERKS.
              CASE S_WERKS-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_WERKS-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_WERKS,
                         R_WERKS[].
                  R_WERKS-SIGN = 'I'.
                  R_WERKS-OPTION = 'BT'.
                  R_WERKS-LOW = S_WERKS-LOW.
                  R_WERKS-HIGH = S_WERKS-HIGH.
                  APPEND R_WERKS.
                  SELECT WERKS
                         INTO TABLE IT_WERKS
                         FROM MARC
                         WHERE WERKS IN R_WERKS.
                  DELETE ADJACENT DUPLICATES FROM IT_WERKS COMPARING WERKS
                  LOOP AT IT_WERKS.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_WERKS-WERKS.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_WERKS-OPTION.
                  IT_RANGETAB-VALUE    = S_WERKS-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'KONOB'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'KONOB'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_KONOB.
              CASE S_KONOB-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_KONOB-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_KONOB,
                         R_KONOB[].
                  R_KONOB-SIGN = 'I'.
                  R_KONOB-OPTION = 'BT'.
                  R_KONOB-LOW = S_KONOB-LOW.
                  R_KONOB-HIGH = S_KONOB-HIGH.
                  APPEND R_KONOB.
                  SELECT KONOB
                         INTO TABLE IT_KONOB
                         FROM T190
                         WHERE KONOB IN R_KONOB.
                  DELETE ADJACENT DUPLICATES FROM IT_KONOB COMPARING KONOB
                  LOOP AT IT_KONOB.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_KONOB-KONOB.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_KONOB-OPTION.
                  IT_RANGETAB-VALUE    = S_KONOB-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
          WHEN 'ZCPLT'.
            CLEAR IT_RANGETAB.
            IT_RANGETAB-VIEWFIELD = 'ZCPLT'.
            IT_RANGETAB-TABIX     = SY-TABIX.
            IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
            LOOP AT S_ZCPLT.
              CASE S_ZCPLT-OPTION.
                WHEN 'EQ'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'EQ'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                WHEN 'BT'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'GE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = 'LE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-HIGH.
                  APPEND IT_RANGETAB.
                WHEN 'NB'.
                  CLEAR: R_ZCPLT,
                         R_ZCPLT[].
                  R_ZCPLT-SIGN = 'I'.
                  R_ZCPLT-OPTION = 'BT'.
                  R_ZCPLT-LOW = S_ZCPLT-LOW.
                  R_ZCPLT-HIGH = S_ZCPLT-HIGH.
                  APPEND R_ZCPLT.
                  SELECT ZCPLT
                         INTO TABLE IT_ZCPLT
                         FROM ZTAB
                         WHERE ZCPLT IN R_ZCPLT.
                  DELETE ADJACENT DUPLICATES FROM IT_ZCPLT COMPARING ZCPLT
                  LOOP AT IT_ZCPLT.
                    IT_RANGETAB-AND_OR    = 'AND'.
                    IT_RANGETAB-OPERATOR = 'NE'.
                    IT_RANGETAB-VALUE    = IT_ZCPLT-ZCPLT.
                    APPEND IT_RANGETAB.
                  ENDLOOP.
                WHEN 'NE'.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR  = 'NE'.
                  IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
                WHEN OTHERS.
                  IT_RANGETAB-AND_OR    = 'AND'.
                  IT_RANGETAB-OPERATOR = S_ZCPLT-OPTION.
                  IT_RANGETAB-VALUE    = S_ZCPLT-LOW.
                  APPEND IT_RANGETAB.
              ENDCASE.
            ENDLOOP.
        ENDCASE.
      ENDLOOP.
      IF S_ZCPLT[] IS INITIAL.
        CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
          EXPORTING
            ACTION      = 'U'
            VIEW_NAME   = 'ZTAB'
          TABLES
            DBA_SELLIST = IT_RANGETAB
          EXCEPTIONS
            CLIENT_REFERENCE                     = 1
            FOREIGN_LOCK                         = 2
            INVALID_ACTION                       = 3
            NO_CLIENTINDEPENDENT_AUTH            = 4
            NO_DATABASE_FUNCTION                 = 5
            NO_EDITOR_FUNCTION                   = 6
            NO_SHOW_AUTH                         = 7
            NO_TVDIR_ENTRY                       = 8
            NO_UPD_AUTH                          = 9
            ONLY_SHOW_ALLOWED                    = 10
            SYSTEM_FAILURE                       = 11
            UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
            VIEW_NOT_FOUND                       = 13
            MAINTENANCE_PROHIBITED               = 14
            OTHERS                               = 15.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
        CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
          EXPORTING
            ACTION      = 'U'
            VIEW_NAME   = 'ZTAB_ZTEST'
          TABLES
            DBA_SELLIST = IT_RANGETAB
          EXCEPTIONS
            CLIENT_REFERENCE                     = 1
            FOREIGN_LOCK                         = 2
            INVALID_ACTION                       = 3
            NO_CLIENTINDEPENDENT_AUTH            = 4
            NO_DATABASE_FUNCTION                 = 5
            NO_EDITOR_FUNCTION                   = 6
            NO_SHOW_AUTH                         = 7
            NO_TVDIR_ENTRY                       = 8
            NO_UPD_AUTH                          = 9
            ONLY_SHOW_ALLOWED                    = 10
            SYSTEM_FAILURE                       = 11
            UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
            VIEW_NOT_FOUND                       = 13
            MAINTENANCE_PROHIBITED               = 14
            OTHERS                               = 15.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " frm_get_data
    *&      Form  frm_validations
          Validating field values
    FORM FRM_VALIDATIONS .
    Material number should not be validated (10/17/2005)
      CLEAR V_MATNR.
      SELECT SINGLE MATNR
                    INTO V_MATNR
                    FROM MARA
                    WHERE MATNR IN S_MATNR.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Material not found'.
      ENDIF.
      CLEAR V_WERKS.
      SELECT SINGLE WERKS
                    INTO V_WERKS
                    FROM ZTAB
                    WHERE WERKS IN S_WERKS.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Plant (WERKS) not found'(002).
      ENDIF.
      CLEAR V_KONOB.
      SELECT SINGLE KONOB
                    INTO V_KONOB
                    FROM ZTAB
                    WHERE KONOB IN S_KONOB.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH ' Product allocation object not found'(003).
      ENDIF.
      CLEAR V_WERKS.
      SELECT SINGLE WERKS
                    INTO V_WERKS
                    FROM ZTAB
                    WHERE WERKS IN S_ZCPLT.
      IF SY-SUBRC <> 0.
        MESSAGE E002 WITH 'Plant (ZCPLT) not found'(004).
      ENDIF.
    ENDFORM.                    " frm_validations
    reward points if it is usefull ...
    Regarding Table maintanence generator

  • How to access screen field value in a module pool programming?

    Hi Experts,
       I have create a module pool program SAPMYDLG. It contains two screens 100 and 200.
       The first screen contains Employee_ID field. This field is not a dictionary field.
       In the second screen 200, I want to access the value of Employee_ID field from first screen.
       For this I created a global variable v_empid in TOP include.
       Then in the PAI of the screen 100 I have assigned the screen field value to global variable.
       v_empid = Employee_ID.
       But this gives an error saying " Field  Employee_ID not defined".
       What am I doing wrong? How can I access the screen field value?
    Thanks
    Gopal

    Hi,
    Employee_ID field also must u define in the top include when u define that 100 screen and 200 screen will access.
    regards,
    muralii

  • How to remove the print popup screen from module pool program

    Hi,
    In my project i am having one module pool program in which 7-8 screens are there.
    In the initial screen after entering the equipment number when i am executing the program then after loading second screen
    it is showing one screen is coming which is asking to print the content of the page.
    I want to remove this screen (printing popup) but i am not able to get the code or setting for it.
    Please help me to solve this problem.
    Thanks and regards.

    I think this is more to do with ABAP than EP so, the corresponding sections of forum could prove more helpful on this...
    Thanks,
    H

  • How to deactivate the screen fields dynamically in Module Pool Program?

    Hi guys,
         How to <b>activate & deactivate the screen fields</b> of a <b>module pool program</b>
    <b>dynamically</b> through program. Like Change mode and display mode in a single
    screen.

    Hi,
    Make use of a Variable,say gv_flag, for both Activate and Deactivate functionalities. As many times you hit the same button, change this variable value. For example, let us say first time you hit this button, assign value 'X' to this variable. Second time you hit this button, assign value ' ' to this variable. In PBO based the variable value  you have to Activate and Deactivate.
    PBO.
      if gv_flag = 'X'.  " Activate
        loop at screen.
          if screen-fname = 'ITAB1-MATNR'.
             screen-input = '1'.
             modify screen.
          endif.
        endloop.
      elseif gv_flag = ' '.   " Deactivate
          if screen-fname = 'ITAB1-MATNR'.
             screen-input = '0'.
             modify screen.
          endif.
        endloop.
      endif.
    PAI.
      case sy-ucomm.
         when 'ACDC'.   " Activate/Deactivate
             if gv_flag = 'X'.
               gv_flag = ' '.
             else.
               gv_flag = 'X'.
             endif.
      endcase.
    thanks,
    sksingh

  • Generate PDF for pie graph generated by module pool program

    Hi Experts,
                     I have created a module pool program which generates a pie graph.I want to get the pdf output for the graph. please help me.
    Regrds,
    Rao

    Hi K A Rao,
    I think CONVERT_ABAPSPOOLJOB_2_PDF can help you solve the issue.

  • Wanted a code for table controls in bdc

    hi,
    i have written code for uploading data into FB60 transaction but i have a serious problem with that code.
    after entering 10 line items and when i am entering 11th item it is saying that the screen doesnot contain 11th line.
    so please modify my program or if you can please send me a program for handling table controls more line details.
    thanks and i will surely provide ten points to it.
    my code is
    LOOP AT I_PREPARE INTO WA_PREPARE.
    V_VALUE = WA_PREPARE-LINE+0(2).
    CASE V_VALUE.
    WHEN 'A'.
      CLEAR:V_DCNT.
    *UPLOAD THE COMPANY CODE TO FB60.
    *PERFORM.......USING WA_PREPARE-LINE+2(4).
    *? filling header data
    *********to initialize the company code and to get the popup**********
    PERFORM SET_BUKRS.
      PERFORM BDC_DYNPRO      USING 'SAPLACHD' '1000'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'BKPF-BUKRS'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTR'.
      BUKRS = WA_PREPARE-LINE+2(4).
      PERFORM BDC_FIELD       USING 'BKPF-BUKRS'
                                          BUKRS.
      PERFORM BDC_DYNPRO      USING 'SAPMF05A' '1100'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RF05A-BUSCS'
                                    'R'.
    *UPLOAD THE VENDOR NUMBER TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+45(10).
      ACCNT = WA_PREPARE-LINE+45(10).
      PERFORM BDC_FIELD       USING 'INVFO-ACCNT'
                                           ACCNT.
    *UPLOAD THE DATE TO FB60
    WRITE WA_PREPARE-LINE+34(8) TO V_DATE USING EDIT MASK '  .  .    .'
    *PERFORM.......USING V_DATE.
      PERFORM BDC_FIELD       USING 'INVFO-BLDAT'
                                    '15.09.2004'.
      PERFORM BDC_FIELD       USING 'INVFO-BUDAT'
                                    '15.09.2004'.
    *UPLOAD THE AMOUNT TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+85(15).
      WRBTR = WA_PREPARE-LINE+85(15).
      PERFORM BDC_FIELD       USING 'INVFO-WRBTR'
                                           WRBTR.
    *UPLOAD THE CURRENCY CODE TO FB60
    *PERFORM.......USING WA_PREPARE-LINE+100(3).
      WAERS = WA_PREPARE-LINE+100(3).
      PERFORM BDC_FIELD       USING 'INVFO-WAERS'
                                    WAERS.
    WHEN 'D'.
      V_DCNT = V_DCNT + 1.
    IF V_DCNT GT 04.
       V_DCNT = 04.
    ENDIF.
    *UPLOAD THE G/L ACC. TO FB60.
    *PERFORM.......USING WA_PREPARE-LINE+51(20).
    *? filling item data
      CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    FNAM.
      CONCATENATE 'ACGL_ITEM-HKONT(' V_DCNT ')' INTO FNAM.
      HKONT = WA_PREPARE-LINE+51(20).
      PERFORM BDC_FIELD       USING FNAM
                                    HKONT.
    *UPLOAD THE AMOUNT TO FB60(ACGL_ITEM-WRBTR)
    *PERFORM........USING WA_PREPARE-LINE+121(15).
      CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
      WRBTR = WA_PREPARE-LINE+75(15).
      PERFORM BDC_FIELD       USING FNAM
                                    WRBTR.
      PERFORM BDC_DYNPRO      USING 'SAPMF05A' '1100'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                '=0006'.
      PERFORM BDC_FIELD       USING 'RF05A-BUSCS'
                                    'R'.
    ENDCASE.

    hi,
    check this example:
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    REPORT  ZSR_BDC_TBCTRL
            NO STANDARD PAGE HEADING LINE-SIZE 255.
    TABLES : RF02K,LFA1,LFBK.
    DATA : BEGIN OF IT_VEN OCCURS 0,
          LIFNR LIKE RF02K-LIFNR,
          KTOKK LIKE RF02K-KTOKK,
          NAME1 LIKE LFA1-NAME1,
          SORTL LIKE LFA1-SORTL,
          LAND1 LIKE LFA1-LAND1,
          SPRAS LIKE LFA1-SPRAS,
          BANKS(6) TYPE C,
          BANKL(17) TYPE C,
          BANKN(19) TYPE C,
          END OF IT_VEN.
    DATA : BEGIN OF BANKS OCCURS 0,
           BANKS LIKE LFBK-BANKS,
           END OF BANKS,
           BEGIN OF BANKL OCCURS 0,
           BANKL LIKE LFBK-BANKL,
           END OF BANKL,
           BEGIN OF BANKN OCCURS 0,
           BANKN LIKE LFBK-BANKN,
           END OF BANKN.
    DATA : FLD(20) TYPE C,
           CNT(2) TYPE N.
    DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    INCLUDE BDCRECX1.
    START-OF-SELECTION.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = 'Z:\sr.TXT'
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = IT_VEN
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    PERFORM OPEN_GROUP.
    LOOP AT IT_VEN.
        REFRESH BDCDATA.
        REFRESH : BANKS,BANKL,BANKN..
        SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
        SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
        SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0100'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
                                  IT_VEN-LIFNR.
    PERFORM BDC_FIELD       USING 'RF02K-KTOKK'
                                  IT_VEN-KTOKK.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0110'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-SPRAS'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_FIELD       USING 'LFA1-NAME1'
                                  IT_VEN-NAME1.
    PERFORM BDC_FIELD       USING 'LFA1-SORTL'
                                  IT_VEN-SORTL.
    PERFORM BDC_FIELD       USING 'LFA1-LAND1'
                                  IT_VEN-LAND1.
    PERFORM BDC_FIELD       USING 'LFA1-SPRAS'
                                  IT_VEN-SPRAS.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0120'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '/00'.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKN(02)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    *perform bdc_field       using 'LFBK-BANKS(01)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKS(02)'
                                 'DE'.
    *perform bdc_field       using 'LFBK-BANKL(01)'
                                 '10020030'.
    *perform bdc_field       using 'LFBK-BANKL(02)'
                                 '67270003'.
    *perform bdc_field       using 'LFBK-BANKN(01)'
                                 '12345'.
    *perform bdc_field       using 'LFBK-BANKN(02)'
                                 '66666'.
    MOVE 1 TO CNT.
        LOOP AT BANKS.
          CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKS-BANKS.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKL.
          CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKL-BANKL.
          CNT = CNT + 1.
        ENDLOOP.
        MOVE 1 TO CNT.
        LOOP AT BANKN.
          CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
          PERFORM BDC_FIELD USING FLD BANKN-BANKN.
          CNT = CNT + 1.
        ENDLOOP.
    PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0130'.
    PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=ENTR'.
    PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0300'.
    PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                  '=YES'.
    PERFORM BDC_TRANSACTION USING 'XK01'.
    ENDLOOP.
    PERFORM CLOSE_GROUP.

  • How to freeze the selection column in the table control of the module pool.

    hi ,
    in my module pool there is a row selection field  <b>w/selcolumn</b> of the table control called as mark.
    how to freeze the selection column where there is no record in the table control row.
    or in other words where wa is initial.
    thanks
    ekta

    Hi all,
    in the PBO of the screen the following code is written.
    say the selection column is MARK and is declared in the data as well.
    thanks
    ekta
    *************************C O D E **************************************************
    MODULE disp_tabctrl1 OUTPUT.
      IF flag_c = 1.
        READ TABLE it_create_data INTO wa_material_data
             INDEX tab_ctrl1-current_line.
      ELSE.
        READ TABLE it_material_data INTO wa_material_data
             INDEX tab_ctrl1-current_line.
        IF sy-subrc = 0.
          IF ok_code_0101 = '&SEL1'.
            mark = 'X'.
          ELSEIF ok_code_0101 = '&DSEL'.
            mark = ' '.
          ENDIF.
        ELSE.
          LOOP AT SCREEN.
            IF screen-name = 'MARK'.
              screen-input = 0.
              MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      index_t = tab_ctrl1-top_line.
      index_d = tab_ctrl1-top_line + n.
    ENDMODULE.                 " DISP_TABCTRL1  OUTPUT

  • Table control:screen painter(Module Pool)

    hi !
    Table name :ZDR_MOD.
    Internal table:ITAB.
      I am doing Custom table control in screen painter.I have done desgin in screen painter,I am not writing any doing in PAI abd PBO. while compiling it showing error like,
    "The field "ITAB-MANDT" is not assigned to a loop."LOOP ... ENDLOOP" must appear in PBO and PAI""
    Report coding:
    EPORT  ZDR_PGM_TMP.
    tables:zdr_mod.
    CONTROLS tc TYPE TABLEVIEW USING SCREEN 100.
    data:itab TYPE STANDARD TABLE OF zdr_mod with HEADER LINE.
    DATA : flg, "Flag to set the change mode
    ln TYPE i. "No. of records
    select * from zdr_mod into CORRESPONDING FIELDS OF TABLE ITAB.
    call SCREEN 100.
    INCLUDE ZDR_PGM_TMP_STATUS_0100O01.
    INCLUDE ZDR_PGM_TMP_USER_COMMAND_01I01.
    thank in advance
    Dharma

    Hi,
    When a table control is added onto the Screen Painter, it is mandatory that the fields that you have added on from the dictionary be present in your program and is used within a loop...endloop.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
       LOOP AT T_ITAB INTO WA_ITAB WITH CONTROL TABCONTROL1.
         MODULE PURCHASEITEM_DETAILS.
       ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP AT T_ITAB.
         MODULE USER_COMMAND_0100.
    ENDLOOP.
    The internal table that you declare will have the same structure as that your table control. So it always loops with respect to the table control.

  • How to add ALV button using OO in module pool program using ALV grid

    Hello Gurus!!!
                  Want some tips related how to add button using ALV Grid(OO).
    I want to display the button for search, sort ....
                 Please suggest the step -by-step procedure for implementation of these button.
                 I am designing the code for transaction FB03. Header data has been displayed but want to display the line items.
                 Kindly suggest your answers.
    Thanks,
    Sachin

    Hi,
    CLASS SELSCR_APPLICATION DEFINITION DEFERRED.
    CLASS SELSCR_APPLICATION DEFINITION.
      PUBLIC SECTION.
       METHODS:
            HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT  E_INTERACTIVE,
            HANDLE_USER_COMMAND
            FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                IMPORTING E_UCOMM.
    ENDCLASS.        "SELSCR_APPLICATION DEFINITION
    CLASS SELSCR_APPLICATION IMPLEMENTATION.
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    append SAVE icon
        CLEAR LS_TOOLBAR.
        MOVE 'SAVE' TO LS_TOOLBAR-FUNCTION.
        MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON.
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
      ENDMETHOD.                    "handle_toolbar
      METHOD HANDLE_USER_COMMAND.
        CASE E_UCOMM.
          WHEN 'SAVE'.
              PERFORM UPDATE_FIELDS.
        ENDCASE.
      ENDMETHOD.
    ENDCLASS.                 "SELSCR_APPLICATION IMPLEMENTATION
    these lines should be after calling method SET_TABLE_FOR_FIRST_DISPLAY
    SET HANDLER G_APPLICATION1->HANDLE_TOOLBAR FOR GRID1.
            CALL METHOD grid1->set_toolbar_interactive.
    rgds,
    bharat.

  • How to write select options with extension in module pool program

    hi,
    M having  the following fields through screen painter.
    1. sales offfice
    2.sales district
    3.customer no
    for those three fields no extension is not provided and no search help is there.
    i want write  seletion options to get extension in that module pool
    screen.
    plese send coding for me , please let me know how to get that
    select options with the above all three fields.
    Thanks & Regards
    Raji

    Check it
    In top include
    DATA: number(4) TYPE n VALUE '9005',
    PROCESS BEFORE OUTPUT.
      MODULE status_9001.
      CALL SUBSCREEN AREA1 INCLUDING SY-REPID number.
    PROCESS AFTER INPUT.
      MODULE user_command_9001.
      CALL SUBSCREEN AREA1.
    *&      Module  status_9001  OUTPUT
          text
    MODULE status_9001 OUTPUT.
      SELECTION-SCREEN BEGIN OF SCREEN 9005 AS SUBSCREEN.
      PARAMETER pa_bukrs TYPE t001-bukrs.
      select-options matnr for wa_matnr.
      SELECTION-SCREEN END OF SCREEN 9005.
    ENDMODULE.                 " status_9001  OUTPUT

  • How to track changes to fields in a Module Pool Program

    Hi Experts,
    I have one requirement to track the changes to some fields used in the Program, The fields for tracking the changes will be maintained in a table T1, this will be changed dynamically. 
    There are many screens in the program and many fields in each screen.
    1. How to do the coding for tracking the changes, the code should track all the changes to the fields maintained in the table T1.
    Thanks in Advance.
    Baburaj

    Hi Baburaj,
    The table logging concept will helpful for this requirement.(Tcode: scu3 --> give  table name --> u can find changes for all fields).
    Make use of concept change documents (auditing purpose used) --> CDHDR,CDPOS tables.
    If you want to track changes to your own program, You need write some API to store the data.
    Regards
    Bhupal Reddy

Maybe you are looking for

  • Moodle grading works in IE6 but not Firefox 3?

    I am new to Captivate, and I have conducted searches in Adobe's and Moodle's forums and have not found a resolution to this problem. I have a quiz created in Captivate 4 that I am uploading to Moodle 1.9.1. The quiz displays, but the grades are not r

  • Apache XML-RPC & SSL

    I have a client desktop program that should connect to the server via xml-rpc and SSL. I use SecureXmlRpcClient and get the exception while execute method call: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/Decod

  • What are the 4 settings in ZoneAlarm FREE 7.1.248.000

    ZoneAlarm FREE has 4 settings it needs answered: ACCESS & SERVER, each with INTERNET & trusted ZONEs... ...so what should Bonjour Service mDNSResponder.exe firewall settings be under ZA ??? Thanks

  • Request a certificate for iPhone

    Hi, Guys! I need to generate a csr file for a enterprise certificate, but this CA cannot be for an user, has to be for an iOS device. How can I generate a certificate request for an iOS?

  • Exporting a song by email

    I wish to send one of my own compositions via email to a publisher. Is this possible? The song is currently saved on iTunes. Thanks Andrew