This website is not affiliated with, sponsored by, or approved by SAP AG.

BDC and Screens.

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

BDC and Screens.

Postby john_mayor » Mon Aug 04, 2003 2:14 am

Hi All,

I have a problen while writing a BDC for PO Creation.

The PCs used at the place am based very in resolution and when I want to populate the line items, I dont know what to do as the number of line items visible on the screen differ on different PCs.

What can I do to resolve the problem in my BDC?

Its very urgent.

Thanks in advance.

John
john_mayor
 

Postby Rich » Mon Aug 04, 2003 3:12 am

Hi John,

You've hot a very common problem that has been answered here many times.

What you do for inserting lines is to select line one of the screen table and then click the insert button.

Do this for each line in your BDC and then you only have to worry about line one of the table:

Code: Select all
Form Add_Item_Line Tables t_Item_Data
                    using pu_program     type Program_Name
                          pu_screen      like sy-dynnr
                          pu_insert_line like sy-ucomm
                          pu_insert_at   like sy-tabix
                          pu_werks       like Zorder_Header-Dwerk.
*
     Data: t_characteristics type Order_Lines,
           w_Characteristic like Zorder_Line.
*
     Perform Zbdc_Screen using pu_Program pu_Screen.
     Perform Zbdc_Field  using c_OkCode pu_insert_line.           <--------
     Perform Zbdc_Screen using pu_Program pu_Screen.
*
     Loop at t_Item_Data into w_Characteristic.
*
*         Is this actually part of the item line or is it a
*         Characteristic ?
*
          Translate w_Characteristic-AtNam to Upper Case.
          Case w_Characteristic-AtNam.
               When 'MATNR'.              " Material
                    Perform Zbdc_Subscript using 'VBAP-MATNR'
                                                 pu_insert_at
                                                 W_Characteristic-AtWrt.
                    Perform Zbdc_Subscript using 'VBAP-WERKS'
   


Looking at it from a modification point of view, the aim will be always to bring the line of the table that you're interested in to line one of the table
so again you only need to handle line one of the screen table. Some of the codes for this are 'POPO' in Purchase order processing, and 'SORT' in CO02:

Code: Select all
*
*  Now loop round the P/O and delete all of those that we don't want
*
   Loop at t_ekpo.
*
*       Keep this P/O Line item ?
*
        MOVE SY-TABIX TO W_POPO.
        PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0270'.
        PERFORM ZBDC_FIELD  USING 'BDC_OKCODE' '=POPO'.
        PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0111'.
        PERFORM ZBDC_FIELD  USING 'RV50A-POSNR' W_POPO.
        PERFORM ZBDC_FIELD  USING 'BDC_OKCODE' '/00'.
        Read Table t_vl31_asn with key ebeln = t_ekpo-ebeln
                                       ebelp = t_ekpo-ebelp.
        If sy-subrc <> 0.
*
*          Not found - discard this one.
*
           PERFORM ZBDC_SCREEN USING 'SAPMV50A'   '0270'.
           PERFORM ZBDC_FIELD  USING 'RV50A-LIPS_SELKZ(01)' 'X'.
        ELSE.
*
*          Change the quantity....
*
           WRITE T_VL31_ASN-MENGE TO W_MENGE UNIT T_VL31_ASN-LMEIN.
           CONDENSE W_MENGE NO-GAPS.
           PERFORM ZBDC_SCREEN USING 'SAPMV50A' '0270'.
           PERFORM ZBDC_FIELD  USING 'LIPS-LFIMG(01)' W_MENGE.
        EndIf.
   EndLoop.


Hope this helps.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool


Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 4 guests





This website is not affiliated with, sponsored by, or approved by SAP AG.