Application Development 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: 

Problem with BDC call of Transaction IW31

abhishek37373
Participant
0 Kudos

Hey Folks,

I am making a BDC call for Transaction IW31,but facing difficulty in table control,I am using index and after a certain lines i get an error  message that the field doesn't exist.

I have tried using "=P+" command but a flow control error is shown.

.

The screen i am trying to modify is attached.

1 ACCEPTED SOLUTION

abhishek37373
Participant
0 Kudos

Hi All,

Thanks all for all your suggestions.

The problem was solved using "Add New Entry" button on the below toolbar.

However i am still not sure why "P+" isn't working for this particular screen and if this needs to be reported to SAP for rectification.

10 REPLIES 10

Former Member
0 Kudos

Hi Abhishek,

Can you share the main code to analyze it better.

Since you BDC is for table control then sure BDC_CODE with '=P+' is a must, but you are getting error on it.

So focus on that particular line and once you will share the piece of code, it will be easy to trace.

Also you can do a recording on page-down in table control and pass the same in your code.

Let me know your findings.

Thanks,

Gupta

0 Kudos

Hi Gopal,

Thanks for the reply

Attached the piece of code (Table control code in Bold)

*  *Calling BDC
   REFRESH: t_bdcdata.
   CLEAR: fs_bdcdata.

*  1.  If the field WO_HEADER-SUP_ORD is initial. The FM will call transaction IW31
   IF wo_header-sup_ord IS INITIAL .

     PERFORM :
*Initial Screen IW31
   fill_bdc_data USING 'SAPLCOIH' '0100' 'X'  ' '  ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' 'CAUFVD-IWERK',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '/00',            " Enter.
   fill_bdc_data USING  ''  ''  ''   'AUFPAR-PM_AUFART' wo_header-ord_type,
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-IWERK' wo_header-plan_plnt,
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7100OBJECT'.

*  2.  If the field WO_HEADER-SUP_ORD is not initial. The FM will call transaction IW36
   ELSE.
     PERFORM:
*Initial Screen IW36
fill_bdc_data USING 'SAPLCOIH' '0108' 'X'  ' '  ' ',
fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' 'CAUFVD-IWERK',
fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '/00',            " Enter.
fill_bdc_data USING  ''  ''  ''   'AUFPAR-PM_AUFART' wo_header-ord_type,
fill_bdc_data USING  ''  ''  ''   'CAUFVD-MAUFNR' wo_header-sup_ord,
fill_bdc_data USING  ''  ''  ''   'CAUFVD-IWERK' wo_header-plan_plnt.

   ENDIF.

   PERFORM:
*Final Screen-1
   fill_bdc_data USING 'SAPLCOIH'  '3000' 'X' ' ' ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '=IOLU',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                3001SUB_ALL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1100SUB_LEVEL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1102SUB_KOPF',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1105SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1104SUB_TEXT',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1120SUB_AUFTRAG',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIPAR                                0415SUB_ADRESSE',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIPAR                                0415SUB_ADDR_PM',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                0154HEADER',
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-INGPR' wo_header-plan_grp,
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-VAPLZ' wo_header-work_ctr,
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-ILART' wo_header-pm_acttyp,
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                0153MAINORDER',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIPAR                                0421PARTNER',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7400SUB_PM_ADDR',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7402SUB_PM_ADDR_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7300TERM'.
   CONCATENATE wo_header-start_date+6(2) '.' wo_header-start_date+4(2) '.' wo_header-start_date+0(4) INTO lv_startdate.
   PERFORM:
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-GSTRP' lv_startdate,
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-GLTRP' lv_startdate.
   PERFORM:
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7301SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7310SUB_ADD',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                7100OBJECT',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' 'CAUFVD-EQUNR',
   fill_bdc_data USING  ''  ''  ''   'CAUFVD-EQUNR' wo_header-lvc_equnr,
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIQS0                                7010NOTIFICATION_DATA',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIQS0                                7020TSTRIP_SCREEN'.
   PERFORM:
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOI0                                0310AVO',
   fill_bdc_data USING  ''  ''  ''   'AFVGD-INDET' '0',
   fill_bdc_data USING  ''  ''  ''   'AFVGD-WERKS' wo_header-plan_plnt,
   fill_bdc_data USING  ''  ''  ''   'AFVGD-STEUS' 'ZMMR',
   fill_bdc_data USING  ''  ''  ''   'AFVGD-ARBEH' 'H',
   fill_bdc_data USING  ''  ''  ''   'AFVGD-DAUNE' 'H',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                0153SUB_SERVICE',

*3rd Screen
   fill_bdc_data USING 'SAPLCOIH'  '3000' 'X' ' ' ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '/00',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                3001SUB_ALL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1107SUB_LEVEL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1108SUB_KOPF',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1105SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIWOL                                0300SUB_AUFTRAG',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' ''.

