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

statement not executing after used qa11 tcode bdc through call trasaction

Former Member
0 Likes
1,455

Dear all,

i am created bdc for creating fianl Grn Through Qa11 Tcode After click on Save Button.

code is like below

when 'SAVE'
perfor final_grn.
endcase.

form final_grn.
perform getdata.
perform bdcrecording."in this perform i used call Transaction
endform.


After executing endcase statement  i used below code for get final Grn no

   SELECT SINGLE MBLNR FROM QAMB INTO V_MBLNR WHERE PRUEFLOS EQ V_PR
                                 AND TYP NE 1.
After i am updating final Grn to ZTABLE and taking print out but it is not updating in ztable and printout .

i used commit work and wait also it is not working.

so please sugeest .

Regards,

siva rama.

Hi

I can't check your code, so I suppose it's ok, so I can give you just only 2 observations:

- All processes to store the data are managed inside the TRANSACTION, so here it's not usefull to call a COMMIT just after the CALL TRANSACTION:

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  
EXPORTING
    
WAIT          = 'X'.

You can delete it.

-  if you need to get the result after running a transaction, you should run it in SYNCHRONOUS way, that means the field UPDATE of the option structure has to be equal to S.

In this way the process will back to your program only after executing all saving processes.

If you don't fill it, the transaction will be processed in Asynchronous way by default

IT_OPT-UPDATE = 'S'

CALL TRANSACTION 'QA11' USING BDCDATA
                          OPTIONS
FROM IT_OPT
                         MESSAGES
INTO IT_MESSTAB.

Max


7 REPLIES 7
Read only

Former Member
0 Likes
1,286

Hi Siva,

Could you please explain in detail?If you want to Save the records means while doing recording we get ok_code for it.

Read only

0 Likes
1,286

that is not a problem i done all things

problem is after used

call transaction menthod

   CALL TRANSACTION 'QA11' USING BDCDATA
                          OPTIONS FROM IT_OPT
                         MESSAGES INTO IT_MESSTAB.

IT_MESSTAB dosen't have final GRN no

so before updating the ztable i using i am getting through below code .

SELECT SINGLE MBLNR FROM QAMB INTO V_MBLNR WHERE PRUEFLOS EQ V_PR

                                 AND TYP NE 1.

when i am cheking through debugging it is working fine and i am checking through background it is not working.

and i am aslo used wait statment after call transaction it is not working

Regards,

Siva

Read only

0 Likes
1,286

Can you post the code which you have written?

Read only

0 Likes
1,286

CASE OK_CODE1.

WHEN 'SAVE'.
     
CLEAR OK_CODE1.
     
PERFORM SAV.

ENDCASE.

FORM SAVE .

IF V_WEIGHT IS NOT INITIAL AND TA_WEIGHT IS NOT INITIAL.
PERFORM CREATE_FINALGRN.

Endif.

ENDFORM.

WAIT UP TO 5 SECONDS.
 
"for final GRN No on base of inspection lot no
 
SELECT SINGLE MBLNR FROM QAMB INTO V_MBLNR WHERE PRUEFLOS EQ V_PR
                                
AND TYP NE 1.
 
IF V_MBLNR IS NOT INITIAL.

   WA_FINAL-ZMBLNR = V_MBLNR.
 
ENDIF.

MODIFY ZRMC_GRNDATA FROM WA_FINAL.

form_FINALGRN.

IT_OPT-NOBINPT = 'X'.
 
TRANSLATE MODE TO UPPER CASE.
 
MODE = 'A'.
 
IF MODE = 'N' OR MODE = 'E' OR MODE = 'N'.
    IT_OPT-DISMODE =
MODE.
 
ELSE.
    IT_OPT-DISMODE =
'N'.
 
ENDIF.
 
LOOP AT IT_FINAL.
   
SELECT SINGLE
           LMENGE01
     
INTO LMENGE01
     
FROM QALS
    
WHERE PRUEFLOS = IT_FINAL-PRUEFLOS.
   
IF LMENGE01 IS NOT INITIAL.
     
DELETE IT_FINAL.
   
ENDIF.
 
ENDLOOP.

 
LOOP AT IT_FINAL.
   
REFRESH BDCDATA.
   
REFRESH IT_MESSTAB.

   
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
     
EXPORTING
        PERCENTAGE =
10
       
TEXT       = IT_FINAL-PRUEFLOS.

   
CLEAR: BDCDATA, IT_MESSTAB.

   
CLEAR: IT_DATA1.

   
READ TABLE IT_DATA1 WITH KEY  PRUEFLOS = IT_FINAL-PRUEFLOS.
   
SELECT SINGLE
           XBLNR
     
INTO IT_FINAL-BKTXT
     
FROM MKPF
    
WHERE MBLNR = IT_DATA1-GRNNO.

   
SELECT SINGLE ORIGINAL_INPUT FROM QAMR INTO V_ORIGINAL_INPUT WHERE PRUEFLOS EQ IT_FINAL-PRUEFLOS.
   
IF SY-SUBRC NE 0.
     
MESSAGE 'Inspection lot not completed,Truck can not move out of factory gate' TYPE 'E'.
   
ENDIF.
   
CLEAR V_PR.
    V_PR = IT_FINAL-PRUEFLOS.
   
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0100'.
   
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                 
'QALS-PRUEFLOS'.
   
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                 
'/00'.
   
PERFORM BDC_FIELD       USING 'QALS-PRUEFLOS'
                                  IT_FINAL-PRUEFLOS.

   
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0200'.
   
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                 
'=BB'.
   
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                 
'RQEVA-VCODEGRP'.
   
