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

call transaction ctu_params problem

former_member576008
Active Participant
0 Likes
3,751

Hi,

I am using a BDC - (call transaction method) to create equipment and to copy the documents in it using IE01.

In recording at the time of copying documents i called document screen using CTRL+F1, where i can enter 14 documents at a time.

But in IE03 display mode i can see only 11 documents. To over come this i used CTU_PARAMS as shown below.

LOOP AT TBL_FID_EQTREF.

        V_CHAMP = ''.

        V_FID = V_FID + 1.

       IF V_FID = 12.

          v_fid = 1.

          PERFORM BDC_FIELD     USING 'BDC_OKCODE' '=P+'.

        ENDIF.

       CONCATENATE  'DRAW-DOKAR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

     ENDLOOP.

     PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

      PERFORM BDC_FIELD     USING 'BDC_OKCODE' '=GOON'.

      PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0101'.

      PERFORM BDC_FIELD USING 'BDC_OKCODE'  '=BU'.

     DATA: p_opt TYPE ctu_params.

      MOVE: 'A' TO p_opt-updmode,          "Update mode

            'X' to p_opt-DEFSIZE,

            'A' TO p_opt-dismode.

      CALL TRANSACTION K_TRAN1 USING TBL_BDCDATA

      OPTIONS FROM p_opt MESSAGES INTO TBL_MESSTAB .

      COMMIT WORK AND WAIT.             

I have tested my code with 15 documents, while recording after entering 14, I have used page down and entered the remaining data.

I was unable to fix this.

Please help.

1 ACCEPTED SOLUTION
Read only

former_member576008
Active Participant
0 Likes
3,461

Hi,

Since the tab number is differing for various test cases, i debugged the standard and how it is calling the documents tab. I have downloaded a TABSTRIP_TAB and checked the functioin code.

For the documents tab the fcode is =SON, i have replaced the tab strip number T\09 with SON.

Now its working for all the scenario's. Using the CTRL+F1 pop up in IE01 is difficult and unable to handle in BDC.

Thanks to all helping hands.

      PERFORM bdc_field  USING 'BDC_OKCODE' '=SON'.

      LOOP AT TBL_FID_EQTREF.

        PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

        V_FID = 1.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKAR(' V_FID  ')' INTO V_CHAMP.

        perform bdc_field  using 'BDC_CURSOR' V_CHAMP.

        PERFORM BDC_FIELD  USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

        perform bdc_field       using 'BDC_OKCODE' '=CV140_INS'.

      ENDLOOP.

Regards,

Nandha

Hi,

I am using a BDC - (call transaction method) to create equipment and to copy the documents in it using IE01.

In recording at the time of copying documents i called document screen using CTRL+F1, where i can enter 14 documents at a time.

But in IE03 display mode i can see only 11 documents. To over come this i used CTU_PARAMS as shown below.

LOOP AT TBL_FID_EQTREF.

        V_CHAMP = ''.

        V_FID = V_FID + 1.

       IF V_FID = 12.

          v_fid = 1.

          PERFORM BDC_FIELD     USING 'BDC_OKCODE' '=P+'.

        ENDIF.

       CONCATENATE  'DRAW-DOKAR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL('  V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

     ENDLOOP.

     PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

      PERFORM BDC_FIELD     USING 'BDC_OKCODE' '=GOON'.

      PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0101'.

      PERFORM BDC_FIELD USING 'BDC_OKCODE'  '=BU'.

     DATA: p_opt TYPE ctu_params.

      MOVE: 'A' TO p_opt-updmode,          "Update mode

            'X' to p_opt-DEFSIZE,

            'A' TO p_opt-dismode.

      CALL TRANSACTION K_TRAN1 USING TBL_BDCDATA

      OPTIONS FROM p_opt MESSAGES INTO TBL_MESSTAB .

      COMMIT WORK AND WAIT.             

I have tested my code with 15 documents, while recording after entering 14, I have used page down and entered the remaining data.

I was unable to fix this.

Please help.

19 REPLIES 19
Read only

ShyamPindiproli
Active Participant
0 Likes
3,461

Hello Kishore,

This is a typical example of a BDC which has a table control data to be uploaded.

If you donot have any custom modifications to the "IE01- Create Equipment", then it is advised to make use of the BAPI - 'BAPI_EQUI_CREATE'. This will help you help you conserve effort rather than resolving the typical index related issues in the BDC.

But if you have considerable screen changes, then you will have to go with BDC. The solution is already available at SDN wiki

Read only

0 Likes
3,461

Hi Subaramanya,

I cant use the BAPI, since there are many custom modifications. Actually I have used below code before the above code. It worked perfectly until it moved to quality. In qulaity i got an error the OK code T\09 does not exists. when i checked for few cases the documents tab is 9th and for some cases 6th and 7th. I dont know why. Then i changed my code to the previous post which is not working.

      PERFORM bdc_field  USING 'BDC_OKCODE' '=T\09'.

      LOOP AT TBL_FID_EQTREF.

        PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

        V_FID = 1.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKAR(' V_FID  ')' INTO V_CHAMP.

        perform bdc_field  using 'BDC_CURSOR' V_CHAMP.

        PERFORM BDC_FIELD  USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

        perform bdc_field       using 'BDC_OKCODE' '=CV140_INS'.

      ENDLOOP.