*Table control is used to handle multiple input records.
   CLEAR:index.
   index = 01.
   LOOP AT zit_objectlist INTO lw_zit_objectlist.
     index = index + 01.
     CONCATENATE 'RIWOL-EQUNR('index')' INTO v_equnr.
     PERFORM fill_bdc_data USING ''  ''  ''   v_equnr lw_zit_objectlist-meter_equnr.
     IF index = 11.
       index = 1.
       PERFORM:
   fill_bdc_data USING 'SAPLCOIH'  '3000' 'X' ' ' ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '=P+',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                3001SUB_ALL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1107SUB_LEVEL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1108SUB_KOPF',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1105SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIWOL                                0300SUB_AUFTRAG',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' '',

   fill_bdc_data USING 'SAPLCOIH'  '3000' 'X' ' ' ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '=ENTR',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                3001SUB_ALL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1107SUB_LEVEL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1108SUB_KOPF',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1105SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIWOL                                0300SUB_AUFTRAG',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' ''.
     ENDIF.
   ENDLOOP.

*3rd Screen Save
   PERFORM:
   fill_bdc_data USING 'SAPLCOIH'  '3000' 'X' ' ' ' ',
   fill_bdc_data USING  ''  ''  ''   'BDC_OKCODE' '=BU',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                3001SUB_ALL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1107SUB_LEVEL',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1108SUB_KOPF',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLCOIH                                1105SUB_BTN',
   fill_bdc_data USING  ''  ''  ''   'BDC_SUBSCR' 'SAPLIWOL                                0300SUB_AUFTRAG',
   fill_bdc_data USING  ''  ''  ''   'BDC_CURSOR' ''.

   IF wo_header-sup_ord IS INITIAL .
* Call transaction 'IW31'
     CALL TRANSACTION 'IW31' USING t_bdcdata
       MODE 'N'UPDATE 'S'
       MESSAGES INTO t_msg.
   ELSE.
* Call transaction 'IW36'
     CALL TRANSACTION 'IW36' USING t_bdcdata
       MODE 'N'UPDATE 'S'
       MESSAGES INTO t_msg.

   ENDIF.

   LOOP AT t_msg INTO w_msg .
*     Format Message
     CALL FUNCTION 'MESSAGE_TEXT_BUILD'
       EXPORTING
         msgid               = w_msg-msgid
         msgnr               = w_msg-msgnr
         msgv1               = w_msg-msgv1
         msgv2               = w_msg-msgv2
         msgv3               = w_msg-msgv3
         msgv4               = w_msg-msgv4
       IMPORTING
         message_text_output = w_msg1.

     lw_return-msg_type = w_msg-msgtyp.
     lw_return-message = w_msg1.
     APPEND lw_return TO return.
   ENDLOOP.

ENDFUNCTION.
*********************(populate_bdcdata)***********************
FORM fill_bdc_data USING value(p_program)
                       value(p_dynpro)
                       value(p_dynbegin)
                       value(p_fnam)
                       value(p_fval).
   CLEAR fs_bdcdata .
   IF p_dynbegin = 'X' .
     fs_bdcdata-program = p_program .
     fs_bdcdata-dynpro  = p_dynpro .
     fs_bdcdata-dynbegin = p_dynbegin .
     APPEND fs_bdcdata TO t_bdcdata.
   ELSE.
     fs_bdcdata-fnam = p_fnam.
     fs_bdcdata-fval = p_fval.
     CONDENSE fs_bdcdata-fval.
     APPEND fs_bdcdata TO t_bdcdata.
   ENDIF.                               " IF p_dynbeg..

ENDFORM .                              " Fill_entry

0 Kudos

Hi Abhishek,

I am not been to trace the exact problem, but below are findings and some approaches.

i) Similar issues are also reported for other transaction and for few of them it got solved by implementing SAP Note.

So you can also search a note or raise a OSS message to SAP.

ii) The problem is because of an entry in T185, There is a standard transaction to maintain it but i guess it only meant for maintaining custom fields.

So try once by making a entry into transaction VFBS with program name as "SAPLCOIH" and select the 2nd radio button[T185].

Make a new entry on copying with any line-item with FCODE as P+ and after copying change the value of Group to A1.

refer to thread

[If it works then do some positive testing on the screen flows to make sure there is no negative impact after making the entry ]

Thanks,

Gupta

0 Kudos

Hi Former Member

Thanks for the analysis and advice..Will let you know,if it rectifies the problem.

0 Kudos

Hi,

I think your index number might be 3 digit field. Try to pass '015' instead of '15' and so on.

Thanks,

Ashok Veer

0 Kudos

Hi Ashok,

Shouldn't be as it is working correctly till Field(14).

raymond_giuseppi
Active Contributor
0 Kudos

Time to switch to BAPI_ALM_ORDER_MAINTAIN?

Regards,
Raymond

0 Kudos

Hi ,

Thanks for the reply,

As i am already using BDC here..it will be really helpful if we can solve the issue that why "P+" is not working for this certain screen and any other way to append the line item in the control table.

0 Kudos

First insure recording (SHDB) in simulate background mode and with Default Size. Also in execution use the OPTIONS FROM and set DEFSIZE filed.

If that don't solve problem and you want to continue with BDC, you have to either debug the dynpro execution or analyze its logic (and logic of main screen, as those table controls are in,subscreen so should not manage ok_code) to find a correct function code for pagination (=P+) In either case you cannot use an index of lines greater than the displayed lines.

Regards,

Raymond

abhishek37373
Participant
0 Kudos

Hi All,

Thanks all for all your suggestions.

The problem was solved using "Add New Entry" button on the below toolbar.

However i am still not sure why "P+" isn't working for this particular screen and if this needs to be reported to SAP for rectification.