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

Modify statement is not working

Hi

Modify statement is not working in below code.

Data is moved from i_headertext-bktxt TO i_output_tab-text.

Kindly help me out

SELECT mblnr mjahr bktxt FROM mkpf
  INTO CORRESPONDING FIELDS OF TABLE i_headertext
  FOR ALL ENTRIES IN i_stock
  WHERE mblnr EQ i_stock-mblnr
  and mjahr EQ i_stock-mjahr.

if sy-subrc = 0.
loop at I_stock.
      READ TABLE i_headertext WITH KEY mblnr = i_stock-mblnr
                                       mjahr = i_stock-mjahr.
        MOVE: i_headertext-bktxt TO i_output_tab-text.
        modify table i_output_tab TRANSPORTING text .
endloop.
Endif.

Thanks

Kumar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 02:23 AM

    Hi Kumar, try this way

    IF NOT i_stock[] IS INITIAL. "You must use this check. bcoz if u dont have values in i_stock, it gives dump.
      SELECT mblnr mjahr bktxt FROM mkpf
      INTO CORRESPONDING FIELDS OF TABLE i_headertext
      FOR ALL ENTRIES IN i_stock
      WHERE mblnr EQ i_stock-mblnr
      AND mjahr EQ i_stock-mjahr.
      IF sy-subrc = 0.
        LOOP AT i_stock.
          READ TABLE i_headertext WITH KEY mblnr = i_stock-mblnr
                                           mjahr = i_stock-mjahr.
          MOVE: i_headertext-bktxt TO i_output_tab-text.
          MODIFY TABLE i_output_tab TRANSPORTING text .
        ENDLOOP.
      ENDIF.
    ENDIF.
    Thanks Venkat.O

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2009 at 02:27 AM

    Hi Kumar,

    SELECT mblnr mjahr bktxt FROM mkpf

    INTO CORRESPONDING FIELDS OF TABLE i_headertext

    FOR ALL ENTRIES IN i_stock

    WHERE mblnr EQ i_stock-mblnr

    and mjahr EQ i_stock-mjahr.

    if sy-subrc = 0.

    loop at I_stock.

    READ TABLE i_headertext WITH KEY mblnr = i_stock-mblnr

    mjahr = i_stock-mjahr.

    MOVE: i_headertext-bktxt TO i_output_tab-text.

    modify table i_output_tab TRANSPORTING text .

    endloop.

    Endif.

    As per your above code, you have not specified any criteria to modify I_OUTPUT_TAB. Either you have to give Index or give WHERE clause. Are you looping on I_OUTPUT_TAB? If that is the case, then it should modify current row.

    Give your required part of code, so that I can try to give you solution.

    Thanks & Regards,

    Anil Salekar

    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.