‎2008 Aug 08 4:42 PM
Hi,
I have read all the threads in the forum related to this matter and I cannot understand why my code is not working as it should be.
It's like the part of the code that inserts a line (LINS) is not working, but when I debug the code I can see that the bdcdata table has all the rows ok.
Please, I need help! I'm working on SAP R/3 version 4.6C.
Here is my code. You just have to copy it and run it. If anyone can tell me what's the problem with my code that would be grate!
REPORT ZPRU_1 .
DATA: not TYPE CAUFV-AUFNR,
wa_trx TYPE bdcdata,
it_trx TYPE TABLE OF bdcdata.
wa_trx-PROGRAM = 'RIAFRU20'.
wa_trx-DYNPRO = '1000'.
wa_trx-DYNBEGIN = 'X'.
APPEND wa_trx TO it_trx.
CLEAR wa_trx.
wa_trx-FNAM = 'BDC_OKCODE'.
wa_trx-FVAL = '%011'.
APPEND wa_trx TO it_trx.
CLEAR wa_trx.
wa_trx-PROGRAM = 'SAPLALDB'.
wa_trx-DYNPRO = '3000'.
wa_trx-DYNBEGIN = 'X'.
APPEND wa_trx TO it_trx.
CLEAR wa_trx.
SELECT AUFNR FROM CAUFV INTO not UP TO 20 ROWS WHERE AUTYP = '30'.
wa_trx-FNAM = 'RSCSEL-SLOW_I(01)'.
wa_trx-FVAL = not.
APPEND wa_trx TO it_trx.
wa_trx-FNAM = 'BDC_OKCODE'.
wa_trx-FVAL = 'LINS'.
APPEND wa_trx TO it_trx.
ENDSELECT.
wa_trx-FNAM = 'BDC_OKCODE'.
wa_trx-FVAL = 'ACPT'.
APPEND wa_trx TO it_trx.
wa_trx-PROGRAM = 'RIAFRU20'.
wa_trx-DYNPRO = '1000'.
wa_trx-DYNBEGIN = 'X'.
APPEND wa_trx TO it_trx.
CLEAR wa_trx.
wa_trx-FNAM = 'BDC_OKCODE'.
wa_trx-FVAL = 'ONLI'.
APPEND wa_trx TO it_trx.
CALL TRANSACTION 'IW47' USING it_trx.
‎2008 Aug 08 4:57 PM
There is no need to write a BDC for your purpose. You can use the SUBMIT REPORT RIAFRU20.
Like:
RANGES: R_AUFNR FOR viauf_afvc-aufnr.
SELECT AUFNR FROM CAUFV INTO not UP TO 20 ROWS WHERE AUTYP = '30'.
R_AUFNR-SIGN = 'I'.
R_AUFNR-OPTIONS = 'EQ'.
R_AUFNR-LOW = NOT.
APPEND R_AUFNR.
ENDSELECT.
SUBMIT RIAFRU20 WITH aufnr_o IN R_AUFNR.
I recommond that you must change your SELECT.. ENDSELECT to .. SELECT.. INTO TABLE itab.
Regards,
Naimesh Patel
‎2008 Aug 08 4:57 PM
There is no need to write a BDC for your purpose. You can use the SUBMIT REPORT RIAFRU20.
Like:
RANGES: R_AUFNR FOR viauf_afvc-aufnr.
SELECT AUFNR FROM CAUFV INTO not UP TO 20 ROWS WHERE AUTYP = '30'.
R_AUFNR-SIGN = 'I'.
R_AUFNR-OPTIONS = 'EQ'.
R_AUFNR-LOW = NOT.
APPEND R_AUFNR.
ENDSELECT.
SUBMIT RIAFRU20 WITH aufnr_o IN R_AUFNR.
I recommond that you must change your SELECT.. ENDSELECT to .. SELECT.. INTO TABLE itab.
Regards,
Naimesh Patel
‎2008 Aug 08 5:23 PM
The thing is... that is not the only field that I fill in my program in the bdcdata table.
The fields that I fill changes everytime according to some of the user's selection and they are many. I isolate the problem in the program that I posted it to make clearer which was the problem.
Thanks anyway, but I just need to solve it with the bdcdata table.
‎2008 Aug 08 5:27 PM
With BDCDATA the work would be harder and complex.
You can create as many ranges as you want in your program. and use them in the SUBMIT report syntax.
Basically, BDC is not meant for the Reports. If you want to execute the report by calling the transaction than SUBMIT would be better.
Regards,
Naimesh Patel
‎2008 Aug 08 5:30 PM
Ok. I'm going to try with the SUBMIT statement and then let you know how ti goes.
Thanks very much for your help.
Regards,
‎2008 Aug 08 6:34 PM
Thank you Naimesh!
I changed the program just as you said and it work beautifully!!!
Best regards!