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 in Module pool program

Former Member
0 Likes
961

Hi,

I am working on module pool program. The below is my code. Here itab it_articles is a table control. I entered two records while running and when I checked in debugging mode this table does not have my two records but still it loops and control goes inside the loop. But the header field it_articles-ean11 have value.

My requirement is to get all the articles to make a select from another standard table. I dont want to put the select inside the loop. But here since itab it_articles does not have any value at the beginning, I am not able to use it before the looping. Any advice.

LOOP AT it_articles.    "no value in it_articles and still it loops
    CHAIN.
      FIELD it_articles-ean11       "Value is there in header it_articles-ean11
      MODULE get_article ON INPUT.
    ENDCHAIN.
  ENDLOOP.

5 REPLIES 5
Read only

Former Member
0 Likes
801

Hi Vinraj,

Your requirment is not clear. But as per my understanding you need record from table control to your varibal.

You should write loop endloop to internal table in PBO and PAI event rather loop at table control in PAI.

If you want data from table control then in PAI event you should write

loop at itab.

module update.

endloop.

Module update.

wa_itab to itab.

***********

likewise you are transfering your table control data to internal table . Now you can use article field data from internal table

Thanks,

Nilima

Read only

Former Member
0 Likes
801

Hello You need to add below code in PBO and PAI respectively.

PBO.
LOOP AT IT_ARTICLES WITH CONTROL TC1 CURSOR TC1-TOP_LINE.
MODULE <Get Article>.
ENDLOOP.

Where : TC1 is your table control name on the screen
Inside the module add code to move data from IT_ARTICLES to Screen field/table control fields

PAI.
LOOP AT IT_ARTICLES.
ENDLOOP.

Hope this helps

Regards

Shiva

Read only

Former Member
0 Likes
801

Hi!

Try this


process before output.
  module status_2000.
  module initialization.

  module exit at exit-command.

  loop at itab2.
    module check_values.
    module check_table. <----

  endloop.


module check_table input.

  modify itab2 index normal-current_line.
  if sy-subrc ne 0.
    append itab2.
  endif.

endmodule.                 " check_table  INPUT

Read only

RaymondGiuseppi
Active Contributor
0 Likes
801

Try a

LOOP AT it_articles.    "no value in it_articles and still it loops
    CHAIN.
      FIELD it_articles-ean11       "Value is there in header it_articles-ean11
      MODULE get_article ON CHAIN-REQUEST.
    ENDCHAIN.
  ENDLOOP.

And in get_article you insert/modify records in the internal table. (INDEX <TABCTRL>-CURRENT_LINE.)

Regards,

Raymond

Read only

Former Member
0 Likes
801

This message was moderated.