Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

getting the description

Former Member

hi,

i am working on module pool program.

i have placed a I/O field MATNR on the screen next to it i have placed another I/O field for displaying the material descriptionMAKTX.

my requirement is when user slects a particular material number the material description coresponding to that material number should be displyed in the screen field MAKTX.

thanks in Advance,

neha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try declaring a global variable in program and create a display only field in transaction with the same name or thru Get from program option and in PAI select description for MATNR from MAKT table to that variable.Then the value will be displayed.

9 REPLIES 9

Former Member
0 Kudos

Material Descriptions are stored in table MAKT - read this with the key of Material and signon language.

Former Member
0 Kudos

Hello Neha,

´Do like this.

Add one I/O field with output only.

In the PAI of the screen do like this.


REPORT ZV_MODULE .
TABLES: MAKT.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  IF NOT MAKT-MATNR IS INITIAL.
 SELECT SINGLE MAKTX FROM MAKT INTO MAKT-MAKTX WHERE MATNR = MAKT-MATNR
                                                 AND SPRAS = SY-LANGU  .
  ENDIF.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
  IF NOT MAKT-MATNR IS INITIAL.
 SELECT SINGLE MAKTX FROM MAKT INTO MAKT-MAKTX WHERE MATNR = MAKT-MATNR
                                                 AND SPRAS = SY-LANGU  .
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT

Vasanth

0 Kudos

hi,

i tried using the same code sent by you but it not working

0 Kudos

Hi,

Put a new I/O field (say name as DESCR) to the right of the user input field, and in the properties specify as display only.

In the PAI of the screen, on any module, do a select to fill DESCR screen field

(SELECT SINGLE MAKTX FROM MAKT INTO DESCR

WHERE MATNR = MARA-MATNR

AND SPRAS = SY-LANGU.)

Here I assume that MARA-MATNR is the name of the screen field selected by the user. The above code can be writen in PAI in user command also.

Make sure you (or user) press enter after filling the MARA-MATNR field.

Regards,

Anish Thomas

<i>Pls mark all useful answers</i>

0 Kudos

HI,

The MATNR which i am placing on the screen is from dictionary. so by default it will have F4 help. so the user will select the material number based on this F4 help.i have to get material desc based on the selected material number .

Former Member
0 Kudos

Try declaring a global variable in program and create a display only field in transaction with the same name or thru Get from program option and in PAI select description for MATNR from MAKT table to that variable.Then the value will be displayed.

Former Member
0 Kudos

Hi Neha

In main program declare the variable

data: gv_maktx type makt-maktx.

tables:mara,makt.

In PAI

PROCESS AFTER INPUT.

FIELD makt-maktx MODULE m_matdescrip_validate.

MODULE user_command_1000.

Then double click on this module. Just write the piece of code

MODULE m_matdescrip_validate INPUT.

IF NOT mara-matnr IS INITIAL.

SELECT SINGLE maktx FROM makt INTO gv_maktx

WHERE matnr = mara-matnr.

makt-maktx = gv_maktx.

ENDIF.

ENDMODULE.

I hope this will be useful.

Thanks & Regards

0 Kudos

I think you're asking about updating a screen field after an F4 search... here is part of an answer I used for a similar question the other day - hopefully it solves your requirement.

I think you should look at function module DYNP_VALUES_UPDATE (or CALL METHOD c_dynpro_handler=>set_dynp_values which calls this function). There are lots of examples in SAP's code but basically this allows you to push values back onto the screen from within an F4 request.

I've used it, for example, for filling in the name and address details on the screen after the user has selected a customer number from the searchhelp.

You will need to trigger the searchhelp yourself inside your screen e.g.


process on value-request. 
   field gs_9900-my_field
   module d9900_f4_my_field.

and then


module d9900_f4_my_field input.
  perform d9900_f4_my_field.
endmodule.

and then something along the lines of

form d9900_f4_my_field.
 
  data:
    l_dynpprog          like sy-repid,
    l_dynpnr            like sy-dynnr,
    lt_dynpfield        like dynpread,
    lt_dynpfield        like dynpread   occurs 10.
 
  l_dynpprog    = sy-repid.
  l_dynpnr      = sy-dynnr.
 
  call function 'F4IF_FIELD_VALUE_REQUEST'  "trigger your search help
     exporting
        ...
     importing
        ...
*
* use the results from 'return_tab-fieldval' to get the other data you want on the screen 
* then build up lt_dynpfield with the field names and values for the screen e.g.
* 
  clear: ls_dynpfield.
  concatenate 'GS_' l_dynpnr '-CUSTOMER_NAME'
    into ls_dynpfield-fieldname.
  ls_dynpfield-stepl      = 0.
  ls_dynpfield-fieldvalue = kna1-name1.
  ls_dynpfield-fieldinp   = space.
  append ls_dynpfield to lt_dynpfield.
  clear: ls_dynpfield.
  concatenate 'GS_' l_dynpnr '-ADDRESS_LINE_01'
    into ls_dynpfield-fieldname.
  ls_dynpfield-stepl      = 0.
  ls_dynpfield-fieldvalue = kna1-name1.
  ls_dynpfield-fieldinp   = space.
  append ls_dynpfield to lt_dynpfield.
* etc etc 
* then call the function that updates the screen
  call function 'DYNP_VALUES_UPDATE'  "update the screen fields
    exporting
      dyname     = l_dynpprog
      dynumb     = l_dynpnr
    tables
      dynpfields = lt_dynpfield
    exceptions
      others     = 0.
 
endform.

Let me know how it goes - and if you need any more specific sample code.

cheers

Jonathan

Former Member
0 Kudos

Hi neah jasty,

Creat a text tanble and use it.

Regards,

Rama.Pammi