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

Problem with table control adding new line

Former Member
0 Likes
2,093

Dear friends,

i am working with the VA01 upload program.

when i am uploading the multiple line items i am getting the error.

i resoved the error and successfully upload the data for 3 line items.

when i am upload the data for 10line items it was showing the error as the screen field doesn't exists.

here i am attaching the logic

DATA: V_MABNR(20) TYPE C,
      V_KWMENG(20) TYPE C,
      V_KBETR(20) TYPE C,
      VAL(03) TYPE N VALUE 01.

include bdcrecx1.

start-of-selection.

perform open_group.

LOOP AT IT_FINAL INTO WA_FINAL.

perform bdc_dynpro      using 'SAPMV45A' '0101'.
perform bdc_field       using 'BDC_CURSOR'                              'VBAK-AUART'.
perform bdc_field       using 'BDC_OKCODE'                              '/00'.
perform bdc_field       using 'VBAK-AUART'                              WA_FINAL-AUART."'OR'.
perform bdc_field       using 'VBAK-VKORG'                              WA_FINAL-VKORG."'1000'.
perform bdc_field       using 'VBAK-VTWEG'                              WA_FINAL-VTWEG."'12'.
perform bdc_field       using 'VBAK-SPART'                              WA_FINAL-SPART."'00'.


perform bdc_dynpro      using 'SAPMV45A' '4001'.
perform bdc_field       using 'BDC_OKCODE'                              '/00'.
perform bdc_field       using 'BDC_CURSOR'                              'VBKD-BSTDK'.
perform bdc_field       using 'VBKD-BSTKD'                              WA_FINAL-BSTKD."'PO TEST'.
perform bdc_field       using 'VBKD-BSTDK'                              WA_FINAL-BSTDK."'03.02.2012'.
perform bdc_field       using 'KUAGV-KUNNR'                             WA_FINAL-KUNAG." '1033'.
perform bdc_field       using 'KUWEV-KUNNR'                             WA_FINAL-KUNWE." '1033'.

LOOP AT IT_FINAL1 INTO WA_FINAL1.


CONCATENATE 'RV45A-MABNR(' '0' VAL ')' INTO V_MABNR.

CONCATENATE 'RV45A-KWMENG(' '0' VAL ')' INTO V_KWMENG.

CONCATENATE 'KOMV-KBETR(' '0' VAL ')' INTO V_KBETR.

perform bdc_field using 'BDC_CURSOR'                                    V_KBETR."v_kwmeng.
perform bdc_field using v_mabnr                                         WA_FINAL1-MATNR."wa_item-matnr.
perform bdc_field using v_kwmeng                                        WA_FINAL1-KWMENG."wa_item-kwmeng.
perform bdc_field using v_kbetr                                         WA_FINAL1-KBETR."wa_item-kwmeng.

perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'                                    '/00'.

VAL = VAL + 1.

endloop.

*VAL = 01.

perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'                                    '=SICH'.

ENDLOOP.
perform bdc_transaction using 'VA01'.

perform close_group.

i searched in SDN i found a lot of links but i can't find the proper document.

can any one explain me clearly about adding the N line items and screen resolution logic.

Thanks,

karunakar

13 REPLIES 13
Read only

Former Member
0 Likes
1,897

Hi,

For screen resolution logic, you can pass the value 'X' into the variable CTU_PARAMS-DEFSIZE in the OPTIONS parameter of CALL TRANSACTION using BDC DATA.

CALL TRANSACTION TCODE USING BDCDATA

MODE CTUMODE

UPDATE CUPDATE

OPTIONS FROM OPT

MESSAGES INTO MESSTAB.

DEFSIZE - Selects whether the screens of the called transaction are displayed in the standard screen size. Values: "X" (standard size), " " (current size).

Read only

0 Likes
1,897

Thanks harish for your quick reply,

but i want to know the logic for adding multiple line items.

