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

Populate Table using GUID

Former Member
0 Likes
1,739

A (hopefully) quick and simple question that i've been unable to find the answer to. I've retrieved the GUID of an invoice from a Credit note in CRM, but i've been unable to use the BDI_GUID to populate a table of BDI related to said invoice.

I've tried the following:

SELECT * INTO lt_invoice_bdi

FROM /1BEA/CRMB_BDI

WHERE BDI_GUID = lv_invoice_bdi.

LOOP AT /1BEA/CRMB_BDI

INTO lt_invoice_bdi

WHERE BDI_GUID = lv_invoice_bdi.

I have created the lt_invoice_bdi as the data type /1BEA/S_CRMB_BDI_WRK. Can anyone advise where i'm going wrong?

Thanks,

Andy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,627

Hi,

Check how lv_invoice_bdi is declared , this should refer to a field rather than a structure.

lt_invoice_bdi should refer to the table/structure /1BEA/S_CRMB_BDI

SELECT * INTO table lt_invoice_bdi

FROM /1BEA/CRMB_BDI

WHERE BDI_GUID = lv_invoice_bdi -BDI_GUID.

Regards,

Srini.

6 REPLIES 6
Read only

Former Member
0 Likes
1,628

Hi,

Check how lv_invoice_bdi is declared , this should refer to a field rather than a structure.

lt_invoice_bdi should refer to the table/structure /1BEA/S_CRMB_BDI

SELECT * INTO table lt_invoice_bdi

FROM /1BEA/CRMB_BDI

WHERE BDI_GUID = lv_invoice_bdi -BDI_GUID.

Regards,

Srini.

Read only

0 Likes
1,627

Thanks, i've tried what you suggested, but got the error 'Statement in context not permitted' when trying to activate the form (i'm running this as a form routine within the creditnote smartform), which is the same error i had previously trying to use SELECT * INTO statement.

The lv_invoice_guid is defined as type CRMT_OBJECT_GUID

EDIT

Found i'd not put a . after my end form. This is the form routine as it stands in full:

*----


  • FORM GET_INVOICE_BDI

*----


  • Get the BDI table for the preceeding invoice

*----


FORM get_invoice_bdi USING lv_invoice_bdi

CHANGING lt_invoice_bdi TYPE /1BEA/S_CRMB_BDI

.

SELECT * INTO table lt_invoice_bdi

FROM /1BEA/CRMB_BDI

WHERE BDI_GUID = lv_invoice_bdi.

ENDFORM.

Upon activation i get the error " 'LT_INVOICE_BDI' is not an internal table. 'Occurs n' specification is missing"

Edited by: Andrew Gough on Mar 9, 2011 11:47 AM

Read only

0 Likes
1,627

Hi,

Use Tables statement instead of changing.

FORM get_invoice_bdi USING lv_invoice_bdi

tables lt_invoice_bdi structure /1BEA/S_CRMB_BDI

endform.

Regards,

Srini.

Read only

0 Likes
1,627

Sorry Srini,

I've not used this TABLES before, so when i've configured, it's still giving syntax errors, i assume because i've not defined correctly.

FORM get_invoice_bdi USING lv_invoice_bdi.

TABLES lt_invoice_bdi.

SELECT * INTO table lt_invoice_bdi

FROM /1BEA/CRMB_BDI

WHERE BDI_GUID = lv_invoice_bdi.

ENDFORM.

Get the error LT_INVOICE_BDI is either not active or does not exist. Where and how do i define the table, and is this just down to how i specify the perform within the initialisation - currently i'm not calling this until it compiles correctly in form routines tab.

Thanks,

Andy

Read only

0 Likes
1,627

Hi Andy

Tables should be the first parameter to be passed to sub-routine and then you can pass USING parameters. So change your code to as below, it should work fine,


FORM get_invoice_bdi TABLES lt_invoice_bdi
USING lv_invoice_bdi.

SELECT * INTO table lt_invoice_bdi
FROM /1BEA/CRMB_BDI
WHERE BDI_GUID = lv_invoice_bdi.

ENDFORM.

Regards

Ranganath

Read only

0 Likes
1,627

Thanks for your help guys, looks like this one is solved!

Andy