PERFORM BDC_FIELD       USING 'RQEVA-VCODE'
                                  IT_FINAL-VCODE.
   
PERFORM BDC_FIELD       USING 'RQEVA-VCODEGRP'
                                 
'01'.

   
PERFORM BDC_DYNPRO      USING 'SAPLSPO1' '0100'.
   
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                 
'=YES'.

   
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0200'.
   
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                 
'/00'.
   
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                 
'RQEVA-VMENGE07'.
   
IF IT_FINAL-VCODE = 'R'.
     
SELECT SINGLE * FROM MARA WHERE MATNR EQ ZRMC_GRNDATA-MATNR.
     
IF  MARA-MEINS = 'KG'.
        IT_FINAL-VMENGE07 =  IT_FINAL-VMENGE07 *
1000.
     
ELSE.*        IT_FINAL-VMENGE07 =  IT_FINAL-VMENGE01 + IT_FINAL-VMENGE07.
     
ENDIF.
     
CLEAR IT_FINAL-VMENGE01.
   
ENDIF.
   
PERFORM BDC_FIELD       USING 'RQEVA-VMENGE01'
                                  IT_FINAL-VMENGE01.
   
PERFORM BDC_FIELD       USING 'RQEVA-QLGO_VM01'
                                  IT_FINAL-QLGO_VM01.
   
PERFORM BDC_FIELD       USING 'RQEVA-VMENGE07'
                                  IT_FINAL-VMENGE07.

   
IF IT_FINAL-VMENGE07 GE '0.001'.
     
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0122'.
     
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                   
'RQEVA-GRUND'.
     
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   
'=ENTE'.
     
PERFORM BDC_FIELD       USING 'RQEVA-GRUND'
                                   
'0009'.

     
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0200'.
     
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   
'=MKPF'.
     
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0125'.
     
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                   
'RQEVA-BKTXT'.
     
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   
'=ENTE'.
     
PERFORM BDC_FIELD       USING 'RQEVA-BLDAT'
                                    IT_FINAL-CRDATE.
     
PERFORM BDC_FIELD       USING 'RQEVA-BUDAT'
                                    IT_FINAL-CRDATE.
     
PERFORM BDC_FIELD       USING 'RQEVA-BKTXT'
                                    IT_FINAL-BKTXT.
   
ELSE.
     
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0200'.
     
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   
'=MKPF'.
     
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0125'.
     
PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                   
'RQEVA-BKTXT'.
     
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                   
'=ENTE'.
     
PERFORM BDC_FIELD       USING 'RQEVA-BLDAT'
                                    IT_FINAL-CRDATE.
     
PERFORM BDC_FIELD       USING 'RQEVA-BUDAT'
                                   IT_FINAL-CRDATE.

     
PERFORM BDC_FIELD       USING 'RQEVA-BKTXT'
                                    IT_FINAL-BKTXT.
   
ENDIF.

   
PERFORM BDC_DYNPRO      USING 'SAPMQEVA' '0200'.
   
PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                 
'=BU'.
   
CALL TRANSACTION 'QA11' USING BDCDATA
                          OPTIONS
FROM IT_OPT
                         MESSAGES
INTO IT_MESSTAB.

 
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  
EXPORTING
    
WAIT          = 'X'.
   
READ TABLE IT_MESSTAB WITH KEY MSGTYP = 'E'.

   
IF SY-SUBRC = 0.*    IF it_messtab-msgtyp = 'E' OR  it_messtab-msgtyp = 'A' .
     
CLEAR SY_CHK.
     
CALL FUNCTION 'FORMAT_MESSAGE'
       
EXPORTING
         
ID   = IT_MESSTAB-MSGID
          LANG = SY-LANGU
         
NO   = IT_MESSTAB-MSGNR
          V1   = IT_MESSTAB-MSGV1
          V2   = IT_MESSTAB-MSGV2
          V3   = IT_MESSTAB-MSGV3
          V4   = IT_MESSTAB-MSGV4
       
IMPORTING
          MSG  = IT_ERR-ERROR.
     
IF IT_ERR-ERROR IS NOT INITIAL.
       
MESSAGE IT_ERR-ERROR TYPE 'E'.
     
ENDIF.
      SY_CHK =
'X'.
   
ELSE.
   
ENDIF.
   
CLEAR: IT_FINAL.
   
CLEAR: IT_ERR.
   
CLEAR: WA_ERROR.

   ENDFORM.

Read only

0 Likes
1,286

Hi

I can't check your code, so I suppose it's ok, so I can give you just only 2 observations:

- All processes to store the data are managed inside the TRANSACTION, so here it's not usefull to call a COMMIT just after the CALL TRANSACTION:

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  
EXPORTING
    
WAIT          = 'X'.

You can delete it.

-  if you need to get the result after running a transaction, you should run it in SYNCHRONOUS way, that means the field UPDATE of the option structure has to be equal to S.

In this way the process will back to your program only after executing all saving processes.

If you don't fill it, the transaction will be processed in Asynchronous way by default

IT_OPT-UPDATE = 'S'

CALL TRANSACTION 'QA11' USING BDCDATA
                          OPTIONS
FROM IT_OPT
                         MESSAGES
INTO IT_MESSTAB.

Max


Read only

0 Likes
1,286

Hi,

Max thanks,

Problem solved .

regards,

rama.

Read only

0 Likes
1,286

Hi Krishna,

I have a similar problem using a Exit  QEVA0007 / EXIT_SAPMQEVA_007

If run in debugg mode QA11 the data is saved, in other way do not is saved.

Could you tell how you have resolved it this issue in your case?

thank!