it was showing error as "Field RV45A-MABNR (5) does not exist in the screen SAPMV45A 4001"

the error is raises for each and every line item more than 3.

Regards,

Karunakar

Read only

0 Likes
1,897

Hi harish,

thanks for your reply.

where i have to write the logic for Default size.

what i have to declare previouslly means meaage tables.

Regards,

karunakar

Read only

0 Likes
1,897

Hi,

As mentioned below declare the message table and assign the default size before using 'Call transaction'.


data : gt_messtab TYPE STANDARD TABLE OF bdcmsgcoll,
          ls_ctu_params TYPE ctu_params.

    ls_ctu_params-defsize = gc_x.

    CALL TRANSACTION tcode USING gt_bdcdata
                 OPTIONS FROM ls_ctu_params
                 MESSAGES INTO gt_messtab.

This will solve the issue.

Regards,

Konda Sravanthi.

Read only

0 Likes
1,897

hi sravanthi,

In which area/place i have to write these logic.

previously I had tried for

it was not triggered before passing the line items.

if starting of the transaction then BDC doesn't works

can you explain clearly.

thanks for your quick response.

Regards,

karunakar

Read only

0 Likes
1,897

Hi,

Place the code in the sub-routine bdc_transaction using 'VA01'.

Regards,

Konda Sravanthi.

Read only

0 Likes
1,897

Hi sravanthi,

I WRITE THE FOLLOWING CODE IN SUBROUTINE BDC_TRANSACTION BUT IT IS NOT ACCESSED.

ENDLOOP.

perform bdc_transaction USING 'VA01'
BDCDATA OPTIONS FROM LS_OPTIONS
MESSAGES INTO IT_BDCMSGCOLL. .

perform close_group.

Can you send me sample code of any transaction.

thanks,

karunakar

Read only

0 Likes
1,897

Hi,

Place the code i have mentioned in my earlier posts in the sub-routine.

You are calling the sub routine bdc_transaction using 'VA01' by using statement perform.

Write the code between form and endform as mentioned below,


*form* bdc_transaction using tcode

 "write the code as mentioned in the previous posts

*endform*.

Read only

umashankar_sahu
Active Participant
0 Likes
1,897

Hi bkarunakar

why not using the BAPI ?

there are bapi's available to change or craete SO.

Read only

Former Member
0 Likes
1,897

Hi,

Using DEFSIZE you can find the maximum line item.

once it is reached that maximum line item again it should start from 01,02...

Best Regards,

M.Vimala

Read only

krishna_k19
Contributor
0 Likes
1,897

Dear Karunakar ,

1. Once check the uploading file (XL File) Format and

2. Check Sales Division

3. Stock Quantity.

these scenarios also you check and try again.

regards,

krishna.

Read only

0 Likes
1,897

Hi Krishna,

i am getting the XL data properly and i check stock quantity .

i want to make default Table control screen to 3 lines only.

the logic is not working i want to know where should be the logic placed.

Please guide me where i have to place the logic.

Thanks for your reply.

Regards,

karunakar

Read only

Former Member
0 Likes
1,897

"This is Sample program which will facilitate to create multiple line item in VA01 while BDC "recording.This sample create order from screen - let say many record based on approval received "on screen and then some one authorized person execute program then all record will be placed in "VA01 header and Item table after that that person can make some required changes and saved the "transaction. 

"------------------------------------------------------------------------------------------------------------------------------------------------"---

