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 without a header line

Former Member
0 Likes
2,237

Hi, I need to mention that I'm not a developer. I try to learn ABAP

I get error message when try to activate my program.

DATA:
     gt_rbkp             TYPE HASHED TABLE OF rbkp WITH UNIQUE KEY belnr gjahr,
      gs_rbkp             TYPE rbkp, 
      gt_nast             TYPE STANDARD TABLE OF nast WITH KEY objky kschl,
      gs_nast             TYPE nast,
      gt_cmfp             TYPE STANDARD TABLE OF cmfp,
      gs_cmfp             TYPE cmfp.

PERFORM set_objky.

* Get message status for MM invoices
    SELECT *
       APPENDING TABLE gt_nast
       FROM nast
     WHERE objky IN gr_objky
       AND kschl = 'ZRIV'.

* Get sales order number for message number
  IF LINES( gt_nast ) IS NOT INITIAL.
    SELECT *
      FROM cmfp INTO TABLE gt_cmfp
      FOR ALL ENTRIES IN gt_nast
      WHERE aplid = 'WFMC'
        AND nr = gt_nast-cmfpnr
        AND msgnr = '311'.
  ENDIF.

* Get sales order headers for message variable (SO number from ZRIV output)
  IF LINES( gt_cmfp ) IS NOT INITIAL.
    SELECT *
      FROM vbak INTO TABLE gt_vbak
     WHERE vbeln = gt_cmfp-msgv2.
  ENDIF.

FORM SET_OBJKY .
  CLEAR gs_rbkp.
  CLEAR gr_objky.

  gr_objky-sign   = 'I'.
  gr_objky-option = 'EQ'.

* Object key for MM invoice
  LOOP AT gt_rbkp INTO gs_rbkp.
    CONCATENATE '$$$$' gs_rbkp-belnr gs_rbkp-gjahr '000000' INTO l_objky.
    gr_objky-low = l_objky.
    APPEND gr_objky.
  ENDLOOP.

"GT_CMFP" is a table without a header line and therefore has no component called "MSGV2".

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,005

Hi,

If the column MSGV2 contain sale order numbers then below change should work. Also Make sure your field msgv2 is compatible with VBELN.

* Get sales order headers for message variable (SO number from ZRIV output)
  IF LINES( gt_cmfp ) IS NOT INITIAL.
    SELECT *
      FROM vbak INTO TABLE gt_vbak
      FOR ALL ENTRIES IN gt_cmfp          "--> Change
     WHERE vbeln = gt_cmfp-msgv2.
  ENDIF.

Regards

3 REPLIES 3
Read only

brad_bohn
Active Contributor
0 Likes
1,005

You need to use the structure gs_cmfp that you declared but you also need to populate it with a value (using a LOOP or READ) in order for the statement to work...

Read only

Former Member
0 Likes
1,006

Hi,

If the column MSGV2 contain sale order numbers then below change should work. Also Make sure your field msgv2 is compatible with VBELN.

* Get sales order headers for message variable (SO number from ZRIV output)
  IF LINES( gt_cmfp ) IS NOT INITIAL.
    SELECT *
      FROM vbak INTO TABLE gt_vbak
      FOR ALL ENTRIES IN gt_cmfp          "--> Change
     WHERE vbeln = gt_cmfp-msgv2.
  ENDIF.

Regards

Read only

0 Likes
1,005

Thank you!

  • Get sales order headers for message variable (SO number from ZRIV output)

IF LINES( gt_cmfp ) IS NOT INITIAL.

SELECT *

FROM vbak INTO TABLE gt_vbak

FOR ALL ENTRIES IN gt_cmfp

WHERE vbeln = gt_cmfp-msgv2(10).

ENDIF.

But for some reason it nor select any data

I will try also other proposition, with LOOP/SELECT.