If i was not able to fix the table data, is there any way to find the last tab (it would be always documents tab)number dynamically. so that i can change my code.

Thank you.


Read only

0 Likes
3,461

Hi Nandha,

With reference to the error you've posted "OK code T\09 does not exists", it shows that there is a version difference in the customisations transported to the Quality system in comparison to the changes done in the Dvelopment System.

Hence, to resolve this, kindly get all the customisations transported to the Quality System --> Production System. Then record your BDC and corresponding coding for the transaction. These errors will be minimised.

Also, as quoted by 'Subrahmanya', do try the BAPI with enhancements to the BAPI as this will be a better and complete solution.

Regards,

Pranav.

Read only

ShyamPindiproli
Active Participant
0 Likes
3,461

Also, if you record the Transaction using "default size" option you can be fairly safe to hardcode the index number on the table control (will be fine tuned after a couple of tries though).

This setting will ensure that the recording screen will be the same one that will exist during actual BDC. And hardcoding the index positions should solve your problem.

Read only

0 Likes
3,461

Hi Subramanya and Pranav,

Thanks for your replies.

I have done the recording once more and wrote the below code. This code working fine only in debugging...that is when i click F6 at CALL TRANSACTION the equipment is created and the documents are copied correctly(I tested with 15 documents in which 2 marked for deletion and 13 documents copied correctly). But when i run report in foreground with no break point, i'm getting nothing. Please help me where i'm wrong.

And also when i run it foreground...its working first time and second time its not...third time its working and fourth its not...

      PERFORM bdc_field  USING 'BDC_OKCODE' '=DO'.

      DATA: p_opt TYPE ctu_params.

      MOVE: 'A' TO p_opt-updmode,          "Update mode

            'X' to p_opt-DEFSIZE,

            space to p_opt-NOBINPT,

            'N' TO p_opt-dismode.

        V_CHAMP = ''.

      v_fid = 1.

      LOOP AT TBL_FID_EQTREF.

        PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

        CONCATENATE  'DRAW-DOKAR(' V_FID  ')' INTO V_CHAMP.

        perform bdc_field  using 'BDC_CURSOR' V_CHAMP.

PERFORM BDC_FIELD USING 'BDC_OKCODE'  '/00'.

        PERFORM BDC_FIELD  USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

        if v_fid eq 11.

        PERFORM BDC_FIELD USING 'BDC_OKCODE'  '/00'.

          PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

          PERFORM BDC_FIELD USING 'BDC_OKCODE'  '=P++'.

          clear:v_champ,v_fid.

          v_fid = 2.

          PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

          CONCATENATE  'DRAW-DOKAR(' V_FID  ')' INTO V_CHAMP.

          perform bdc_field  using 'BDC_CURSOR' V_CHAMP.

          PERFORM BDC_FIELD USING 'BDC_OKCODE'  '/00'.

        endif.

        v_fid = v_fid + 1.

      endloop.

      PERFORM BDC_DYNPRO      USING 'SAPLCVOB' '0200'.

      PERFORM BDC_FIELD USING 'BDC_OKCODE'  '=GOON'.

      PERFORM BDC_DYNPRO      USING 'SAPMIEQ0' '0101'.

      PERFORM BDC_FIELD USING 'BDC_OKCODE'  '=BU'.

      CALL TRANSACTION K_TRAN1 USING TBL_BDCDATA

      OPTIONS FROM p_opt MESSAGES INTO TBL_MESSTAB .

Thanks,

Nandha

Read only

0 Likes
3,461

Hello Nandha,

Use the following options :

P_OPT-DISMODE = 'N'.

P_OPT-UPMODE = 'L'.

P_OPT-RACOMMIT = 'X'.

Regards,

Shyam

Read only

0 Likes
3,461

Hi Nandha,

It is a known fact that BDC behave different in background mode when compared to foreground. To locate the error about what's happening you can try the following options:

1. While recording the BDC, select the check-box for 'Simulate Background Mode'.

2. You can create a 'Z' Table in Dev system for Test Purpose and write the BDCMSGCOL internal table to this table to ensure about the events occurred in Background Mode.

Since, your BDC is working with De-bugger, the code is OK. The problem is with COMMIT for the Transaction in Background mode. Try a Hard Commit using the keyword COMMIT WORK at the end of your code.

Regards,

Pranav.

Read only

0 Likes
3,461

Hi Kishore,

BDC will always have this problem.

Why dont you use BAPI_EQUI_CREATE?

Regards

Vikash Singh

Read only

0 Likes
3,461

Hi Shyam,

I changed my code, but still its working one time and not for the second time, working 3rd time not for 4th time...I'm running in foreground only. Every time after executing my report...i'm taking new screen to run the report again.

Regards,

Nandha

Read only

