Application Development 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: 

how to read Macro?

Former Member
0 Kudos

can anyone explain me how to know which table the below code is reading data from Database.

    DEFINE sel.
    when &1.
      sort s_t_select by fieldnm.                  
      do.
        fetch next cursor g_cursor into id.
        if sy-subrc eq 0.
          import &2 from database &3(bw) id id. 

I want to know how these macro will fetch data from database.

In the below code i have shown how these &2 and &3 have been built.

 CASE s_estruc.
        sel 'MC03BF0'      mc03bf0_tab       mc03bf0setup.
        ENDCASE.

Regards,

Mayank

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

This the result of your program with macro:

CASE s_estruc.
    when  'MC03BF0'.
      sort s_t_select by fieldnm.                  
      do.
        fetch next cursor g_cursor into id.
        if sy-subrc eq 0.
          import mc03bf0_tab from database mc03bf0setup(bw) id id. 
        ENDCASE.

The macro "copy" your code to the indicated position, replacing only &xx.

In your case, if s_estruc = 'MC03BF0' the program will do the fetch and the import. The selection from fetch is outside this code...

Best regards,

Leandro Mengue

1 REPLY 1

Former Member
0 Kudos

Hi,

This the result of your program with macro:

CASE s_estruc.
    when  'MC03BF0'.
      sort s_t_select by fieldnm.                  
      do.
        fetch next cursor g_cursor into id.
        if sy-subrc eq 0.
          import mc03bf0_tab from database mc03bf0setup(bw) id id. 
        ENDCASE.

The macro "copy" your code to the indicated position, replacing only &xx.

In your case, if s_estruc = 'MC03BF0' the program will do the fetch and the import. The selection from fetch is outside this code...

Best regards,

Leandro Mengue