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

odule pool

DEAR Experts

i have created following modulpool program

but i want the case like

on the screen when i select KUNNAR ( customer number) after clicking on display button it should show all the remaining field automatically

the remaining fields are

land,name,city,telephone ,address

what modification i will have to do in following coding please tel me

PROGRAM ZAPPLE.

TABLES ZKNA2.

DATA:BEGIN OF ITAB OCCURS 0,

KUNNR LIKE ZKNA2-KUNNR,

LAND1 LIKE ZKNA2-LAND1,

NAME1 LIKE ZKNA2-NAME1,

ORT01 LIKE ZKNA2-ORT01,

TELF1 LIKE ZKNA2-TELF1,

ADRNR LIKE ZKNA2-ADRNR,

DISPLAY TYPE C,

*

OK_CODE LIKE SY-UCOMM,

END OF ITAB.

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

-


MODULE USER_COMMAND_0100 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'DISPLAY'.

SELECT KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM ZKNA2 INTO ITAB

WHERE

KUNNR = ZKNA2-KUNNR.

APPEND ITAB.

ENDSELECT.

ENDCASE.

ENDMODULE.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Posted on Aug 07, 2008 at 11:19 AM

    For one Kunnr why are taking table. It will be a single entry if you are selecting from KNA1. but you are selecting from ZKNA1. if you have more entries then you have to Use table control. in this case i assumed that you have some fields in the screen which are display .

    PROGRAM ZAPPLE.
    
    TABLES ZKNA2.
    DATA:BEGIN OF ITAB ,
    KUNNR LIKE ZKNA2-KUNNR,
    LAND1 LIKE ZKNA2-LAND1,
    NAME1 LIKE ZKNA2-NAME1,
    ORT01 LIKE ZKNA2-ORT01,
    TELF1 LIKE ZKNA2-TELF1,
    ADRNR LIKE ZKNA2-ADRNR,
    DISPLAY TYPE C,
    
    *
    OK_CODE LIKE SY-UCOMM,
    END OF ITAB.
    "<----Patch here...
    "In the screen you set tthe Group1 as ABC for all the fields 
    "except KUNNR.
    MODULE status_0100 OUTPUT.
    
    set pf-status 'AAA'. 
    if itab-kunnr  eq ' '.
    loop at screen.
    
    if screen-group1 = 'ABC'.
     screen-active = 0.
    endif.
    
    endloop.
    endif.
    
    ENDMODULE.
    
    "<----End Patch here...
    MODULE USER_COMMAND_0100 INPUT.
    
    CASE SY-UCOMM.
    
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    
    WHEN 'DISPLAY'.
    
    SELECT SINGLE  KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM ZKNA2 INTO ITAB
    WHERE
    KUNNR = ZKNA2-KUNNR.
    
    
    ENDCASE.
    
    ENDMODULE.

    Check the modified code.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Rohan,

      I think you can use the DDIC Object Search help to fulfill your requirement.

      1. You need to create a Database View. In the View you use the tables and can select the fields that you want in the View.

      2. Then Create the Search Help. Use the above created View and then take input as the Customer Name.

      3. You can now associate this structure in the UI Field. Or you can create a new UI Element. And then in that you can associate that Search Help.

      Hope this Helps.

      Thanks,

      Samantak.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 07, 2008 at 01:53 PM

    Hi

    After your select statement, assign the workarea values to your screen fields...

    <screen field name> = wa-<fieldname>

    eq

    zname1 = itab-name1.

    assuming zname1 is the screen field name

    regards

    padma

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi,

      Try the code given below.

      Regards,

      Wajid Hussain P.

      " * * * * *

      PROGRAM ZAPPLE.

      TABLES ZKNA2.

      DATA:BEGIN OF ITAB, " OCCURS 0, " Structure

      KUNNR LIKE ZKNA2-KUNNR,

      LAND1 LIKE ZKNA2-LAND1,

      NAME1 LIKE ZKNA2-NAME1,

      ORT01 LIKE ZKNA2-ORT01,

      TELF1 LIKE ZKNA2-TELF1,

      ADRNR LIKE ZKNA2-ADRNR,

      DISPLAY TYPE C,

      OK_CODE LIKE SY-UCOMM,

      END OF ITAB.

      "&----


      "& Module USER_COMMAND_0100 INPUT

      "&----


      MODULE USER_COMMAND_0100 INPUT.

      CASE SY-UCOMM.

      WHEN 'EXIT'.

      LEAVE PROGRAM.

      WHEN 'DISPLAY'.

      " Get details of a Customer

      SELECT SINGLE KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR

      FROM ZKNA2

      INTO CORRESPONDING FIELDS OF ITAB

      WHERE KUNNR = ZKNA2-KUNNR.

      IF NOT sy-subrc IS INITIAL.

      MOVE-CORRESPONDING ITAB TO ZKNA2. " New code is here

      ENDIF.

      ENDCASE.

      ENDMODULE.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 08, 2008 at 05:17 AM

    Hi

    Change you SQL statement as follows and check.

    SELECT SINGLE KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM

    ZKNA2 INTO CORRESPONDING FIELDS OF ZKNA2 WHERE KUNNR = ZKNA2-KUNNR.

    Hope it helps.

    Murthy

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 08, 2008 at 05:33 AM

    hi

    You can write the code for passing the variables to screen fields after your end select under the display .

    WHEN 'DISPLAY'.

    SELECT KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM ZKNA2 INTO ITAB

    WHERE

    KUNNR = ZKNA2-KUNNR.

    APPEND ITAB.

    ENDSELECT.

    <screen element name> = <itab-fieldname>

    end case.

    regards

    padma

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      yaa padma

      its below

      PROCESS BEFORE OUTPUT.

      MODULE STATUS_0100.

      PROCESS AFTER INPUT.

      MODULE USER_COMMAND_0100.

      • after clicking module user command 100 following code comes

      PROGRAM ZAPPLE.

      TABLES ZKNA2.

      DATA:BEGIN OF ITAB OCCURS 0,

      KUNNR LIKE ZKNA2-KUNNR,

      LAND1 LIKE ZKNA2-LAND1,

      NAME1 LIKE ZKNA2-NAME1,

      ORT01 LIKE ZKNA2-ORT01,

      TELF1 LIKE ZKNA2-TELF1,

      ADRNR LIKE ZKNA2-ADRNR,

      END OF ITAB.

      *DISPLAY TYPE C,

      *

      *DATA : OK_CODE .

      *CASE SY-UCOMM.

      *END OF ITAB.

      &----


      *& Module USER_COMMAND_0100 INPUT

      &----


      • text

      ----


      MODULE USER_COMMAND_0100 INPUT.

      CASE SY-UCOMM.

      WHEN 'EXIT'.

      LEAVE PROGRAM.

      WHEN 'DISPLAY'.

      " Get details of a Customer

      SELECT SINGLE KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR

      FROM ZKNA2

      INTO CORRESPONDING FIELDS OF ITAB

      WHERE KUNNR = ZKNA2-KUNNR.

      IF NOT sy-subrc IS INITIAL.

      MOVE-CORRESPONDING ITAB TO ZKNA2. " New code is here

      ENDIF.

      • SELECT SINGLE KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM

      *ZKNA2 INTO CORRESPONDING FIELDS OF ZKNA2 WHERE KUNNR = ZKNA2-KUNNR.

      *SELECT KUNNR LAND1 NAME1 ORT01 TELF1 ADRNR FROM ZKNA2 INTO ITAB

      *WHERE

      *KUNNR = ZKNA2-KUNNR.

      *APPEND ITAB.

      *ENDSELECT.

      ENDCASE.

      ENDMODULE. " USER_COMMAND_0100 INPUT

      &----


      *& Module STATUS_0100 OUTPUT

      &----


      • text

      ----


      MODULE STATUS_0100 OUTPUT.

      • SET PF-STATUS 'xxxxxxxx'.

      • SET TITLEBAR 'xxx'.

      ENDMODULE. " STATUS_0100 OUTPUT

  • author's profile photo Former Member
    Former Member
    Posted on Aug 09, 2008 at 03:14 PM

    Hi Rohan,

    Once you get the data in Itab header line move the data to the fields name of zkna2. Like,

    zkna2-land1 = itab-land1.

    zkna2-orto1 = itab-orto1.

    zkna2-telf1 = itab-telf1.

    zkna2-adrnr1 = itab-adrnr1.

    Do it in pai module - When 'DISPLAY'. Make sure that fields' name in the screen should be same as zkna2 fields' name.

    if you dont have next screen then set the next screen number in the attribute of screen to the same number of screen where you have zkna2 fields. If you have next screen then call the same screen -zkna2 fields.

    call screen 'nnn'.

    Regards,

    Ahmed.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2008 at 05:30 AM

    Hi,

    assuming that the screen fields are including / inserted from the db table zkna2.

    after your select statement....

    if sy-subrc eq 0.

    zkna2-land1 = itab-land1.

    zkna2-orto1 = itab-orto1.

    zkna2-telf1 = itab-telf1.

    zkna2-adrnr1 = itab-adrnr1.

    endif.

    regards

    padma

    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.