Skip to Content
author's profile photo Former Member
Former Member

Table control selections in madulepool.

Dear Friends,

Need help on Table control in madulepools.

I have table control ( its a standard wizard) and displayed with 3 columns, its having total 5 records ( 5 rows ).

in TC at topmost in left side we are having a Green Scroll to select all the records, If I hit the Green Scroll it is selecting all the columns ,

and Here my problem is how to track all the records based on Green Scroll selection ?

If I selected the Green Scroll I need make all 5 records as selected into my internal table which one I am using for my TC.

Thanks,

Sridhar.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2008 at 01:09 PM

    hi,

    following program will help u. please look at it

    &----


    *& Module EXIT INPUT

    &----


    • text

    ----


    MODULE EXIT INPUT.

    CASE SY-UCOMM.

    WHEN 'CANCEL'.

    DATA ANSWER TYPE C.

    • To check it user has entered some data on the screen.

    IF SY-DATAR = 'X'.

    CALL FUNCTION 'C14A_POPUP_SAVE_WITH_CANCEL'

    IMPORTING

    E_ANSWER = ANSWER.

    ELSE.

    CLEAR SY-UCOMM.

    LEAVE to screen 100.

    ENDIF.

    IF ANSWER = 'N'.

    • Leaving the program

    LEAVE to screen 100.

    ELSEIF ANSWER = 'J'.

    • Call subroutine save to perform save operation.

    PERFORM SAVE.

    ENDIF.

    CLEAR SY-UCOMM.

    WHEN 'EXIT'.

    CLEAR SY-UCOMM.

    LEAVE PROGRAM.

    ENDCASE.

    *clear sy-ucomm.

    ENDMODULE. " EXIT INPUT

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0100 INPUT.

    CASE SY-UCOMM.

    WHEN 'CREATE'.

    CALL SCREEN 200.

    WHEN 'CHANGE' OR 'DISPLAY'..

    • Select data from Z04_EKKO table to header table.

    SELECT SINGLE * FROM Z04_EKKO INTO

    CORRESPONDING FIELDS OF Z04_EKKO WHERE ebeln =

    Z04_EKKO-EBELN.

    if sy-subrc = 0.

    • Select data from z04_EKPO, makt, z04_PRICE into item table.

    SELECT iebelp imatnr imenge mmaktx pnetpr pwaers

    imeins inetpr i~waers

    FROM Z04_EKKO AS h JOIN Z04_EKPO AS i ON

    hebeln = iebeln JOIN

    makt AS m ON

    imatnr = mmatnr JOIN

    Z04_PRICE AS p ON

    imatnr = pmatnr

    INTO TABLE IT_EKPO

    WHERE i~ebeln = Z04_EKKO-ebeln AND

    m~spras = 'EN'.

    ELSE.

    message 'The purchase order DOES NOT exists' type 'E'.

    ENDIF.

    select ebelp etenr menge eindt from z04_eket into corresponding fields

    of table it_eket where ebeln = Z04_EKKO-EBELN.

    leave to screen 200.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    &----


    *& Module USER_COMMAND_0200 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0200 INPUT.

    CASE SY-UCOMM.

    WHEN 'SAVE'.

    CLEAR SY-UCOMM.

    *perform save subroutine to perform save operation

    PERFORM SAVE.

    WHEN 'PRINT'.

    *perform print subroutine to print a script form

    CLEAR SY-UCOMM.

    PERFORM PRINTPROG.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0200 INPUT

    &----


    *& Module LINE_SCHEDULE INPUT

    &----


    • text

    ----


    MODULE LINE_SCHEDULE INPUT.

    CASE SY-UCOMM.

    WHEN 'HEADER'.

    *activate header tab

    TABCONTROL-ACTIVETAB = 'HEADER'.

    WHEN 'LINEITEMS'.

    *ACTIVATE TABLECONTROL1 TABSTRIP.

    TABCONTROL-ACTIVETAB = 'LINEITEMS'.

    WHEN 'SCHEDULE'.

    • ACTIVATE TABLECONTROL2 TABSTRIP.

    TABCONTROL-ACTIVETAB = 'SCHEDULE'.

    *populate schedule table with selected item nos in the itemlines tab

    LOOP AT IT_EKPO.

    CLEAR IT_EKET.

    IF IT_EKPO-MARK = 'X'.

    IT_EKET-EBELP = IT_EKPO-EBELP.

    APPEND IT_EKET.

    ENDIF.

    ENDLOOP.

    LOOP AT IT_EKET.

    DELETE IT_EKET WHERE ebelp = IT_ITEMDEL-ebelp.

    ENDLOOP.

    ENDCASE.

    ENDMODULE. " LINE_SCHEDULE INPUT

    &----


    *& Module USER_COMMAND_0210 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0210 INPUT.

    ENDMODULE. " USER_COMMAND_0210 INPUT

    &----


    *& Module CHECK_PURCHASEORDERNO INPUT

    &----


    • text

    ----


    MODULE CHECK_PURCHASEORDERNO INPUT.

    *validate the purchase order no for numeric format

    IF NOT z04_ekko-ebeln CO '0123456789'.

    MESSAGE 'PURCHASE ORDER NOT IN THE EXPECTED FORMAT' TYPE 'E'.

    ENDIF.

    SELECT SINGLE EBELN

    FROM Z04_EKKO

    INTO Z04_EKKO-EBELN

    WHERE EBELN = Z04_EKKO-EBELN.

    IF sy-subrc = 0.

    • TO CHECK IF PURCHASE ORDER EXISTS.

    IF SY-TCODE = 'ZPURCR_GRP04'.

    CLEAR Z04_EKKO-EBELN.

    MESSAGE 'THE PURCHASE ORDER ALREADY EXISTS: ' TYPE 'I'.

    LEAVE TO SCREEN 100.

    ENDIF.

    ELSE.

    • TO CHECK IF PURCHASE ORDER DOESNOT EXISTS.

    IF SY-TCODE EQ 'ZPURCHG_GRP04' OR SY-TCODE EQ 'ZPURDIS_GRP04'.

    CLEAR Z04_EKKO-EBELN.

    MESSAGE 'THE PURCHASE ORDER DOES NOT EXIST' TYPE 'I'.

    LEAVE TO SCREEN 100.

    ENDIF.

    ENDIF.

    ENDMODULE. " CHECK_PURCHASEORDERNO INPUT

    &----


    *& Module CHECK_DATE INPUT

    &----


    • text

    ----


    MODULE CHECK_DATE INPUT.

    *validate date

    IF Z04_EKKO-BEDAT GT SY-DATUM .

    MESSAGE 'DATE GREATER THAN SYSTEM DATE' TYPE 'E'.

    ENDIF.

    clear sy-ucomm.

    ENDMODULE. " CHECK_DATE INPUT

    &----


    *& Module CHECK_COMPANYCODE INPUT

    &----


    • text

    ----


    MODULE CHECK_COMPANYCODE INPUT.

    *validate company code

    DATA WA_BUKRS LIKE Z04_EKKO-BUKRS.

    SELECT SINGLE BUKRS FROM t001 INTO WA_BUKRS WHERE BUKRS =

    Z04_EKKO-BUKRS.

    IF SY-SUBRC NE 0.

    MESSAGE 'INVALID COMPANY CODE' TYPE 'E'.

    ENDIF.

    clear sy-ucomm.

    ENDMODULE. " CHECK_COMPANYCODE INPUT

    &----


    *& Module CHECK_VENDOR INPUT

    &----


    • text

    ----


    MODULE CHECK_VENDOR INPUT.

    *validate vendor

    DATA WA_LIFNR TYPE Z04_EKKO-LIFNR.

    SELECT SINGLE LIFNR FROM LFA1

    INTO WA_LIFNR WHERE LIFNR = Z04_EKKO-LIFNR.

    IF SY-SUBRC NE 0.

    MESSAGE 'VENDOR DOESNOT EXISTS' TYPE 'E'.

    ENDIF.

    clear sy-ucomm.

    ENDMODULE. " CHECK_VENDOR INPUT

    &----


    *& Module CHECK_CURRENCY INPUT

    &----


    • text

    ----


    MODULE CHECK_CURRENCY INPUT.

    *validate currency

    DATA WA_WAERS TYPE Z04_EKKO-WAERS.

    SELECT SINGLE WAERS FROM TCURC

    INTO WA_WAERS

    WHERE WAERS = Z04_EKKO-WAERS.

    IF SY-SUBRC NE 0.

    MESSAGE 'INVALID CURRENCY' TYPE 'E'.

    ENDIF.

    clear sy-ucomm.

    ENDMODULE. " CHECK_CURRENCY INPUT

    &----


    *& Module USER_COMMAND_0220 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0220 INPUT.

    DATA: OK_CODE1 TYPE SY-UCOMM.

    flag = '0'.

    CASE OK_CODE1.

    WHEN 'ADD'.

    CLEAR SY-UCOMM.

    LOOP AT IT_EKPO.

    IF IT_EKPO-MARK = 'X'.

    INSERT INITIAL LINE INTO IT_EKPO.

    flag = '1'.

    ENDIF.

    ENDLOOP.

    IF flag <> '1'.

    APPEND INITIAL LINE TO IT_EKPO.

    ENDIF.

    WHEN 'DELETE'.

    CLEAR SY-UCOMM.

    • To delete the seleceted line from table control

    LOOP AT IT_EKPO.

    IF IT_EKPO-MARK = 'X'.

    MOVE-CORRESPONDING IT_EKPO TO IT_ITEMDEL.

    APPEND IT_ITEMDEL.

    DELETE IT_EKPO.

    LOOP AT IT_EKET.

    IF IT_EKET-EBELP = IT_EKPO-EBELP.

    MOVE-CORRESPONDING IT_EKET TO IT_SCHDEL.

    APPEND IT_SCHDEL.

    DELETE IT_EKET.

    ENDIF.

    ENDLOOP.

    ELSEIF IT_EKPO-MATNR IS INITIAL.

    DELETE IT_EKPO INDEX TABLECONTROL1-CURRENT_LINE.

    ENDIF.

    ENDLOOP.

    WHEN 'SELECT'.

    CLEAR SY-UCOMM.

    • To select all the rows of table control

    LOOP AT IT_EKPO.

    IT_EKPO-MARK = 'X'.

    MODIFY IT_EKPO.

    ENDLOOP.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0220 INPUT

    &----


    *& Module CHECK_MATERIALNUMBER INPUT

    &----


    • text

    ----


    MODULE CHECK_MATERIALNUMBER INPUT.

    DATA : WA_MATNR TYPE MARA-MATNR,

    wa_netpr LIKE Z04_EKPO-netpr.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    INPUT = IT_EKPO-MATNR

    IMPORTING

    OUTPUT = IT_EKPO-MATNR.

    IF IT_EKPO-MATNR IS NOT INITIAL.

    SELECT SINGLE NETPR FROM Z04_PRICE INTO WA_NETPR

    WHERE MATNR = IT_EKPO-MATNR.

    IF SY-SUBRC EQ 0.

    • TO CHECK WHETHER PRICE IS MAINTAINED FOR THE MATERIAL NUMBER OR NOT.

    IF WA_NETPR IS INITIAL.

    MESSAGE 'Price Not Maintained' TYPE 'I'.

    ENDIF.

    ELSE.

    • TO CHECK WHETHER MATERIAL NUMBER PRESENT OR NOT .

    MESSAGE 'Material number not maintained' TYPE 'I'.

    clear it_ekpo.

    modify it_ekpo INDEX TABLECONTROL1-current_line.

    ENDIF.

    SELECT SINGLE MATNR INTO WA_MATNR FROM MARA

    WHERE MATNR = IT_EKPO-MATNR.

    • TO CHECK WHETHER MATERIAL NUMBER PRESENT IN MARA TABLE.

    IF SY-SUBRC NE 0.

    MESSAGE 'MATERIAL NUMBER NOT MAINTAINED' TYPE 'I'.

    ENDIF.

    ELSEIF SY-UCOMM <> 'DELETE'.

    MESSAGE 'ENTER A MATERIAL NUMBER' TYPE 'I'.

    ENDIF.

    ENDMODULE. " CHECK_MATERIALNUMBER INPUT

    &----


    *& Module LINE_ADD INPUT

    &----


    • text

    ----


    MODULE LINE_ADD INPUT.

    IF OK_CODE <> 'ADD' AND OK_CODE <> 'DELETE' AND

    OK_CODE <> 'SELECT' AND OK_CODE <> 'DESELECT'.

    *Select materail description, price, currency, unit for the material

    *number entered

    IF IT_EKPO-MATNR IS NOT INITIAL.

    SELECT SINGLE m~maktx p~netpr p~waers p~meins

    FROM makt AS m JOIN

    z04_PRICE AS p

    ON p~matnr = m~matnr

    INTO

    (IT_EKPO-MAKTX, IT_EKPO-netpr_P, IT_EKPO-WAERS_P, IT_EKPO-meins_P)

    WHERE m~matnr = IT_EKPO-matnr

    AND spras = sy-langu

    AND p~matnr = IT_EKPO-matnr.

    • To transfer currency from header table to item table.

    IT_EKPO-waers = Z04_EKKO-waers.

    IF IT_EKPO-netpr_P IS NOT INITIAL.

    DATA : l_netpr LIKE Z04_EKKO-netpr.

    • Call function to convert the currency to header currency .

    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

    EXPORTING

    • CLIENT = SY-MANDT

    date = sy-datum

    foreign_amount = IT_EKPO-netpr_P

    foreign_currency = Z04_EKKO-waers

    local_currency = IT_EKPO-waers_P

    • RATE = 0

    • TYPE_OF_RATE = 'M'

    • READ_TCURR = 'X'

    IMPORTING

    • EXCHANGE_RATE =

    • FOREIGN_FACTOR =

    local_amount = l_netpr

    • LOCAL_FACTOR =

    • EXCHANGE_RATEX =

    • FIXED_RATE =

    • DERIVED_RATE_TYPE =

    EXCEPTIONS

    no_rate_found = 1

    overflow = 2

    no_factors_found = 3

    no_spread_found = 4

    derived_2_times = 5

    OTHERS = 6

    .

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    • Calculate netprice by multiply quantity and price for each material.

    IT_EKPO-netpr = IT_EKPO-MENGE * l_netpr.

    ENDIF.

    • To make validation for currency in price table

    DATA wa_meins LIKE marm-meinh.

    CLEAR IT_EKKO-waers.

    SELECT SINGLE waers FROM tcurc

    INTO IT_EKKO-WAERS

    WHERE waers = IT_EKPO-waers_P.

    IF sy-subrc NE 0.

    MESSAGE ' CURRENCY PRESENT IN PRICE IS NOT VALID ' TYPE 'I'.

    CLEAR SY-UCOMM.

    ENDIF.

    • To make validation for unit in price table

    SELECT SINGLE meinh FROM marm INTO wa_meins

    WHERE meinh = IT_EKPO-meins_p.

    IF sy-subrc NE 0.

    MESSAGE ' UNIT PRESENT IN PRICE TABLE IS NOT VALID ' TYPE 'I'.

    CLEAR SY-UCOMM.

    ENDIF.

    ENDIF.

    ENDIF.

    • CLEAR SY-UCOMM.

    ENDMODULE. " LINE_ADD INPUT

    &----


    *& Module MODIFY_LINE INPUT

    &----


    • text

    ----


    MODULE MODIFY_LINE INPUT.

    MODIFY IT_EKPO INDEX TABLECONTROL1-current_line.

    ENDMODULE. " MODIFY_LINE INPUT

    &----


    *& Module USER_DESELECT INPUT

    &----


    • text

    ----


    MODULE USER_DESELECT INPUT.

    IF SY-UCOMM EQ 'DESELECT'.

    CLEAR SY-UCOMM.

    LOOP AT IT_EKPO.

    IT_EKPO-MARK = ' '.

    MODIFY IT_EKPO INDEX SY-TABIX.

    ENDLOOP.

    ENDIF.

    ENDMODULE. " USER_DESELECT INPUT

    &----


    *& Module LINE_GENERATE INPUT

    &----


    • text

    ----


    MODULE LINE_GENERATE INPUT.

    LOOP AT IT_EKPO.

    IF IT_EKPO-ebelp = ' '.

    IT_EKPO-EBELP = SY-TABIX.

    MODIFY IT_EKPO.

    ENDIF.

    ENDLOOP.

    • CLEAR SY-UCOMM.

    ENDMODULE. " LINE_GENERATE INPUT

    &----


    *& Module MODIFY_SCHEDULE INPUT

    &----


    • text

    ----


    MODULE MODIFY_SCHEDULE INPUT.

    MODIFY IT_EKET INDEX TABLECONTROL2-current_line.

    ENDMODULE. " MODIFY_SCHEDULE INPUT

    &----


    *& Module SORT INPUT

    &----


    • text

    ----


    MODULE SORT INPUT.

    SORT IT_EKET BY ebelp.

    ENDMODULE. " SORT INPUT

    &----


    *& Module USER_COMMAND_0230 INPUT

    &----


    • text

    ----


    MODULE USER_COMMAND_0230 INPUT.

    flag = '0'.

    CASE SY-UCOMM.

    WHEN 'ADDS'.

    CLEAR SY-UCOMM.

    LOOP AT IT_EKET.

    IF IT_EKET-MARK = 'X'.

    INSERT INITIAL LINE INTO IT_EKET.

    flag = '1'.

    ENDIF.

    ENDLOOP.

    IF flag <> '1'.

    APPEND INITIAL LINE TO IT_EKET.

    ENDIF.

    WHEN 'DELETES'.

    CLEAR SY-UCOMM.

    • To delete the seleceted line from table control

    LOOP AT IT_EKET.

    IF IT_EKET-MARK = 'X'.

    MOVE-CORRESPONDING IT_EKET TO IT_SCHDEL.

    APPEND IT_SCHDEL.

    DELETE IT_EKET.

    ENDIF.

    ENDLOOP.

    WHEN 'SELECTS'.

    CLEAR SY-UCOMM.

    • To select all the rows of table control

    LOOP AT IT_EKET.

    IT_EKET-MARK = 'X'.

    MODIFY IT_EKET.

    ENDLOOP.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0230 INPUT

    &----


    *& Module CHECK_QUANTITY INPUT

    &----


    • text

    ----


    MODULE CHECK_QUANTITY INPUT.

    IF TABCONTROL-activetab = 'SCHEDULE' AND SY-UCOMM <> 'ITEMLINES' AND

    SY-UCOMM <> 'ADDS' AND SY-UCOMM <> 'DELETES' AND

    SY-UCOMM <> 'SELECTS' AND SY-UCOMM <> 'DESELECTS'.

    LOOP AT IT_EKPO.

    IF IT_EKPO-menge IS INITIAL .

    MESSAGE ' QUANTITY SHOULD NOT BE INITIAL ' TYPE 'I'.

    CLEAR SY-UCOMM.

    ENDIF.

    ENDLOOP.

    ENDIF.

    ENDMODULE. " CHECK_QUANTITY INPUT

    &----


    *& Module DESELECT INPUT

    &----


    • text

    ----


    MODULE DESELECT INPUT.

    IF SY-UCOMM EQ 'DESELECTS'.

    LOOP AT IT_EKET.

    IT_EKET-MARK = ' '.

    MODIFY IT_EKET INDEX SY-TABIX.

    ENDLOOP.

    ENDIF.

    ENDMODULE. " DESELECT INPUT

    REWARD IF USEFUL

    thanks and regards

    suma sailaja

    Edited by: suma sailaja pvn on Jan 9, 2008 2:10 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.