‎2011 Mar 09 11:23 AM
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
‎2011 Mar 09 11:35 AM
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.
‎2011 Mar 09 11:35 AM
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.
‎2011 Mar 09 11:46 AM
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
‎2011 Mar 09 11:57 AM
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.
‎2011 Mar 09 12:29 PM
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
‎2011 Mar 09 12:49 PM
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
‎2011 Mar 09 2:03 PM
Thanks for your help guys, looks like this one is solved!
Andy