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

Problem with module pool

Former Member
0 Likes
731

Hi All,

i am working on a table contol in module pool programming.

Now i have three columns in my control table.

In my user_command_0100 input, i have written these code,

so that when user hits enter, he will get two fields filled in table control.

MODULE USER_COMMAND_9000 INPUT.

WHEN 'ENTER'.
       PERFORM DISP_DATA.


Now, inside FORM disp_data. i am selecting two fields from a table.


FORM DISP_DATA .
SELECT MANDT FIELD1 FIELD2
     FROM ZTABLE
     INTO  TABLE  IT_FINAL.
  ENDFORM.  


Now the problem is that, when user hits first enter , the two fields gets filled in my table control.

But the third filled will be filled by user on runtime.

So, the problem is that, when user fills the third field and again hits enter, the value entered by him gets disappeared.

Because it again initialize only two fields, but my requirement is when user fills third field value at run time,

it should retain in table control.

Please tell me what changes i have to perform, in the above code.

1 ACCEPTED SOLUTION
Read only

former_member187748
Active Contributor
0 Likes
706

Hi Srikant,

i think whatever Arun is sujjesting is right, but please change your code as shown below

@, i think he has to use if it_final[] is initial, isn't it.

WHEN 'ENTER'.

       PERFORM DISP_DATA.


FORM DISP_DATA .

IF IT_FINAL[] IS INITIAL.

    SELECT MANDT FIELD1 FIELD2

     FROM ZTABLE

     INTO  TABLE  IT_FINAL.

ENDIF.

ENDFORM.   

5 REPLIES 5
Read only

former_member212148
Participant
0 Likes
706

Hi Srikant,

Modify your internal table. and its better to use work area if possible.

Sample code to modify

MODIFY ITRGPDET
     FROM WARGPDET
     INDEX RGPTBL1021-CURRENT_LINE.
     IF SY-SUBRC <> 0.
       APPEND ITRGPDET.
     ENDIF.



Here ITRGPDET is internal table and WARGPDET is work area.

Thanks,

Ranjit K.

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
706

Hello Srikant Jain.

* INTO TABLE statement overwrites the internal table data every time you press ENTER.

* In the form DISP_DATA, you write:

     if IT_FINAL[] is not initial.

     if IT_FINAL[] is initial.

          SELECT MANDT FIELD1 FIELD2 FROM ZTABLE

          INTO  TABLE  IT_FINAL.

     endif.


Regards.

Read only

former_member187748
Active Contributor
0 Likes
707

Hi Srikant,

i think whatever Arun is sujjesting is right, but please change your code as shown below

@, i think he has to use if it_final[] is initial, isn't it.

WHEN 'ENTER'.

       PERFORM DISP_DATA.


FORM DISP_DATA .

IF IT_FINAL[] IS INITIAL.

    SELECT MANDT FIELD1 FIELD2

     FROM ZTABLE

     INTO  TABLE  IT_FINAL.

ENDIF.

ENDFORM.   

Read only

0 Likes
706

Small coding mistake

Read only

0 Likes
706