FORM salesorder_bdc .

   DATA:podate(8),

        curdate(8),

        ordqty(20).

   REFRESH bdcdata.

   PERFORM bdc_dynpro      USING 'SAPMV45A' '0101'.

   PERFORM bdc_field       USING 'BDC_CURSOR'

                                 'VBAK-SPART'.

   PERFORM bdc_field       USING 'BDC_OKCODE'

                                 '/00'.

   PERFORM bdc_field       USING 'VBAK-AUART'

                                 zsalesapproval-auart. "'ZOR'.

   PERFORM bdc_field       USING 'VBAK-VKORG'

                                 zsalesapproval-vkorg. "'1000'.

   PERFORM bdc_field       USING 'VBAK-VTWEG'

                                 zsalesapproval-vtweg. "'30'.

   PERFORM bdc_field       USING 'VBAK-SPART'

                                 zsalesapproval-spart. "'CB'.

   PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.

   PERFORM bdc_field       USING 'BDC_OKCODE'

                                 '/00'.

   PERFORM bdc_field       USING 'BDC_CURSOR'

                                 'VBKD-BSTDK'.

   PERFORM bdc_field       USING 'VBKD-BSTKD'

                                 zsalesapproval-bstkd.       "'987654'.

   CONCATENATE zsalesapproval-bstdk+6(2) zsalesapproval-bstdk+4(2) zsalesapproval-bstdk+0(4) INTO podate.

   PERFORM bdc_field       USING 'VBKD-BSTDK'

                                 podate. "'05062016'.

   PERFORM bdc_field       USING 'KUAGV-KUNNR'

                                 zsalesapproval-kunnr. "'0000000019'.

   PERFORM bdc_field       USING 'KUWEV-KUNNR'

                                 zsalesapproval-kunwe. "'0000000018'.

   PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.

   PERFORM bdc_field       USING 'BDC_CURSOR'

                                 '04/06'.

   PERFORM bdc_field       USING 'BDC_OKCODE'

                                 '=CHOO'.

   PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.

   CONCATENATE sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) INTO curdate.

   PERFORM bdc_field       USING 'RV45A-KETDAT'

                                 curdate. "'13.07.2016'.

   PERFORM bdc_field       USING 'RV45A-KPRGBZ'

                                 'D'.

   PERFORM bdc_field       USING 'VBKD-PRSDT'

                                 curdate. "'13.07.2016'.

   PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.

   PERFORM bdc_field       USING 'BDC_OKCODE'

                                 '/00'.

   PERFORM bdc_field       USING 'VBKD-BSTKD'

                                 zsalesapproval-bstkd.       "'987654'.

   PERFORM bdc_field       USING 'VBKD-BSTDK'

                                  podate. "'05.06.2016'.

   PERFORM bdc_field       USING 'KUAGV-KUNNR'

                                 zsalesapproval-kunnr. "'19'.

   PERFORM bdc_field       USING 'KUWEV-KUNNR'

                                 zsalesapproval-kunwe. "'18'.

   PERFORM bdc_field       USING 'RV45A-KETDAT'

                                 curdate. "'13.07.2016'.

   PERFORM bdc_field       USING 'RV45A-KPRGBZ'

                                 'D'.

   PERFORM bdc_field       USING 'VBKD-PRSDT'

                                 curdate. "'13.07.2016'.

   PERFORM bdc_field       USING 'VBKD-ZTERM'

                                 'Z015'.

   PERFORM bdc_field       USING 'VBKD-INCO1'

                                 'CFR'.

   PERFORM bdc_field       USING 'VBKD-INCO2'

                                 'Costs and Freight'.

   PERFORM bdc_field       USING 'BDC_CURSOR'

                                 'VBAP-WERKS(01)'.

   LOOP AT it_orderitems ASSIGNING <fs_orderitems>.

     CLEAR:ordqty.

     ordqty = <fs_orderitems>-menge.

     IF sy-tabix = 1.

       PERFORM bdc_field       USING 'RV45A-MABNR(01)'

                                     <fs_orderitems>-matnr. "'n330 pb'.

       PERFORM bdc_field       USING 'RV45A-KWMENG(01)'

                                     ordqty."'                  5'.

       PERFORM bdc_field       USING 'VBAP-VRKME(01)'

                                     <fs_orderitems>-meins. "'to'.

       PERFORM bdc_field       USING 'VBAP-WERKS(01)'

                                     <fs_orderitems>-werks. "'p002'.

     ELSE.

       PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.

       PERFORM bdc_field       USING 'BDC_OKCODE'

                                     '/00'.

       PERFORM bdc_field       USING 'VBKD-BSTKD'

                                     zsalesapproval-bstkd.   "'987654'.

       PERFORM bdc_field       USING 'VBKD-BSTDK'

                                     podate. "'05.06.2016'.

       PERFORM bdc_field       USING 'KUAGV-KUNNR'

                                     zsalesapproval-kunnr. "'19'.

       PERFORM bdc_field       USING 'KUWEV-KUNNR'

                                     zsalesapproval-kunwe. "'18'.

       PERFORM bdc_field       USING 'RV45A-KETDAT'

                                     curdate. "'13.07.2016'.

       PERFORM bdc_field       USING 'RV45A-KPRGBZ'

                                     'D'.

       PERFORM bdc_field       USING 'VBKD-PRSDT'

                                     curdate. "'13.07.2016'.

       PERFORM bdc_field       USING 'VBKD-ZTERM'

                                     'Z015'.

       PERFORM bdc_field       USING 'VBKD-INCO1'

                                     'CFR'.

       PERFORM bdc_field       USING 'VBKD-INCO2'

                                     'Costs and Freight'.

       PERFORM bdc_field       USING 'BDC_CURSOR'

                                     'VBAP-WERKS(02)'.

       PERFORM bdc_field       USING 'RV45A-MABNR(02)'

                                     <fs_orderitems>-matnr. "'n330 pb'.

       PERFORM bdc_field       USING 'RV45A-KWMENG(02)'

                                     ordqty."'                  5'.

       PERFORM bdc_field       USING 'VBAP-VRKME(02)'

                                     <fs_orderitems>-meins. "'to'.

       PERFORM bdc_field       USING 'VBAP-WERKS(02)'

                                     <fs_orderitems>-werks. "'p002'.

     ENDIF.

   ENDLOOP.

   PERFORM bdc_dynpro      USING 'SAPMV45A' '4001'.

