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

condition fields table

Hi abappers,

I want put condition in the my Z table; if field A is empty then the field B never must have the value empty.

Is posible with t-code sm30?

Thank you very much.

Cordial greetings.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2008 at 09:28 AM

    hi,

    go to SE80

    then open the FG inside which u have created the table maintenance for the table for which u want to put the condition

    now to go the view on the left handside down corner i.e. Object Name

    u can ur FG name drill down and then click on then screens

    then u can see the table maintenance screen number click on that

    on the right hand side u will see the code.....

    Under PROCESS AFTER INPUT.

    u will see bunch f code inside

    LOOP AT EXTRACT.

    CHAIN.

    FIELD ZARK_ALV_TEST-EMPLOYEE .

    FIELD ZARK_ALV_TEST-LOCATION .

    perform F_validate.

    FIELD ZARK_ALV_TEST-QUOTA .

    FIELD ZARK_ALV_TEST-GRADE .

    ENDCHAIN.

    ENDLOOP.

    say in my case i need to validate LOCATION field

    so i write a perform and declare that in any include in my FG

    and code will be as follows :

    if ZARK_ALV_TEST-EMPLOYEE = ' '.

    if ZARK_ALV_TEST-LOCATION = ' '.

    message E000(38) with " Enployee is null so loaction cant be null. plz enter value i location." .

    endif.

    endif.

    reward points if useful ..... 😊

    and also mark the post answered once ur problem is solved......

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 06, 2008 at 02:06 PM

    Go to SE54, and activate an event :

    1. Choose Utilities > Table Maintenance Generator.

    2. Choose the selection button Generated Objects.

    3. Choose Environment > Modification > Events.

    If you don't find a suitable event you can change the generated dynpro itself. (add checks to the PAI...)

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2008 at 02:07 PM

    Hello.

    I can't see a way to do that in SM30 or SE11 itself.

    However, you can validade in all programs/exits that update your ztable, if that condition is true before doing the updating.

    Regards.

    Valter Oliveira.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2008 at 10:16 AM

    hello,

    mark the post answered once ur problem is solved... dont keep it open for others to answer unnecessarily

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 07, 2008 at 11:20 AM

    I think its not possible directly from SM30 or SE11.

    it should be code into your update program from where you are updating the Z table.

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 09, 2008 at 06:08 PM

    thank you very much Ajantha,

    post the complete code:

    In the DYNPRO:

    PROCESS BEFORE OUTPUT.
     MODULE LISTE_INITIALISIEREN.
     LOOP AT EXTRACT WITH CONTROL
      TCTRL_ZTT CURSOR NEXTLINE.
       MODULE LISTE_SHOW_LISTE.
     ENDLOOP.
    *
    PROCESS AFTER INPUT.
     MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
     MODULE LISTE_BEFORE_LOOP.
     LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZTT-ZBUKRS .
        FIELD ZTT-ZDHKONT .
        FIELD ZTT-ZHHKONT .
        FIELD ZTT-ZSRHKONT .
        FIELD ZTT-ZLIFNR .
    
    *start insert validate fields
    
        module test.
    
    *end insert validate fields
    
        FIELD ZTT-ZUMSKZ .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZTT-ZBUKRS .
        FIELD ZTT-ZDHKONT .
        FIELD ZTT-ZHHKONT .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
     ENDLOOP.
     MODULE LISTE_AFTER_LOOP.

    ***************************************************************************************

    ***************************************************************************************

    *IN MY INCLUDE:

    module test input.
    
    IF ZTT-ZSRHKONT CO ' 0123456789'
     AND ZTT-ZLIFNR CO ' 0123456789'.
    
        IF ZTT-ZSRHKONT EQ ' ' AND ZTT-ZLIFNR EQ ' ' .
                MESSAGE w000 WITH
    'Intro ZSRHKONT or ZLIFNR'.
    
          IF ZTT-ZUMSKZ NE ' '.
                MESSAGE w000 WITH
    'Intro ZLIFNR for CME'.
          ENDIF.
        ELSEIF ZTT-ZSRHKONT NE ' ' AND ZTT-ZLIFNR NE ' '.
              MESSAGE w000 WITH
    'Delete ZSRHKONT or ZLIFNR'.
          IF ZTT-ZUMSKZ NE ' '.
                MESSAGE w000 WITH
    'Only ZLIFNR for CME, insert again'.
          ENDIF.
        endif.
    
     IF ZTT-ZLIFNR EQ ' ' AND ZTT-ZUMSKZ NE ' '.
                    MESSAGE w000 WITH
    'Intro ZLIFNR for CME'.
     ENDIF.
    
    ELSE.
    
    *  'Only allow value  0123456789'.
      MESSAGE w076.
    
    ENDIF.
    endmodule.                 " TEST  INPUT

    I think that it is used a lot of IF 😉, but the moment, it is correct,

    If somebody think that other code is more performance, please post message with the code.

    In other day try continue with the code,

    I want obtain a table control with fields shady that I want no editable.

    with ALV it is easy but with table control...

    Cordial greetings.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hey,

      Your code if fine ..... i dont think these If stmt can be replaced by any other conditional stmts .......

      and abt the non editable fields in SE80

      goto Function Group

      then click on Screen

      then click on Element List Tab

      below u can see list of ur fields strting with ZTT-......

      and against that u can have to uncheck the checkbox in INPUT column ......

      so that the input for the field will be disabled..... when u go in edit mode......

      if any query revert back........ 😊

      reward points if useful.......:-)

      and mark the post answered once ur problem is solved .... 😊

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2008 at 05:27 PM

    Thank you very much for you attention,

    Excuse me, but I view the post and I not sure if I understand it.

    I go to the tab "element list" of my DYMPRO (OK)

    I go to the checkbox in the column "input" of the field that I want unable and unable it, and then when I want to modify a field with the t-code SM30, the field now is unable (ok)

    but if I want put a condition in my code, where I set unable the field checkbox when I have a condition in my code

    How make it?

    Thanks.

    Cordial greetings

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 02:32 PM

    Hi abappers,

    I want post the complete solution of my problem:

    I have that go to the program corresponding of my table Z; It´s the format:

    SAPLZTT where ZTT is the name of table

    or

    I go to the group funtion :

    ZTT the name is the same of my table Z.

    in the SE38 push the button go to SE80 (CTRL + SHIFT + F5) or open the program with the SE80 directely.

    Before I have go to the control program of my table Z (insert data with t-code SM30)

    SAPLZTT, ok, then I put the include at the end of the code:

    INCLUDE LZTTI01.
    
    INCLUDE LZTTO01.
    
    INCLUDE LZTTF01.

    In my DYNPRO:

    PROCESS BEFORE OUTPUT.
    
     MODULE LISTE_INITIALISIEREN.
    
     LOOP AT EXTRACT WITH CONTROL
      TCTRL_ZTT CURSOR NEXTLINE.
       MODULE LISTE_SHOW_LISTE.
    
    *START SET SHADY AND EDIT FIELDS
       module set_shady.
    *END SET SHADY AND EDIT FIELDS
    
     ENDLOOP.
    
    PROCESS AFTER INPUT.
    
     MODULE LISTE_EXIT_COMMAND AT EXIT-COMMAND.
     MODULE LISTE_BEFORE_LOOP.
     LOOP AT EXTRACT.
       MODULE LISTE_INIT_WORKAREA.
       CHAIN.
        FIELD ZTT-ZA .
        FIELD ZTT-ZB .
        FIELD ZTT-ZC .
        FIELD ZTT-ZD .
        FIELD ZTT-ZE .
    
    *START VALIDATE FIELDS
        module test.
    *END VALIDATE FIELDS
    
        FIELD ZTT-ZF .
        MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
       ENDCHAIN.
       FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
       CHAIN.
        FIELD ZTT-ZA .
        FIELD ZTT-ZB .
        FIELD ZTT-ZC .
        MODULE LISTE_UPDATE_LISTE.
       ENDCHAIN.
     ENDLOOP.
     MODULE LISTE_AFTER_LOOP.

    In my INCLUDES: (where I put all code of PBO)

    LZTTO01

    module set_shady output.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
    endmodule.                 " SET_SHADY  OUTPUT

    In my INCLUDES: (where I put all code of PAI)

    LZTTI01

    module test input.
    
    
    IF ZTT-ZTT CO ' 0123456789'
     AND ZTT-ZLIFNR CO ' 0123456789'.
    
        IF ZTT-ZSRHKONT EQ ' ' AND ZTT-ZLIFNR EQ ' ' .
                MESSAGE w000 WITH
    'Put D or E'.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
          IF ZTT-ZF NE ' '.
                MESSAGE w000 WITH
    'Put E for F'.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
          ENDIF.
        ELSEIF ZTT-ZD NE ' ' AND ZTT-ZE NE ' '.
              MESSAGE w000 WITH
    'Put D or E'.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
          IF ZTT-ZF NE ' '.
                MESSAGE w000 WITH
    'Only E for F'.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
          ENDIF.
        endif.
    
     IF ZTT-ZE EQ ' ' AND ZTT-ZF NE ' '.
                    MESSAGE w000 WITH
    'Put E for F'.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
     ENDIF.
    
    ELSE.
      MESSAGE w066.
    IF status-action EQ 'U'.
     perform set_shady.
    ENDIF.
    ENDIF.
    endmodule.                 " TEST  INPUT

    In the characteristics of my DYNPRO

    Before I fill the next date in the tab of my DYNPRO List of elements and inside of this tab, other tab with the tab group funtion y then fill the next in the column with the name group 2 ( KEY,KEY,KEY,MAY,AKR,AKR,MAR):

    ZTT-ZA I/O KEY

    ZTT-ZB I/O KEY

    ZTT-ZC I/O KEY

    ZTT-ZD I/O MAY

    ZTT-ZE I/O AKR

    ZTT-ZF I/O AKR

    VIM_MARKEDVerifMAR

    In my include: (where I put the form of my program)

    LZTTF01

    form set_shady.
    
    *modificar registros que se han creado
    IF ZTT-ZA NE '' AND ZTT-ZB NE ''
                              AND ZTT-ZC NE ''.
    
     IF ZTT-ZTT NE ''.
    
      LOOP AT SCREEN.
    
        CASE screen-group2.
    
          WHEN 'AKR'.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
          WHEN 'MAY'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN 'KEY'.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
          WHEN 'MAR'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN OTHERS.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
    
        ENDCASE.
      ENDLOOP.
     ELSE.
    
      LOOP AT SCREEN.
    
        CASE screen-group2.
    
          WHEN 'AKR'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN 'MAY'.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
          WHEN 'KEY'.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
          WHEN 'MAR'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN OTHERS.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
    
        ENDCASE.
      ENDLOOP.
    
     ENDIF.
     IF ZTT-ZD EQ '' AND ZTT-ZE EQ '' OR
        ZTT-ZD NE '' AND ZTT-ZE NE '' OR
        ZTT-ZD NE '' AND ZTT-ZF NE ''.
    
       LOOP AT SCREEN.
    
        CASE screen-group2.
    
          WHEN 'AKR'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN 'MAY'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN 'KEY'.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
          WHEN 'MAR'.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
          WHEN OTHERS.
           screen-active = 1.
           screen-input = 0.
            MODIFY SCREEN.
    
        ENDCASE.
      ENDLOOP.
    
    ENDIF.
    ELSE.
     LOOP AT SCREEN.
           screen-active = 1.
           screen-input = 1.
            MODIFY SCREEN.
      ENDLOOP.
    ENDIF.
    
    endform.                    " SET_SHADY

    I hope that somebody its interesting.

    I hope so.

    Thanks for all.

    Cordial greetings.

    Edited by: lopez fernandez on Jun 16, 2008 4:36 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.