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.

Similar Messages

  • How to save Custom control records module pool program ?

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

    Hi Subasha,
    Please check the format below since it is based on a working code
    **************data declarations
    TYPES: BEGIN OF TY_EDITOR,
    EDIT(254) TYPE C,
    END OF TY_EDITOR.
    data: int_line type table of tline with header line.
    data: gw_thead like thead.
    data: int_table type standard table of ty_editor.
    You should create a text for uniquely identifying the text you are saving each time so that it doesn't get overwritten
    For this a key combination must be decidedd to uniquely identify the test..here it is loc_nam
    ****************fill header..from SO10( t-code )
    GW_THEAD-TDNAME = loc_nam. " unique key for the text
    GW_THEAD-TDID = 'ST'. " Text ID
    GW_THEAD-TDSPRAS = SY-LANGU.
    GW_THEAD-TDOBJECT = 'ZXXX'. "name of the text object created
    *Read Container and get data to int_table
    CALL METHOD EDITOR ->GET_TEXT_AS_R3TABLE
    IMPORTING
    TABLE = int_table
    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.
    loop data from int_table and save to int_line-tdline appending it.
    *save the text
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    HEADER = GW_THEAD
    TABLES
    LINES = InT_LINE
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 4
    OTHERS = 5.
    IF SY-SUBRC 0.
    ENDIF.
    The code shown above is ok and working fine for save also,hope that the above sample with helps you solve the problem
    Please check and revert,
    Reward if helpful
    Regards
    Byju

  • How to save Custom control records ?

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

    REPORT  ZCUSTOMC.
    CLASS event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
                 IMPORTING sender,
                 handle_f4 FOR EVENT f4 OF cl_gui_textedit
                 IMPORTING sender.
    ENDCLASS.
    DATA: ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm.
    DATA: init,
          container TYPE REF TO cl_gui_custom_container,
          editor    TYPE REF TO cl_gui_textedit.
    DATA: event_tab TYPE cntl_simple_events,
          event     TYPE cntl_simple_event.
    DATA: line(256) TYPE c,
          text_tab LIKE STANDARD TABLE OF line,
          field LIKE line.
    DATA handle TYPE REF TO event_handler.
    START-OF-SELECTION.
      line = 'First line in TextEditControl'.
      APPEND line TO text_tab.
      line = '----
      APPEND line TO text_tab.
      line = '...'.
      APPEND line TO text_tab.
      CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      IF init is initial.
        init = 'X'.
        CREATE OBJECT: container EXPORTING container_name = 'TEXTEDIT',
                       editor    EXPORTING parent = container,
                       handle.
        event-eventid = cl_gui_textedit=>event_f1.
        event-appl_event = ' '.                     "system event
        APPEND event TO event_tab.
        event-eventid = cl_gui_textedit=>event_f4.
        event-appl_event = 'X'.                     "application event
        APPEND event TO event_tab.
        CALL METHOD: editor->set_registered_events
                     EXPORTING events = event_tab.
        SET HANDLER handle->handle_f1
                    handle->handle_f4 FOR editor.
      ENDIF.
      CALL METHOD editor->set_text_as_stream EXPORTING text = text_tab.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'INSERT'.
          CALL METHOD editor->get_text_as_stream IMPORTING text = text_tab.
        WHEN 'F1'.
          MESSAGE i888(sabapdocu) WITH text-001.
        WHEN OTHERS.
          MESSAGE i888(sabapdocu) WITH text-002.
          CALL METHOD cl_gui_cfw=>dispatch.      "for application events
          MESSAGE i888(sabapdocu) WITH text-003.
      ENDCASE.
      SET SCREEN 100.
    ENDMODULE.
    CLASS event_handler IMPLEMENTATION.
      METHOD handle_f1.
        DATA row TYPE i.
        MESSAGE i888(sabapdocu) WITH text-004.
        CALL METHOD sender->get_selection_pos
             IMPORTING from_line = row.
        CALL METHOD sender->get_line_text
             EXPORTING line_number = row
             IMPORTING text = field.
        CALL METHOD cl_gui_cfw=>set_new_ok_code   "raise PAI for
             EXPORTING new_code = 'F1'.           "system events
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.
      METHOD handle_f4.
        DATA row TYPE i.
        MESSAGE i888(sabapdocu) WITH text-005.
        CALL METHOD sender->get_selection_pos
             IMPORTING from_line = row.
        CALL METHOD sender->get_line_text
             EXPORTING line_number = row
             IMPORTING text = field.
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.
    ENDCLASS.
    aniruddh

  • Data insert through module pool programming

    hi
    I want to insert the data  into the data base through module pool programming.I am taking the fields from different tables, I need sample code ,please help me

    Hi Dhanunjay,
    REPORT zpe_str_le .
    TABLES : zpe_str , zprd_mis1 , mseg , t001l.
    *DATA : STR TYPE C VALUE '50'.
    data : text(100) VALUE 'DELETED STORAGE LOCATION NO '.
    SELECTION-SCREEN : BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-005.
    SELECT-OPTIONS : S_ZSLOC FOR ZPE_STR-ZSLOC,
    S_ZMACD FOR ZPE_STR-ZMACD,
    S_ZPGRP FOR ZPE_STR-ZPGRP.
    SELECTION-SCREEN : END OF SCREEN 123.
    DATA : flag(1) TYPE c,
    flag1 TYPE c ,
    flag3 TYPE c VALUE '1'.
    DATA : etab LIKE t001l OCCURS 0 WITH HEADER LINE.
    SELECT * FROM T001L INTO TABLE ETAB.
    DATA : ihead LIKE thead.
    DATA : prevtab LIKE tline OCCURS 0 WITH HEADER LINE.
    data : Jtab like TLINE occurs 0 with header line.
    DATA : jtab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : itab LIKE zprd_mis1 OCCURS 0 WITH HEADER LINE.
    *SELECT * FROM zprd_mis1 INTO TABLE itab.
    DATA : BEGIN OF itab_sloc OCCURS 0,
    werks LIKE t001l-werks,
    lgort LIKE t001l-lgort,
    lgobe LIKE t001l-lgobe,
    END OF itab_sloc.
    *FLAG = 0.
    CALL SCREEN 100.
    MODULE user_command_0100 INPUT.
    CASE sy-ucomm.
    WHEN 'RET'.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 100.
    *PERFORM PREVIEW.
    LOOP AT prevtab.
    WRITE : / prevtab.
    ENDLOOP.
    LOOP AT JTAB[] INTO ZPRD_MIS1.
    WRITE : Jtab-TDFORMAT.
    WRITE : Jtab-TDLINE .
    *********ZPRD_MIS1-MANDT = Jtab-TDLINE .
    *********ZPRD_MIS1-SLOC = Jtab-TDLINE .
    *********ZPRD_MIS1-MCODE = Jtab-TDLINE .
    *********ZPRD_MIS1-GCODE = Jtab-TDLINE .
    *********ZPRD_MIS1-DESCR = Jtab-TDLINE .
    *********INSERT ZPRD_MIS1.
    ENDLOOP.
    WRITE : JTAB-ZSLOC.
    *********CALL TRANSACTION 'SO10'.
    SET CURSOR 2 2.
    WHEN 'DET'.
    SELECT * FROM ZPRD_MIS1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    CALL SCREEN 123 STARTING AT 10 5.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
    SKIP 2 .
    WRITE :/1(8) 'STR.LOC' ,10(15) 'MRP. CTLR',27(10) 'P.GRP' ,39(40) 'DESCRIPTION OF PRODUCT'.
    SELECT SLOC MCODE GCODE DESCR FROM zprd_mis1 INTO ZPRD_MIS1 WHERE SLOC IN S_ZSLOC AND
    MCODE IN S_ZMACD AND
    GCODE IN S_ZPGRP.
    WRITE :/1(8) zprd_mis1-SLOC ,10(15) zprd_mis1-MCODE ,27(10) zprd_mis1-GCODE ,39(40) zprd_mis1-DESCR .
    ENDSELECT.
    WHEN 'CLEAR'.
    flag = 4.
    IF zpe_str-zsloc NE ' '.
    CLEAR zpe_str.
    ELSE.
    MESSAGE 'ALREADY CLEARED' TYPE 'S'.
    ENDIF.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    WHEN 'SAVE'.
    IF zpe_str-zdesc NE ' '.
    IF zpe_str-zsloc NE ' '.
    LOOP AT itab.
    READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
    IF sy-subrc = 0 AND flag = 5.
    zprd_mis1-mandt = sy-mandt.
    zprd_mis1-sloc = zpe_str-zsloc .
    zprd_mis1-mcode = zpe_str-zmacd .
    zprd_mis1-gcode = zpe_str-zpgrp.
    zprd_mis1-descr = zpe_str-zdesc .
    MODIFY zprd_mis1.
    flag1 = 7.
    MESSAGE 'STORAGE LOCATION MODIFIED' TYPE 'S'.
    EXIT.
    ELSE.
    zprd_mis1-mandt = sy-mandt.
    zprd_mis1-sloc = zpe_str-zsloc .
    zprd_mis1-mcode = zpe_str-zmacd .
    zprd_mis1-gcode = zpe_str-zpgrp.
    zprd_mis1-descr = zpe_str-zdesc .
    INSERT zprd_mis1.
    APPEND itab.
    flag = 5.
    flag1 = 7.
    MESSAGE 'STORAGE LOCATION CREATED' TYPE 'S'.
    *MESSAGE 'DATA ALREADY SAVED' TYPE 'S'.
    EXIT.
    *ENDIF.
    ENDIF.
    ENDLOOP.
    ELSE.
    flag = 3.
    MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
    ENDIF.
    ELSE.
    LOOP AT itab.
    READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
    IF sy-subrc = 0.
    MESSAGE 'ALREADY SAVED' TYPE 'S'.
    ELSE.
    MESSAGE 'ENTRIES FOR OTHER FIELDS REQUIRED' TYPE 'S'.
    ENDIF.
    ENDLOOP.
    ENDIF.
    WHEN 'CHECK'.
    SELECT * FROM zprd_mis1 INTO TABLE itab.
    IF zpe_str-zsloc NE ' '.
    LOOP AT itab.
    READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
    IF sy-subrc = 0.
    zpe_str-zmandt = itab-mandt.
    zpe_str-zsloc = itab-sloc.
    zpe_str-zmacd = itab-mcode.
    zpe_str-zpgrp = itab-gcode.
    zpe_str-zdesc = itab-descr.
    flag = 7.
    flag1 = 7.
    ELSE.
    MESSAGE 'NO SUCH STORAGE LOCATION AVAILABLE' TYPE 'S'.
    EXIT.
    ENDIF.
    ENDLOOP.
    ELSE.
    flag = 3.
    MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
    EXIT.
    ENDIF.
    WHEN 'DELETE'.
    IF zpe_str-zsloc EQ ' '.
    flag = 3.
    MESSAGE 'NOSUCH LOCATION AVAILABLE' TYPE 'S'.
    ELSE.
    READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
    IF sy-subrc = 0.
    zpe_str-zmandt = itab-mandt.
    zpe_str-zsloc = itab-sloc.
    zpe_str-zmacd = itab-mcode.
    zpe_str-zpgrp = itab-gcode.
    zpe_str-zdesc = itab-descr.
    IF zpe_str-zsloc NE ' '.
    CALL FUNCTION 'G_CHECK_PASSWORD'
    EXPORTING
    password = 'PLANT1'
    EXCEPTIONS
    not_authorized = 1
    canceled = 2
    OTHERS = 3.
    IF sy-subrc = 0.
    PERFORM PREVIEW.
    DELETE FROM zprd_mis1 WHERE SLOC = zpe_str-zSLOC.
    UPDATE zprd_mis1.
    APPEND itab.
    MESSAGE 'STORAGE LOCATION DELETED' TYPE 'S'.
    ELSEIF SY-SUBRC = 2.
    MESSAGE 'OPRATION CANCELLED' TYPE 'E'.
    ELSEIF SY-SUBRC = 3.
    MESSAGE 'UNAUTHORIZED' TYPE 'E'.
    ENDIF.
    ELSE.
    MESSAGE 'STORAGE LOCATION CONTAINS NO DATA' TYPE 'S'.
    ENDIF.
    ELSE.
    MESSAGE 'STORAGE LOCATION CONTAINS NO DATA' TYPE 'S'.
    ENDIF.
    ENDIF.
    WHEN 'CREATE'.
    FLAG3 = 12.
    IF zpe_str-zsloc EQ ' '.
    MESSAGE 'ENTER THE STORAGE LOCATION' TYPE 'S'.
    EXIT.
    ELSE.
    LOOP AT etab.
    READ TABLE etab WITH KEY lgort = zpe_str-zsloc .
    IF sy-subrc = 0.
    read table itab with key sloc = zpe_str-zsloc .
    if sy-subrc = 0.
    zpe_str-zmandt = itab-mandt.
    zpe_str-zsloc = itab-sloc.
    zpe_str-zmacd = itab-mcode.
    zpe_str-zpgrp = itab-gcode.
    zpe_str-zdesc = itab-descr.
    flag = 7.
    flag1 = 7.
    clear flag .
    clear flag1.
    message 'storage location alredy exist' type 'S'.
    ELSE.
    FLAG = 2.
    MESSAGE 'STORAGE LOCATION ENTIRES DOESNOT EXIST' TYPE 'S'.
    ENDIF.
    else.
    message 'no such storage location exist' type 'S'.
    endif.
    endloop.
    FLAG = 2.
    exit.
    endif.
    WHEN 'CHANGE'.
    SELECT * FROM zprd_mis1 INTO TABLE itab.
    IF zpe_str-zsloc NE ' '.
    LOOP AT itab.
    READ TABLE itab WITH KEY sloc = zpe_str-zsloc .
    IF sy-subrc = 0.
    flag = 5.
    flag1 = 6.
    zpe_str-zmandt = itab-mandt.
    zpe_str-zsloc = itab-sloc.
    zpe_str-zmacd = itab-mcode.
    zpe_str-zpgrp = itab-gcode.
    zpe_str-zdesc = itab-descr.
    ELSE.
    MESSAGE 'NO STORAGE LOCATION AVAILABLE' TYPE 'S'.
    ENDIF.
    ENDLOOP.
    ELSE.
    flag = 3.
    MESSAGE 'PLEASE ENTER THE STORAGE LOCATION' TYPE 'S'.
    ENDIF.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'AAA'.
    SET TITLEBAR 'aaa'.
    IF flag3 = '1'.
    CALL FUNCTION 'G_CHECK_PASSWORD'
    EXPORTING
    password = 'PLANT1'
    EXCEPTIONS
    not_authorized = 1
    canceled = 2
    OTHERS = 3.
    IF sy-subrc 0.
    MESSAGE 'un authorized' TYPE 'S'(001).
    LEAVE TO SCREEN 0.
    ELSEIF SY-SUBRC = 2.
    MESSAGE ' OPERATION CANCELLED' TYPE 'S'(001).
    LEAVE TO SCREEN 0.
    ELSEIF SY-SUBRC = 3.
    LEAVE TO SCREEN 0.
    MESSAGE 'RESTRICTED' TYPE 'S'(001).
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CLEAR flag3.
    ENDIF.
    SELECT * FROM zprd_mis1 INTO TABLE itab.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    IF flag = 5 AND flag1 EQ 6.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 1.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    EXIT.
    ENDIF.
    IF flag = 2.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 1.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    EXIT.
    ENDIF.
    IF flag3 = 12.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 1.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'RET' OR screen-name = 'CHECK'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    EXIT.
    CLEAR FLAG3.
    ENDIF.
    IF flag = 4.
    IF screen-name CP 'ZPE_*'.
    screen-input = 1.
    ENDIF.
    ENDIF.
    IF flag1 = 7 AND flag = 5.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'DELETE' OR screen-name = 'CHECK' OR screen-name = 'SAVE'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF flag1 = 7 AND flag = 7.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'CHECK' OR screen-name = 'SAVE'." OR screen-name = 'DELETE'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    IF flag1 = 4 AND flag = 3.
    LOOP AT SCREEN.
    IF screen-name = 'ZPE_STR-ZDESC' OR screen-name = 'ZPE_STR-ZSLOC' OR screen-name = 'ZPE_STR-ZPGRP' OR screen-name = 'ZPE_STR-ZMACD'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    IF screen-name = 'CREATE' OR screen-name = 'SAVE' OR screen-name = 'DELETE' OR screen-name = 'CHANGE' OR screen-name = 'CHECK'.
    screen-input = 0.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    DATA: BEGIN OF r1 OCCURS 1.
    INCLUDE STRUCTURE ddshretval.
    DATA: END OF r1.
    *& Module VALUE_SLOC INPUT
    text
    MODULE value_sloc INPUT.
    SELECT lgort werks lgobe FROM t001l INTO CORRESPONDING FIELDS OF TABLE itab_sloc.
    DELETE ADJACENT DUPLICATES FROM itab_sloc COMPARING lgort.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    retfield = 'LGORT'
    value_org = 'S'
    TABLES
    value_tab = itab_sloc
    return_tab = r1
    EXCEPTIONS
    parameter_error = 1
    no_values_found = 2
    OTHERS = 3.
    IF sy-subrc EQ 0.
    IF r1-fieldval IS NOT INITIAL.
    zpe_str-zsloc = r1-fieldval.
    ENDIF.
    ENDIF.
    EXIT.
    *ENDSELECT.
    ENDMODULE. " VALUE_SLOC INPUT
    FORM PREVIEW.
    *TABLES : ZPE_STR , ZPRD_MIS1 , MSEG.
    data : ihead like thead.
    DATA : prevtab like TLINE occurs 0 with header line.
    data : Jtab like TLINE occurs 0 with header line.
    *data : Jtab like thead occurs 0 with header line.
    *data : text(100).
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = 'ST'
    LANGUAGE = sy-langu
    NAME = 'ZSLDEL'
    OBJECT = 'TEXT'
    ARCHIVE_HANDLE = 0
    LOCAL_CAT = ' '
    IMPORTING
    HEADER =
    TABLES
    LINES = prevtab[]
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if not prevtab[] is initial.
    append lines of prevtab to jtab.
    endif.
    *IHEAD-TDFDATE = SY-DATUM.
    *IHEAD-TDFTIME = SY-UZEIT.
    ihead-TDOBJECT = 'TEXT'.
    ihead-TDNAME = 'ZSLDEL'.
    ihead-TDID = 'ST'.
    ihead-TDSPRAS = sy-langu.
    type-pools : slis.
    Jtab-TDFORMAT = ''.
    *Jtab-TDLINE = 'SLOCATION'.
    *append Jtab.
    *Jtab-TDFORMAT = ''.
    Jtab-TDFORMAT = '*'.
    Jtab-TDLINE = ZPE_STR-ZSLOC.
    append Jtab.
    Jtab-TDFORMAT = ''.
    *Jtab-TDLINE = 'DATE'.
    *append Jtab.
    Jtab-TDFORMAT = ''.
    *Jtab-TDLINE = SY-DATUM.
    *append Jtab.
    Jtab-TDFORMAT = ''.
    *Jtab-TDLINE = 'TIME'.
    *append Jtab.
    Jtab-TDFORMAT = ''.
    *Jtab-TDLINE = SY-UZEIT.
    *Jtab-TDFORMAT = ''.
    *append Jtab.
    CALL FUNCTION 'SAVE_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    HEADER = ihead
    INSERT = 'X'
    SAVEMODE_DIRECT = ' '
    OWNER_SPECIFIED = ' '
    LOCAL_CAT = ' '
    IMPORTING
    FUNCTION =
    NEWHEADER =
    TABLES
    LINES = Jtab
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    OBJECT = 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.
    CALL FUNCTION 'COMMIT_TEXT'
    EXPORTING
    OBJECT = '*'
    NAME = '*'
    ID = '*'
    LANGUAGE = '*'
    SAVEMODE_DIRECT = ' '
    KEEP = ' '
    LOCAL_CAT = ' '
    IMPORTING
    COMMIT_COUNT =
    TABLES
    T_OBJECT =
    T_NAME =
    T_ID =
    T_LANGUAGE =
    ENDFORM.
    *&spwizard: declaration of tablecontrol 'TBLECTL' itself
    controls: TBLECTL type tableview using screen 0100.
    *&spwizard: lines of tablecontrol 'TBLECTL'
    data: g_TBLECTL_lines like sy-loopc.
    data: OK_CODE like sy-ucomm.
    *&spwizard: output module for tc 'TBLECTL'. do not change this line!
    *&spwizard: update lines for equivalent scrollbar
    module TBLECTL_change_tc_attr output.
    describe table ITAB lines TBLECTL-lines.
    endmodule.
    *&spwizard: output module for tc 'TBLECTL'. do not change this line!
    *&spwizard: get lines of tablecontrol
    module TBLECTL_get_lines output.
    g_TBLECTL_lines = sy-loopc.
    endmodule.
    *&spwizard: input module for tc 'TBLECTL'. do not change this line!
    *&spwizard: process user command
    module TBLECTL_user_command input.
    OK_CODE = sy-ucomm.
    perform user_ok_tc using 'TBLECTL'
    'ITAB'
    changing OK_CODE.
    sy-ucomm = OK_CODE.
    endmodule.
    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
    Source : https://forums.sdn.sap.com/click.jspa?searchID=15092700&messageID=5654151
    Have A Good Day
    Chaitanya.

  • How to validate the field values in module pool program?

    Hi Guys
         I am working with module pool programming.
         Here I want to validate the fields like below.
         with out filling all the fields if I click SAVE option it has to show a message that all fields has to be filled.  This can be done by checking all the fields individually.
         I think it can be done through <b>LOOP AT SCREEN ......ENDLOOP</b>. sequence.
         If it is possible, can anyone help me?

    You need to write the Module in between the CHAIN and ENDCHAIN statment in SE51
    If you send a warning or error message from a module <mod> that you called using a FIELD statement as follows:
    CHAIN.
    FIELD: <f1>, <f 2>,...
    MODULE <mod1>.
    FIELD: <g1>, <g 2>,...
    MODULE <mod2>.
    ENDCHAIN.
    all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.
    Look at the DEMO program DEMO_DYNPRO_FIELD_CHAIN.
    ashish

  • How to make a fld mandatory in module pool program?

    I need help on following 2 things
    I have module pool program created, in that many screen subscreens created.
    1.I want to make a field mandatory
    second one  is, I have a general tab and  data tab.
    General tab screen - 2101
    Data tab = 2102
    In general tab, I have edited the values (change mode), when change the values and try to save it,
    It is holding old value.but If i exucute the transaction once again, it is showing the changed value(new value)
    For ex: there is a date field  value is 03/08/2009
    If I change this to 03/09/2009 and press on Save button from the standard menu, still it is showing the  value 03/08/2009. but I execute this transaction once again it is showing the value as 03/09/2009
    I will be thankful if someone helps me here

    Hi Chitra,
    Go to the properties of the filed select program tab and say input required.
    then you will get the problem solved.
    For second one actually its saving but not displaying the saved value at the same time ,
    for this you write the select statement after saving , so that once save is execute m, select statement also will execute  and it will display the newly saved value.
    so after saving imdeatly u write the select statement.
    like case sy-ucomm.
    when 'SAVE'.
    insert ztable.
    select filed from z table.
    endcase.
    let me know if ur problem solved.
    Regards
    Rajendra

  • How to take backup of an entire module pool program with code,screen,etc.

    Hi experts,
    I have some important data in the ides server for which i want to take backup of them.
    I have some question regarding the same.
    1.How to take backup/download of an entire module pool program with code,screen,etc.
    2.How can we take backup/download for a DB table with its structure?
    3.How can we take backup of a search help?
    Please give some suggestions abt the same.
    Regards,
    Ashesh.

    Hi,
    May be just for viewing, try downloading from SE80 transaction from the others option.
    Here just try issuing the print, it will generate the spool.
    Now using the spool, download to your desktop as required. It will have all the information regarding the attributes, fields, elements everything.
    The only issue is, may be you need to take all the screens separately.
    Regards,
    Santhosh.

  • How to change the logon language in module pool program?

    Hello All,
    I had created a module pool program and had desiged a screen.
    When i am logged in English language i am able to see them in english as per the requirement it is working fine.
    But the requirement is wen i am logged in DE then the selection-screen texts should show in English and not in German.
    Kindly give me a solution for this.
    Thanks & Regards,
    Rajesh Kumar

    Hi Rajesh,
    This problem is because you have maintained a standard dictionary fields on selection screen and all the standard dictionary fields are maintained in DE language, on the screen layout, go to the attributes of that particular text field, there is a option MODIFIZ for dictionary fields (it is a drop down), selection F TEXT, now whatever the text u will define, it will remain same for all the languages, once u do this  then u again login in DE,l u will see the text maintained by u and not the DE text.
    Do reply if problem still persist.
    point if useful.
    Rohit G
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:24 PM
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:30 PM
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:36 PM
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:36 PM
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:37 PM
    Edited by: Rohit Gaharwar on Aug 11, 2009 1:38 PM

  • How to get tree structure navigation in module pool program

    please send me a sample code for getting tree structure navigation in a screen  in module pool program.
    ex.
    masters
    items

    do a chain and endchain on the fields.Then insert the fields in to the required database.

  • How to find out no of customize module pool program in SAP

    Hi All,
    I want to find out number of customize module pool program, Workflow, number of changes made to standard SAP objects (SPAU/SPDD in our SAP system
    Regards
    Sagar

    Join the table with TRDIR to find module-pool program (TRDIR-SUBC = 'M')
    Regards,
    Raymond
    Aravind. R  was faster...
    Edited by: Raymond Giuseppi on Jun 18, 2009 12:56 PM

  • '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

  • How to insert field to database through module pool.

    Hi All,
    I am working on module pool,i have taken the itab with header line and structures also.
    inorder to update  fields to different tbales what is the logic i need to right.
    i have taken move command i have written move scree-fields to structure
    then  have modify dbtable from structure.but no result only current record is updating
    please help me.

    Hi Saroja,
    INSERT INTO scarr values scarr_wa
    If you use above statement, it updates only one record.
    INSERT INTO scarr FROM TABLE itab.
    If you use above statement, it updates all records available in itab.
    Choose which one u want to use and update the table.
    Thanks
    Venkat.O

  • How to bold/color text message in Module pool Programming ?

    Hi All ,
    I need to bold /color a message in module pool . this message will come when certain conditions satisfied , currently this text message is displaying through variable . I Refereed program DD_STYLE_TABLE , but still not getting desired output . .Is there any other way to achieve the same ?
    Could you please help me ?
    Thanks in advance !!!!
    Regards ,
    Mayank K

    Hi Mayank,
    You can give a try this.
    Within the screen you are calling give keyword
    Leave to list processing
    and then you can give whatever colors which are there in SAP
    For making the text bold you can set Format intensified on or off depending on your requirement.
    For more details you can refer to programs
    program1 : demo_leave_to_list_processing
    program2: demo_call_screen_from_list
    Regards,
    Sandeep Katoch

  • How to create a top include for module pool program

    hi all..
      I want to add my global declarations in one top inlcude.. There are so many other includes in my pgm. But how can i create top include explicitly. Also I have one normal report pgm attached with this module pool.

    hi Cynthia ,
       there are two ways of creating a top include at your situation  ,
    1) Insert an include <Prog name >TOP  in your mpool program and cut n paste your declarations there .. check if this works ...
    2)else .. create another m pool program in SE80 , while creating a pop up will ask for with TOP include ... check mark that and then proceed ..
       anything of these two will work ...
    Reward if helpful !!
    Regards,
    Ranjita

  • How to pass the field value from module pool program to smartform using submit?

    // AT pai of module pool pgm i entered the following: here gv_orderid is my value to be available at smart form(driver pgm) & zmusic_store_smf is the driver program of my smartform.
    gv_orderid= wa-itemid./
    SUBMIT ZMUSIC_STORE_SMF VIA SELECTION-SCREEN
                                  WITH p_order = gv_orderid
                                  AND RETURN.
    //AT driver pgm(zmusic_store_smf):
    START-OF-SELECTION.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = 'ZMUSIC_SMARTFORM1'
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = lv_form
       EXCEPTIONS
         no_form                  = 1
         no_function_module       = 2
         OTHERS                   = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    CALL FUNCTION lv_form
       EXPORTING
    *      iv_orderid = is_purchase_item-zorder_id.
    iv_orderid = gv_orderid.
    // here i'm trying to call my smartform('ZMUSIC_SMARTFORM1')  from this driver pgm but unable to access the value of gv_orderid please help me out with this.

    Declare the gv_orderid in modulepool program.
    And Declare the parameter as import parameter in smartform.
    CALL FUNCTION  lv_form
       EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
    *   CONTROL_PARAMETERS         =
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             =
    *   USER_SETTINGS              = 'X'
         i_input                    =  gv_orderid
    * IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
    *   JOB_OUTPUT_INFO            =
    *   JOB_OUTPUT_OPTIONS         =
    * EXCEPTIONS
    *   FORMATTING_ERROR           = 1
    *   INTERNAL_ERROR             = 2
    *   SEND_ERROR                 = 3
    *   USER_CANCELED              = 4
    *   OTHERS                     = 5

Maybe you are looking for

  • Can't log out from iCloud

    Hi. I have a problem. Several times a day, my iPad try to log it self into iCloud on a mail I don't use anymore. And the problem is, that I can't remove it, cuz I don't have the password anymore. I've tried to recover it, but it won't send any mail t

  • Why cant i see replies in my text messages?

    Im texting my friend over my iPod gen 4 to his iPhone 5 and i have 3 problems occur. 1. the message never fully sends. the sending bar is almost there, but never finishes. 2. If the sending does finish, my messages wont 'deliver' 3. If my messages de

  • Replacing an employee in Activities

    Hi all, I have the following requirement: when creating a new activity, the system should check if the person responsible ("sales representative") is out of office (e.g. vacations, leave of absence, etc.) and it should designate a new sales represent

  • Why did I have to enter IP address manually

    I could use a little help. I have an Airport Extreme 802.11n and a Motorola modem for connecting to Comcast. I also have two Macs and an iPhone. All of this was working fine up until very early this morning. And then it just stopped working. After tr

  • Webas JAVA in SLD

    hi friends, one month back i have created webas java technical system.it's working fine..but right now it's not working...how would we find out the error and  how to test that particular technical system...plz give me answer ASAP.. regards, venu