"Till this level it will open order to make "modify , other wise put on below mentioned code to save fully. Additional data can be placed if required it is just sample.


*-----------------------------------------------------------------------------------------

**  PERFORM bdc_field       USING 'BDC_OKCODE'

**                                '/00'.      "'=SICH'.

**  PERFORM bdc_field       USING 'VBKD-BSTKD'

**                                zsalesapproval-bstkd.       "'987654'.

**  PERFORM bdc_field       USING 'VBKD-BSTDK'

**                                podate. "'05.06.2016'.

**  PERFORM bdc_field       USING 'KUAGV-KUNNR'

**                                zsalesapproval-kunnr. "'19'.

**  PERFORM bdc_field       USING 'KUWEV-KUNNR'

**                                zsalesapproval-kunwe. "'18'.

**  PERFORM bdc_field       USING 'RV45A-KETDAT'

**                                curdate. "'13.07.2016'.

**  PERFORM bdc_field       USING 'RV45A-KPRGBZ'

**                                'D'.

**  PERFORM bdc_field       USING 'VBKD-PRSDT'

**                                curdate. "'13.07.2016'.

**  PERFORM bdc_field       USING 'VBKD-ZTERM'

**                                'Z015'.

**  PERFORM bdc_field       USING 'VBKD-INCO1'

**                                'CFR'.

**  PERFORM bdc_field       USING 'VBKD-INCO2'

**                                'Costs and Freight'.

**  PERFORM bdc_field       USING 'BDC_CURSOR'

**                                'RV45A-MABNR(02)'.

**  PERFORM bdc_dynpro      USING 'SAPLSPO2' '0101'.

**  PERFORM bdc_field       USING 'BDC_OKCODE'

**                                '=OPT1'.

*-----------------------------------------------------------------------------------------

    

   PERFORM bdc_transaction USING 'VA01'.

ENDFORM.                    " SALESORDER_BDC