0 Likes
3,461

There are only three updates modes available for BDC's.

updmode Meaning
A Asynchronous. Update function modules are executed in UPD workprocess. A is the default mode.
S Synchronous. Update function modules are executed in UPD workprocess BUT all COMMIT WORK are processed as if they were COMMIT WORK AND WAIT.
L Local update task. Update function modules are executed as if SET UPDATE TASK LOCAL has been executed at the start of each LUW, i.e. they are executed in the same workprocess as the main program.

Instead of a hard commit .. why not make use of mode "S" ?

Regards,

Shyam

Read only

0 Likes
3,461

Hi Pranav,

I have COMMIT WORK AND WAIT.  after CALL TRANSACTION, In any mode if I run my program..my problem starts. Its working first time and not for the second time, working 3rd time not for 4th time.

My requirement is

I'm creating an equipment with reference to another equipment, in the IE01 recording i'll uncheck the install location and Document assignments(Because i dont want to copy documents with deletion indicator, so i'm manually moving that using BDC).

In the second tab i'll update plant and ABC indicator. Then i'll update the classification overview and at last the headache documents without deletion indicator.

Now please tell me is there any BAPI to complete this requirement.

regards,

Nandha

Read only

0 Likes
3,461

Hi Shyam,

Used the same, but no change in the result.

Thanks for your suggestions.

Regards,

Nandha

Read only

0 Likes
3,461

Hi,

Why cant you use BAPI_EQUI_CREATE_BY_REFERENCE ?.

Regards

Vikash Singh

Read only

0 Likes
3,461

Hi Nandha,

As rightly suggested by Vikas, you can use  BAPI_EQUI_CREATE_BY_REFERENCE which has parameters for COPY FLAGS. There you can specify the documents or other options that you do not want to copy.

Finally, you've said that the BDC works for the odd instances and does not work for the even instances. So, my doubt is what errors are thrown by the system on 2nd, 4th, 6th instances? Did you try de-bugging the 2nd run?

Regards,

Pranav.

Read only

0 Likes
3,461

Hi Pranav,

For even instances the equipment got created but the documents didn't copied, documents tab is blank not even a single document.

Thank you.

Nandha

Read only

0 Likes
3,461

Hi,

I'll try that BAPI and get back to you all.

Regards,

Nandha

Read only

0 Likes
3,461

Chk out this skeleton for the BAPI call

**
**  Equipment Create by reference using BAPI
**
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input  = r_equnr
  IMPORTING
    output = r_equnr.

**
** Indicators for Sub-Objects to be Copied from Reference
**
r_flags-cp_measpt  'X'.                                      "Checkbox: Copy measuring points and counters
r_flags-cp_mpt_txt 'X'.                                      "Checkbox: Copy measuring points with long text



CALL FUNCTION 'BAPI_EQUI_CREATE_BY_REFERENCE'
  EXPORTING
    reference_number  = r_equnr
    copy_flags        = r_flags
  IMPORTING
    equipment         = r_equi-equnr
    data_general_exp  = r_gen
    data_specific_exp = r_spe
    return            = r_return
  EXCEPTIONS
    OTHERS            = 1.


IF r_return(1) = 'E'.
        "  Error processing logic
ELSE.

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

ENDIF.

Read only

Former Member
0 Likes
3,461

If you absolutely cannot use the BAPI, you can try something that I've had success with.  For each row in a table control, I do p+ (down one push), enter the value in subscript (3) (or lower if needed). Hit enter.  Repeat for next row.  That way you're always inserting data into the blank row, enter moves it to the right row, p+ repositions that row to the top of the table control and you can then put more data into the same now-blank lower row...over and over again.

Read only

former_member576008
Active Participant
0 Likes
3,462

Hi,

Since the tab number is differing for various test cases, i debugged the standard and how it is calling the documents tab. I have downloaded a TABSTRIP_TAB and checked the functioin code.

For the documents tab the fcode is =SON, i have replaced the tab strip number T\09 with SON.

Now its working for all the scenario's. Using the CTRL+F1 pop up in IE01 is difficult and unable to handle in BDC.

Thanks to all helping hands.

      PERFORM bdc_field  USING 'BDC_OKCODE' '=SON'.

      LOOP AT TBL_FID_EQTREF.

        PERFORM BDC_DYNPRO USING 'SAPMIEQ0' '0101'.

        V_FID = 1.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKAR(' V_FID  ')' INTO V_CHAMP.

        perform bdc_field  using 'BDC_CURSOR' V_CHAMP.

        PERFORM BDC_FIELD  USING V_CHAMP    TBL_FID_EQTREF-DOKAR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKNR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKNR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKVR(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKVR.

        V_CHAMP = ''.

        CONCATENATE  'DRAW-DOKTL(' V_FID  ')' INTO V_CHAMP.

        PERFORM BDC_FIELD       USING V_CHAMP    TBL_FID_EQTREF-DOKTL.

        perform bdc_field       using 'BDC_OKCODE' '=CV140_INS'.

      ENDLOOP.

Regards,

Nandha