Upload Code Groups Using QS41

See the sample BDC program for CODE ZGROUPS 

REPORT zpm_code_group_upload
NO STANDARD PAGE HEADING LINE-SIZE 255.

* Standard Include for Selection Screen
INCLUDE bdcrecx1.

* Internal Table for Upload Data
DATA: BEGIN OF i_codegroup OCCURS 0,
katalogart(001), " Catalog
codegruppe(008), " Code Group
kurztext(040), " Description
* status(001), " Status
END OF i_codegroup.

* Parameters
PARAMETERS: p_file LIKE ibipparms-path. " Filename

* At selection-screen on Value Request for file Name
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

* Get the F4 Values for the File
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.

* Start of Selection
START-OF-SELECTION.

* Open the BDC Session
PERFORM open_group.

* Upload the File into internal Table
CALL FUNCTION 'UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = i_codegroup
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
OTHERS = 7.

IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

sort i_codegroup by katalogart.
* Upload the Data from Internal Table
LOOP AT i_codegroup.
* Initial Screen
PERFORM bdc_dynpro USING 'SAPLQSBA' '0010'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EAEND'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RQSBA-CODEGRUPPE'.
PERFORM bdc_field USING 'RQSBA-KATALOGART'
i_codegroup-katalogart.
PERFORM bdc_field USING 'RQSBA-CODEGRUPPE'
i_codegroup-codegruppe.
* Second Screen
PERFORM bdc_dynpro USING 'SAPLQSBA' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'V_QPGR_KAT-STATUS(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SAVE'.
PERFORM bdc_field USING 'V_QPGR_KAT-KURZTEXT(01)'
i_codegroup-kurztext.
PERFORM bdc_field USING 'V_QPGR_KAT-STATUS(01)'
'2'. "i_codegroup-status.
* Call the Transaction
PERFORM bdc_transaction USING 'QS41'.

ENDLOOP.

* Close the BDC Session
PERFORM close_group.

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.