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

module pool programming

hey,

i have 2 screens in which for the same field i need to display F4 help thru

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'.

how do i modularize my code ?

currently in screen 100, under PAI i have

FIELD KUNNR MODULE XXXX.

and in a separate include i have

MODULE XXXX INPUT.

endmodule..

i need a similar code for screen 200, but i dont want to replicate the code..

so where and how do i write a single piece of code for F4 help and call that (i need to pass the field as paramater i suppose). can anyone explain clearly and give me sample code ? thks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jul 25, 2008 at 01:55 PM

    Combined and Reuasble code.

    PROGRAM  ztest_duplica.
    
    DATA: kunnr1(10),
          kunnr2(10).
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0200  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE user_command_0200 INPUT.
    
      CASE sy-ucomm.
        WHEN 'BACK'.
    
          LEAVE TO SCREEN '100'.
        WHEN 'NEXT'.
    
          LEAVE TO SCREEN '200'.
      ENDCASE.
    
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&---------------------------------------------------------------------*
    *&      Module  get_help  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE get_help INPUT.
    
      DATA:i_retab TYPE TABLE OF  ddshretval,
           wa_ret TYPE ddshretval.
    
      TYPES: BEGIN OF x_itab,
      kunnr TYPE kunnr,    "it should be type to some standard data element
      END OF x_itab.
    
      FIELD-SYMBOLS: <fs> TYPE ANY.
      CLEAR : kunnr1, kunnr2.
      DATA: dynfield  TYPE help_info-dynprofld,
            wa_itab TYPE x_itab,
            i_tab LIKE TABLE OF wa_itab WITH HEADER LINE.
      CLEAR  dynfield.
      IF sy-dynnr = '0100'.
        dynfield = 'KUNNR1'.
      ELSE.
        dynfield = 'KUNNR2'.
      ENDIF.
    
      SELECT kunnr FROM kna1
          INTO TABLE i_tab
          UP TO 20 ROWS.
    
      "retfield we will pass the column name we are going to get from f4
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield    = 'KUNNR'   "<---Return field column name
          dynpprog    = sy-repid
          dynpnr      = sy-dynnr
          dynprofield = dynfield
          value_org   = 'S'
        TABLES
          value_tab   = i_tab
          return_tab  = i_retab.
      IF sy-subrc EQ 0.
        READ TABLE i_retab INTO wa_ret INDEX 1.
        ASSIGN (dynfield) TO <fs> .
        <fs> = wa_ret-fieldval .
        UNASSIGN <fs>.
      ENDIF.
    ENDMODULE.                 " get_help  INPUT

    Flow logic for 100 screen

    screen consists of Input field pointing to KUNNR1, and a Button to NEXT to 200 screen .

    PROCESS BEFORE OUTPUT.
    * MODULE STATUS_0100.
    *
    PROCESS AFTER INPUT.
     MODULE USER_COMMAND_0200.
    
    process on value-request.
    
    field kunnr1 module get_help.

    Flow logic for 200 screen.

    screen consists of Input field pointing to KUNNR2, and a Button to back to 100 screen .

    PROCESS BEFORE OUTPUT.
    * MODULE STATUS_0200.
    *
    PROCESS AFTER INPUT.
      MODULE user_command_0200.
    
    PROCESS ON VALUE-REQUEST.
    
      FIELD kunnr2 MODULE get_help.

    Create a Tcode and Intitial screen 100. and check it .

    Regards

    Vijay Babu Dudla

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 25, 2008 at 01:25 PM

    Sdnuser,

    i think you need to have your code replicate casue PAI is seperate for both screen so we cant use the FM for both screen in one hit.

    either you can use macro and use this marco in both screen here you can save effrot for replicate your code.but its not a good idea.

    Amit.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2008 at 01:27 PM

    Call a perform in both the Modules. and write your code in the perform.

    Does that work?

    ~RK.

    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.