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

need data from li_gmia to i_gmia for a particular condition.

if li_gmia-rbukrs = i_gmgr_text-company_code

then i want to move li_gmia to i_gmia.

I'm trying in this manner?

Is the following approach ok?

loop at i_gmgr_text into w_gmgr_text.

loop at li_gmia into lw_gmia.

if w_gmgr_text-company_code = lw_gmgia-company_code.

MOVE lw_gmiga TO w_gmia.

APPEND w_gmgia INTO i_gmiga.

ENDIF.

endloop.

endloop.

Kindly comment.

Regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 05:07 AM

    Hi

    Do like this

    loop at i_gmgr_text into w_gmgr_text.

    loop at li_gmia into lw_gmia where company_code = w_gmgr_text-company_code .

    MOVE lw_gmiga TO w_gmia.

    APPEND w_gmgia INTO i_gmiga.

    endloop.

    endloop.

    Regards

    Aditya

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2008 at 05:08 AM

    Hello Dude,

    NESTED LOOPS - a strict NO-NO.

    Try this code:

    SORT i_gmgr_text BY company_code.
    
    loop at li_gmia into lw_gmia.
    READ TABLE i_gmgr_text into w_gmgr_text.
    WITH KEY company_code = lw_gmgia-company_code
    BINARY SEARCH.
    IF sy-subrc = 0.
    MOVE lw_gmiga TO w_gmia.
    APPEND w_gmgia INTO i_gmiga.
    ENDIF.
    endloop.
    

    Hope this is clear.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

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

    Hi,

    try this way.

    loop at i_gmgr_text into w_gmgr_text.

    loop at li_gmia into lw_gmia WHERE company_code = w_gmgr_text-company_code .

    MOVE lw_gmiga TO w_gmia.

    APPEND w_gmgia INTO i_gmiga.

    endloop.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 19, 2008 at 05:14 AM

    Hi,

    Try this....

    loop at i_gmgr_text into w_gmgr_text.

    READ table li_gmia into lw_gmia with key company_code = w_gmgr_text-compant_code binary search.

    if sy-subrc = 0.

    MOVE lw_gmiga TO w_gmia.

    ENDIF.

    Append w_gmgr_text to i_gmgr.

    endloop.

    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.