Application Development and Automation 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: 
Read only

table control field not getting the value.

Former Member
0 Likes
697

Hi all,

Iam writing a select query to fetch the description(MAKTX of MAKT) from the material number (MATNR of MARA). So in the table control , I need to display the description.

This is the Scenario : in Table Control, iam having the data for maktx. The matnr field is editable so that the end user can enter material number and get the description from material master (MARA).

if table control already holds the description, If I enter matnr and press enter key, the maktx field should be populated and here if already existed maktx is same as mara-maktx for given matnr, No need to change otherwise, the old description should be overwritten by the new description.

this is my code :

xmatdesc -


internal table

xekpo3 -


internal table for table control.


    WHEN 'ENT'.
        SELECT a~matnr
               b~maktx
               INTO CORRESPONDING FIELDS OF TABLE xmatdesc
               FROM mara AS a INNER JOIN makt AS b
               ON a~matnr = b~matnr
               WHERE a~matnr = xekpo3-matnr AND
                     b~spras = 'EN'.
        IF NOT xekpo3-maktx = xmatdesc-maktx.    "checking existed maktx with mara-maktx for given matnr.
          CLEAR xekpo3-maktx.
          MOVE-CORRESPONDING xmatdesc TO xekpo3.
          APPEND xekpo3.
        ELSE.
          EXIT.
        ENDIF.
      

but iam not getting the maktx value in my table control field. Please provide your views and tell me where it is going wrong.

thanking you,

regards

Murali Krishna T

Hi all,

Iam writing a select query to fetch the description(MAKTX of MAKT) from the material number (MATNR of MARA). So in the table control , I need to display the description.

This is the Scenario : in Table Control, iam having the data for maktx. The matnr field is editable so that the end user can enter material number and get the description from material master (MARA).

if table control already holds the description, If I enter matnr and press enter key, the maktx field should be populated and here if already existed maktx is same as mara-maktx for given matnr, No need to change otherwise, the old description should be overwritten by the new description.

this is my code :

xmatdesc -


internal table

xekpo3 -


internal table for table control.


    WHEN 'ENT'.
        SELECT a~matnr
               b~maktx
               INTO CORRESPONDING FIELDS OF TABLE xmatdesc
               FROM mara AS a INNER JOIN makt AS b
               ON a~matnr = b~matnr
               WHERE a~matnr = xekpo3-matnr AND
                     b~spras = 'EN'.
        IF NOT xekpo3-maktx = xmatdesc-maktx.    "checking existed maktx with mara-maktx for given matnr.
          CLEAR xekpo3-maktx.
          MOVE-CORRESPONDING xmatdesc TO xekpo3.
          APPEND xekpo3.
        ELSE.
          EXIT.
        ENDIF.
      

but iam not getting the maktx value in my table control field. Please provide your views and tell me where it is going wrong.

thanking you,

regards

Murali Krishna T

3 REPLIES 3
Read only

Manohar2u
Active Contributor
0 Likes
661

You are moving entries into internal table "CORRESPONDING FIELDS OF TABLE xmatdesc" and comparing with the structure "xekpo3-maktx = xmatdesc-maktx"

Either you remove mapping into internal table Or compare it inside loop - endloop.

Hope you got my point..

Read only

Former Member
0 Likes
661

Hi,

OK_CODE of enter is 'OK'

try writing OK insted of ENT

Read only

Former Member
0 Likes
661

Hi Murali,

You can do a very simple thing,

Here it is,

In the PAI write this code,

CHAIN.

FIELD MATNR,

FIELD MAKTX. MODULE get_description."Double click on the Module get_description and write the code in it.

ENDCHAIN.

MODULE get_description.

SELECT single b~maktx

into xmatdesc

FROM mara AS a INNER JOIN makt AS b

ON amatnr = bmatnr

WHERE a~matnr = MATNR AND "MATNR - Field Content{color]

b~spras = 'EN'.

IF sy-subrc = 0.

maktx = xmatdesc.

ENDIF.

ENDMODULE.

So the above code will run for all the rows in the table control and update the material description if it is the same then it will overrite.

Hope it helps you,

Regards,

Abhijit G. Borkar